WebRTC IP Leak
WebRTC IP leak is the exposure of a browser’s real public IP address through the WebRTC API, even when an HTTP or SOCKS4 proxy is correctly configured. It is the most common cause of IP leakage in proxied browser automation.Why It Happens
WebRTC (Web Real-Time Communication) is designed for peer-to-peer audio/video between browsers. To establish a direct P2P connection, it must discover the client’s real public IP address using STUN servers over UDP. The problem: WebRTC uses UDP, and most proxies only handle TCP. The STUN query goes directly to the network interface, bypassing the browser’s proxy configuration. The OS routing table determines the path, not the browser.The ICE Process
WebRTC uses ICE (Interactive Connectivity Establishment, RFC 8445) to gather connection candidates:- Host candidates: local LAN IPs (e.g.,
192.168.1.100) — reveals network topology; Chrome 75+ mitigates with mDNS names when no media permissions granted - Server reflexive candidates: your real public IP as seen by a STUN server — the primary leak
- Relay candidates: TURN server addresses — may still contain real IP in
raddrfield
RTCPeerConnection.onicecandidate and send your real IP to a tracking server.
Minimal Exploit (10 lines of JS)
Why HTTP and SOCKS4 Cannot Stop This
- They only proxy TCP connections
- WebRTC STUN operates on UDP
- WebRTC accesses the OS network stack directly, below the browser’s proxy settings
Mitigations
In Pydoll:
options.webrtc_leak_protection = True applies the recommended mitigation.
Related Bypass Vectors
- QUIC (HTTP/3): also runs over UDP; Chrome uses it by default. Disable with
--disable-quicflag to force HTTP/2 over TCP and ensure all web traffic stays in the proxy. - DNS over UDP: plain DNS queries bypass TCP-only proxies. SOCKS5 with UDP support proxies DNS; alternatively configure DNS-over-HTTPS.
Testing
Manual: visitbrowserleaks.com/webrtc — if your real IP appears under “Public IP Address”, you’re leaking.
Automated: check whether detected IPs include anything other than the proxy IP.
Always test after configuring WebRTC mitigation. A single leak instantly compromises the entire proxy setup, revealing real location, ISP, and internal network topology.
Related Pages
- Proxy Rotation — proxy types and UDP support matrix
- Web Fingerprinting — WebRTC leak as one vector in the multi-layer detection system
- Pydoll —
webrtc_leak_protectionproperty and CDP-based mitigations