Auditing WebRTC media transport and session protection
WebRTC protection spans signalling, relay use and the media sessions that depend on those decisions. Understanding WebRTC media transport and session protection helps establish which security property the feature needs and where that property is actually enforced.
What does this involve?
Session and token controls preserve an authentication decision over time. They need a defined scope, lifetime and invalidation policy. A token should be accepted because a trusted service has verified the relevant properties, not simply because its structure looks familiar.
These requirements only apply to systems that host their own WebRTC media servers, such as Selective Forwarding Units (SFUs), Multipoint Control Units (MCUs), recording servers, or gateway servers. Media servers handle and distribute media streams, making their security critical to protect communication between peers. Safeguarding media streams is paramount in WebRTC applications to prevent eavesdropping, tampering, and denial-of-service attacks that could compromise user privacy and communication quality.
In particular, it is necessary to implement protections against flood attacks such as 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. It is also important to protect the system from malformed packets by implementing input validation, safely handling integer overflows, preventing buffer overflows, and employing other robust error-handling techniques.
Why it matters
Consider a realistic failure: a communication feature authenticates its web page but permits unauthorised relay use or an unintended session participant.
A reusable credential can let someone continue acting as an account after the intended access should have ended. Long-lived access, excessive token contents and inconsistent revocation can increase the exposure beyond the initial event.
A code audit connects a stated requirement to the implementation responsible for enforcing it. Source review and targeted behavioural checks should explain the same boundary and any relevant exceptions.
How penetration testers check for it
Review the specific control expectations below against the code, deployment and observable application behaviour.
- Confirm that the key for the Datagram Transport Layer Security (DTLS) certificate is managed and protected based on the documented policy for management of cryptographic keys.
- Confirm that the media server is configured to use and support approved Datagram Transport Layer Security (DTLS) cipher suites and a secure protection profile for the DTLS Extension for establishing keys for the Secure Real-time Transport Protocol (DTLS-SRTP).
- Confirm that Secure Real-time Transport Protocol (SRTP) authentication is checked at the media server to prevent Real-time Transport Protocol (RTP) injection attacks from leading to either a Denial of Service condition or audio or video media insertion into media streams.
- Confirm that the media server is able to continue processing incoming media traffic when encountering malformed Secure Real-time Transport Protocol (SRTP) packets.
- Confirm that the media server is able to continue processing incoming media traffic during a flood of Secure Real-time Transport Protocol (SRTP) packets from legitimate users.
- Confirm that the media server is not susceptible to the "ClientHello" Race Condition vulnerability in Datagram Transport Layer Security (DTLS) by checking if the media server is publicly known to be vulnerable or by performing the race condition test.
- Confirm that any audio or video recording mechanisms associated with the media server are able to continue processing incoming media traffic during a flood of Secure Real-time Transport Protocol (SRTP) packets from legitimate users.
- Confirm that the Datagram Transport Layer Security (DTLS) certificate is checked against the Session Description Protocol (SDP) fingerprint attribute, terminating the media stream if the check fails, to ensure the authenticity of the media stream.
- Test logout, permission changes and credential replacement.
- Inspect replay and concurrent use according to the documented design.
How to fix it
Implement the required boundary in the component that actually performs the sensitive operation and retain focused regression coverage.
- Use appropriately scoped credentials with bounded lifetimes.
- Validate trusted issuance and relevant claims consistently.
- Rotate and revoke according to the session model.
- Keep credentials out of unnecessary URLs, logs and persistent copies.
Some designs intentionally use short-lived credentials without immediate global revocation. Assess the complete lifetime and access model before calling that design a failure.
Recheck the changed behaviour against the original failure conditions and the legitimate user journey. Keep enough evidence to show which release and configuration were verified, and include related entry points that depend on the same security decision.
Related issues
- Applying transport protection across application data flows
- Reviewing WebRTC signalling authentication and authorisation
- Reviewing WebRTC TURN server access and relay abuse
Read about our methodology or contact pentested.com to discuss the security of your application code.