Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for Addition of WebRTC Security Subcategory in ASVS #1612

Closed
ImanSharaf opened this issue Apr 11, 2023 · 24 comments
Closed

Request for Addition of WebRTC Security Subcategory in ASVS #1612

ImanSharaf opened this issue Apr 11, 2023 · 24 comments
Assignees
Labels
2) Awaiting response Awaiting a response from the original poster Community needed This issue will not be progressed without community input. Will be closed if stale. Community wanted We would like feedback from the community to guide our decision otherwise we will progress _5.0 - prep This needs to be addressed to prepare 5.0

Comments

@ImanSharaf
Copy link
Collaborator

ImanSharaf commented Apr 11, 2023

I noticed that there is a dedicated subcategory for WebSocket security, but not for WebRTC (Web Real-Time Communication). Given the growing adoption of WebRTC in modern applications for audio, video, and data communication, I believe it is essential to address its security considerations within the ASVS.

I would like to propose the addition of a new subcategory specifically for WebRTC security. This subcategory could include items such as:

  • Ensuring secure WebRTC signaling channels (e.g., TLS)
  • Validating and sanitizing SDP (Session Description Protocol) exchanges
  • Implementing secure WebRTC session termination
  • Utilizing secure communication mechanisms for media and data streams such as DTLS-SRTP

I can write them in the ASVS style after we confirm what requirements we want to add.
Also, there are some good write-ups that we can extract valuable checks out of them such as this one ($3,500 was paid as bounty by Slack):

  • Verify that the TURN server implements blacklist to block sensitive addresses from being specified as the XOR-PEER-ADDRESS in TURN messages

Inclusion of these items and potentially others would significantly benefit the community by raising awareness and providing guidance on securing WebRTC implementations.

@tghosth
Copy link
Collaborator

tghosth commented Jun 15, 2023

Can you suggest requirements that you think are not explicitly covered by existing requirements.

For example, I think we already have a requirement that all communications should be via TLS so I don't think we need extra requirements for that.

@tghosth tghosth added 1) Discussion ongoing Issue is opened and assigned but no clear proposal yet _5.0 - prep This needs to be addressed to prepare 5.0 Community wanted We would like feedback from the community to guide our decision otherwise we will progress labels Jun 15, 2023
@tghosth
Copy link
Collaborator

tghosth commented Sep 28, 2023

hi @ImanSharaf any thoughts on this?

@ImanSharaf
Copy link
Collaborator Author

The specific check related to the TURN server and XOR-PEER-ADDRESS addresses a unique WebRTC-related concern that isn't necessarily covered by general security guidelines. SDP exchanges are unique to WebRTC and similar real-time communication protocols. Validating and sanitizing these exchanges are essential as they contain vital information about the media and data streams. They could be exploited if not secured properly. Unlike traditional communication channels, WebRTC sessions have unique characteristics, and ensuring their secure termination is essential to avoid unintended data leaks or unauthorized access.

@tghosth
Copy link
Collaborator

tghosth commented Oct 3, 2023

So can you suggest some specific requirements @ImanSharaf ?

@ImanSharaf
Copy link
Collaborator Author

Sure, do we want to create a subcategory for WebRTC similar to Websocket?

@elarlang
Copy link
Collaborator

elarlang commented Oct 4, 2023

How many requirements you have in mind? Web Socket category in my opinion contains duplicates which can easily handled with "parent" or more general requirement (but this is separate topic).

@tghosth
Copy link
Collaborator

tghosth commented Oct 5, 2023

Yeah let's see the WebRTC requirements first and then decide if we want a dedicated section or not.

@elarlang elarlang added the 2) Awaiting response Awaiting a response from the original poster label Dec 6, 2023
@tghosth
Copy link
Collaborator

tghosth commented Jan 25, 2024

@ImanSharaf do you have suggested requirements for this?

@tghosth tghosth added Community needed This issue will not be progressed without community input. Will be closed if stale. and removed 1) Discussion ongoing Issue is opened and assigned but no clear proposal yet labels Jan 25, 2024
@sandrogauci
Copy link
Contributor

Hi there, as mentioned on X, we should be able to help on this very topic since it is one of our favorites 🙂.

Some references of past publications:

Also attaching the mindmap that we created to illustrate the WebRTC infrastructure attack surface as we see it.

WebRTC Infrastructure Attack Surface

We hope to convert some of this into ASVS styled requirements. Is this a good direction?

cc: @tghosth @ImanSharaf

@ImanSharaf
Copy link
Collaborator Author

@sandrogauci thank you. Please propose your suggested requirements.

@jmanico
Copy link
Member

jmanico commented Jul 10, 2024 via email

@tghosth
Copy link
Collaborator

tghosth commented Jul 11, 2024

Hi @sandrogauci,

This sounds really interesting.

A few comments:

  • It would be good to make clear which requirements are relevant for someone implementing the WebRTC protocol themselves and which are relevant for someone utilizing someone else's implementation.
  • Please try and focus on guidance which is WebRTC specific and doesn't duplicate.
  • Where you have guidance that is more detailed, consider including high level guidance for ASVS and using the more detailed guidance to create an OWASP Cheat Sheet.

@sandrogauci
Copy link
Contributor

hey @tghosth - I hope to start working on this tomorrow.

Your comments make total sense - most of our work has been for people implementing the WebRTC protocols themselves but most people will not be doing that and will use some existent SDK which uses some CPaaS. I'll give it further thought, but offhand, such recommendations would be specific to that SDK. Might be too specific for ASVS then? Not sure.

With regards to avoiding duplicates with other areas (e.g. Websocket) - definitely. WebRTC in fact doesn't rely on WS, but WS is one of the more common ways to do signalling.

Thanks for the tip on high level guidance vs more detailed guidance! Very useful, especially for an ASVS newbie like myself 🙂

@sandrogauci
Copy link
Contributor

hi @tghosth - we went through our internal documents and came up with the following so far:

TURN server

  • Verify that the TURN service allows access only to IP addresses that are not reserved for special purposes (e.g., internal networks, broadcast, loopback). Note that this applies to IPv4 and IPv6 addresses.
  • Verify that the TURN service is not susceptible to resource exhaustion when legitimate users attempt to open a large number of ports on the TURN server.

Media

  • Verify that the key for the DTLS certificate is private.
  • Verify that the cipher suites for the DTLS exchange are considered strong.
  • Verify that the media server is not susceptible to the DTLS ClientHello Race Condition vulnerability.
  • Verify that the RTP injection attacks on new or existent media streams do not cause DoS or audio/video media insertion.
  • Verify that the media server is able to handle a flood of SRTP packets from legitimate users.
  • Verify that any audio and/or video recording mechanisms associated with the media server are able to handle a flood of SRTP packets from legitimate users.
  • Verify that the media server is able to handle malformed SRTP packets.

Signalling

  • Verify that the signalling server is able to handle signaling message flood attacks.
  • Verify that the signalling server is able to handle malformed signaling messages.

Naturally there is more work to be done. Is this the right direction?

@sandrogauci
Copy link
Contributor

Updating my comment as per @tghosth suggestion with some introductory text to make it clear to whom the WebRTC security requirements are especially relevant:

General introduction to WebRTC security requirements:

WebRTC (Web Real-Time Communication) has become a cornerstone technology for enabling real-time voice, video, and data communication in web applications. As the adoption of WebRTC grows across various sectors, it is imperative to ensure that security measures are integrated into these implementations. Here we aim to provide comprehensive security requirements tailored to the needs of different stakeholders involved in the WebRTC ecosystem.

The WebRTC market can be broadly categorized into three segments:

  1. Product Developers: These are proprietary and open-source vendors that create and supply WebRTC products and solutions. Their focus is on developing robust and secure WebRTC technologies that can be used by others.

  2. Communication Platforms as a Service (CPaaS): They offer APIs, SDKs, and the necessary infrastructure or platforms to enable WebRTC functionalities. CPaaS providers may use products from the first category or develop their own WebRTC software to offer these services.

  3. Service Providers: These organizations leverage products from product developers or CPaaS providers, or develop their own WebRTC solutions. They create and implement applications for online conferencing, healthcare, e-learning, and other domains where real-time communication is crucial.

The security requirements outlined here are primarily focused on Product Developers, CPaaS and Service Providers who:

  • Utilize open-source solutions to build their WebRTC applications.
  • Use commercial WebRTC products as part of their infrastructure.
  • Use internally developed WebRTC solutions or integrate various components into a cohesive service offering.

It is important to note that these security requirements do not apply to developers who exclusively use SDKs and APIs provided by CPaaS vendors. For such developers, the CPaaS providers are typically responsible for most of the underlying security concerns within their platforms, and a generic security standard like ASVS may not fully address their needs.

TURN server

TURN (Traversal Using Relays around NAT) servers play a crucial role in WebRTC applications by facilitating peer-to-peer connections in challenging network environments. However, they can also introduce security risks if not properly configured and secured. These requirements only apply to systems that host TURN servers as part of their WebRTC infrastructure.

Requirements:

  • Verify that the TURN service allows access only to IP addresses that are not reserved for special purposes (e.g., internal networks, broadcast, loopback). Note that this applies to IPv4 and IPv6 addresses.
  • Verify that the TURN service is not susceptible to resource exhaustion when legitimate users attempt to open a large number of ports on the TURN server.

Media handling

Media security is paramount in WebRTC applications, as it directly impacts the confidentiality, integrity and availability of audio and video communications. By addressing these security concerns, developers can safeguard the media streams in WebRTC applications, preventing eavesdropping, tampering, and denial-of-service attacks that could compromise user privacy and communication quality.

Requirements:

  • Verify that the key for the DTLS certificate is private.
  • Verify that the cipher suites for the DTLS exchange are considered strong.
  • Verify that the media server is not susceptible to the DTLS ClientHello Race Condition vulnerability.
  • Verify that the RTP injection attacks on new or existent media streams do not cause DoS or audio/video media insertion.
  • Verify that the media server is able to handle a flood of SRTP packets from legitimate users.
  • Verify that any audio and/or video recording mechanisms associated with the media server are able to handle a flood of SRTP packets from legitimate users.
  • Verify that the media server is able to handle malformed SRTP packets.

Signalling

Signaling is a critical component of WebRTC applications, responsible for coordinating communication sessions between peers. The security of the signaling process is essential to prevent unauthorized access, eavesdropping, and service disruptions.

Requirements:

  • Verify that the signalling server is able to handle signaling message flood attacks.
  • Verify that the signalling server is able to handle malformed signaling messages.

@tghosth
Copy link
Collaborator

tghosth commented Jul 24, 2024

Hi @sandrogauci, this is looking really good :)

A few queries:

Verify that the key for the DTLS certificate is private.

This feels like a basic TLS thing, do you think it is necessary to mention it?

Verify that the cipher suites for the DTLS exchange are considered strong.

What is the action here? To configure the media server with strong cipher suites? Can you reword to focus on the action?

Verify that the RTP injection attacks on new or existent media streams do not cause DoS or audio/video media insertion.

Is there a specific mechanism we could mention which helps to prevent this?

Verify that the media server is able to handle a flood of SRTP packets from legitimate users.

Is there a specific mechanism we could mention which helps to prevent this?

Verify that any audio and/or video recording mechanisms associated with the media server are able to handle a flood of SRTP packets from legitimate users.

Could this be merged with the above?

Verify that the media server is able to handle malformed SRTP packets.

What would it use to handle these? Input validation?

Verify that the signalling server is able to handle signaling message flood attacks.
Verify that the signalling server is able to handle malformed signaling messages.

Again, it would be good to mention the basic mechanisms or techniques which would prevent these, e.g. input validation, rate limiting.

@sandrogauci
Copy link
Contributor

Hi @tghosth thanks for the excellent feedback and the direction. I'll first answer your questions and then update my previous suggestions according to your feedback.

This feels like a basic TLS thing, do you think it is necessary to mention it?

it's indeed a valid question. While DTLS is essentially an extension of TLS for UDP, its application in WebRTC introduces unique security concerns that differ from traditional TLS:

  • Signaling Dependency: DTLS in WebRTC only starts after signaling has exchanged necessary parameters.
  • Certificate Interaction: Certificate checks in WebRTC DTLS require interaction between signaling and DTLS, similar to certificate pinning.
  • ICE Requirement: Interactive Connectivity Establishment (ICE) is a prerequisite.
  • Ephemeral Ports: DTLS in WebRTC often operates over ephemeral ports.
  • Self-Signed Certificates: Many certificates in WebRTC DTLS are self-signed but are verified through fingerprints exchanged at the signaling level, which is acceptable in this context.
  • Testing Complexity: Testing DTLS in WebRTC requires packet-level analysis and custom tools, unlike typical TLS tests.

For more some details, refer to the Introduction to WebRTC and DTLS for Security Professionals.

Also this is coming from having seen the following case: Slack DTLS uses a private key that is in the public domain, which may lead to SRTP stream hijack

Then:

Could this be merged with the above?

regarding your suggestion to merge the SRTP packet handling with recording mechanism checks:

  • Separate Concerns: One check addresses handling resource-intensive codecs and general resource (e.g., CPU) abuse, while the other focuses on recording systems, which are often separate and can be toggled on and off.
  • Recording System Focus: Keeping them separate ensures dedicated attention to recording systems, which might be overlooked otherwise.
  • Recording Impact: Recording systems can generate overly large files when attacked, necessitating distinct security considerations.

Given the above, do you think we should keep them separate or merge them?


I have updated the previous notes/suggested requirements and tried to have a course of action in each of them as you suggested. Is this what you had in mind?

TURN server

  • Verify that the TURN service allows access only to IP addresses that are not reserved for special purposes (e.g., internal networks, broadcast, loopback). Note that this applies to IPv4 and IPv6 addresses.
  • Verify that the TURN service is not susceptible to resource exhaustion when legitimate users attempt to open a large number of ports on the TURN server.

Media handling

  • Verify that the key for the DTLS certificate is private by ensuring it is not reused in existing products or open-source projects and confirming it is not distributed or leaked.
  • Configure the media server to use and support strong cipher suites for the DTLS exchange, ensuring that the selected cipher suites are considered strong and secure.
  • Verify that the media server is not susceptible to the DTLS ClientHello Race Condition vulnerability by checking if the media server is publicly known to be vulnerable or by performing the race condition test.
  • Verify that SRTP authentication is checked at the media server to prevent RTP injection attacks from causing DoS or audio/video media insertion on new or existing media streams.
  • Verify that the media server can handle a flood of SRTP packets from legitimate users by implementing rate limiting, validating timestamps, using synchronized clocks to match real-time intervals, and managing buffers to prevent overflow and maintain proper timing. If packets for a particular media session arrive too quickly, excess packets should be dropped.
  • Verify that any audio and/or video recording mechanisms associated with the media server are able to handle a flood of SRTP packets from legitimate users by implementing rate limiting, validating timestamps, using synchronized clocks to match real-time intervals, and managing buffers to prevent overflow and maintain proper timing. If packets for a particular media session arrive too quickly, excess packets should be dropped.
  • Verify that the media server can handle malformed SRTP packets by implementing input validation, safely handling integer overflows, preventing buffer overflows, and employing other robust error-handling techniques.

Signalling

  • Verify that the signaling server can handle signaling message flood attacks by implementing rate limiting at the signaling level.
  • Verify that the signalling server is able to handle malformed signaling messages by implementing input validation, safely handling integer overflows, preventing buffer overflows, and employing other robust error-handling techniques.

@tghosth
Copy link
Collaborator

tghosth commented Jul 28, 2024

Ok so happy to keep the DTLS private key requirement with the additional explanation and to keep the SRTP packet handling requirements separate.

Do you want to PR your requirements into this file in this branch.

I will have some further tweaks but I'd rather do them as part of the PR review.

@sandrogauci
Copy link
Contributor

Ok so happy to keep the DTLS private key requirement with the additional explanation and to keep the SRTP packet handling requirements separate.

Excellent, I'll include that in.

Do you want to PR your requirements into this file in this branch.

Will do that, probably towards the end of this week.

I will have some further tweaks but I'd rather do them as part of the PR review.

That is great - thanks for the help and assistance!

@sandrogauci
Copy link
Contributor

@tghosth created a PR ☝️ Happy to discuss anything. I gave my reasoning for how I set up the levels per requirement in d3ae9fe, but discussion obviously welcome.

tghosth pushed a commit that referenced this issue Aug 11, 2024
* WebRTC: first commit based on content in issue

#1612 (comment)

* add control objective title

* update references

add relevant RFCs
fix title

* add link to clienthello DoS blog post

* update levels according to criteria in the details below

- signalling 53.3.2 set to l2 based on 5.4.3
- media 53.2.7 set to l2 based on 5.4.3
- targeted application DoS issues (i.e., 53.1.2, 53.2.3, 53.2.5, 53.2.6 and 53.3.1) set to l2 since they are usually targeted attacks
- 53.2.2 level based on 9.4.1

* fix markdown according to markdownlint-cli
@tghosth
Copy link
Collaborator

tghosth commented Aug 11, 2024

Thanks @sandrogauci, I think the levels will all be finalised at the end anyway.

I made some tweaks and some comments here, please could you take a look :)
#2012

This was referenced Aug 12, 2024
tghosth pushed a commit that referenced this issue Aug 27, 2024
* WebRTC: first commit based on content in issue

#1612 (comment)

* add control objective title

* update references

add relevant RFCs
fix title

* add link to clienthello DoS blog post

* update levels according to criteria in the details below

- signalling 53.3.2 set to l2 based on 5.4.3
- media 53.2.7 set to l2 based on 5.4.3
- targeted application DoS issues (i.e., 53.1.2, 53.2.3, 53.2.5, 53.2.6 and 53.3.1) set to l2 since they are usually targeted attacks
- 53.2.2 level based on 9.4.1

* fix markdown according to markdownlint-cli
@tghosth
Copy link
Collaborator

tghosth commented Aug 27, 2024

This was merged in with #2008.

I will close this issue for now!

Thanks @sandrogauci!!!

@sandrogauci
Copy link
Contributor

This was merged in with #2008.

I will close this issue for now!

Thanks @sandrogauci!!!

Many thanks to you too and anyone who contributed!

I have opened #2032 because there was a small mistake introduced in one of the last commits that slipped us.

@tghosth
Copy link
Collaborator

tghosth commented Aug 29, 2024

Oops, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2) Awaiting response Awaiting a response from the original poster Community needed This issue will not be progressed without community input. Will be closed if stale. Community wanted We would like feedback from the community to guide our decision otherwise we will progress _5.0 - prep This needs to be addressed to prepare 5.0
Projects
None yet
Development

No branches or pull requests

5 participants