Glossary
WebRTC leak: when the browser reveals the real address
A WebRTC leak is the exposure of a device's real IP address through the browser's WebRTC connection setup, even while normal page traffic goes through a proxy or VPN.
Definition
WebRTC is the browser technology for real time audio, video and data between peers. To connect two peers it must discover possible network paths, called ICE candidates: local network addresses, the public address seen by a STUN server, and relay addresses. Those candidates are gathered by the browser itself, over UDP, often outside the proxy that carries HTTP requests. A page can trigger this discovery with a few lines of JavaScript and read the results, even if it never opens a call.
How the leak happens
- The page creates an
RTCPeerConnectionwith a STUN server. - The browser sends a STUN request directly over UDP, bypassing an HTTP proxy.
- The STUN server replies with the public address it saw, which is the real one.
- The page reads the candidates and sends them back to its own server.
const pc = new RTCPeerConnection({ iceServers: [{ urls: "stun:stun.example.org:3478" }] });
pc.createDataChannel("probe");
pc.onicecandidate = (ev) => {
if (ev.candidate) console.log(ev.candidate.candidate);
};
pc.createOffer().then((o) => pc.setLocalDescription(o));
Modern browsers hide local network addresses behind random mDNS names by default, which closed the oldest form of the leak. The public address through STUN can still appear if UDP is not routed through the proxy.
Why it matters for consistency
For a detection system the leak is a free comparison. The HTTP request says the visitor is in one city through one ISP; the WebRTC candidate says another. That disagreement is a strong sign of a proxy, and it ties sessions across different proxies back to one real machine. It is the network version of a mismatched user agent.
A leak also undermines geotargeted testing. If you check how a page looks from another country but the site sees your real address too, it may serve something different from what a real visitor there would see.
Testing for a leak
Open your automated browser through its proxy, run the snippet above on a page you control, and compare the printed addresses with the proxy's exit IP. If a public candidate matches your real address, you have a leak. Repeat the test after any browser update, since defaults change.
Check headful and headless runs separately. Launch flags, policies and extensions can differ between the two modes, and a fix applied in one does not always carry over to the other.
Preventing it
- Browser policy: Chromium has a WebRTC IP handling policy that can restrict candidates to the proxied route; set it through launch flags or enterprise policy.
- Route UDP: a SOCKS5 proxy with UDP support, or a system level tunnel, keeps STUN traffic on the same path. See SOCKS5 proxy.
- Profile settings: antidetect browsers usually offer modes that replace or hide candidates to match the proxy.
- Do not simply disable it: a browser with no WebRTC at all is unusual and can be its own signal; aligning the address is better.
WebRTC and CAPTCHA tasks
Cookie answers depend on network consistency. A Cloudflare Challenge or DataDome Slider cookie is issued to the proxy address you supplied in the task. If the page you then load leaks a different public address, the site sees two locations for one session and may challenge again. Fix the leak first, then reuse the cookie with the same proxy and User-Agent. Token tasks like reCAPTCHA v2 are less sensitive, but the session that submits the token is still scored with everything the page can see. The guide to proxies for CAPTCHA solving covers choosing and configuring the proxy side.
Common questions
Does a VPN prevent WebRTC leaks?
A full system VPN usually does, because all traffic including UDP goes through the tunnel; browser only proxies often do not.
Do modern browsers still leak local IP addresses?
Most now hide local addresses behind random mDNS names, but the public address via STUN can still leak outside the proxy.
Should I disable WebRTC in my scraper?
Prefer restricting it to the proxied route; a browser with WebRTC missing entirely is uncommon and may look suspicious.
How do I check if my browser leaks?
Collect ICE candidates on a page you control while using the proxy and compare them with the proxy's exit IP.
Can a WebRTC leak invalidate a clearance cookie?
It can lead to new challenges, because the site sees an address that differs from the proxy the cookie was issued to.
Keep reading
- SOCKS5 proxySOCKS5 relays raw TCP and UDP connections rather than HTTP messages; compare it with HTTP proxies and see how it authenticates.
- Antidetect browserBrowsers that keep many separate fingerprint profiles with their own cookies and proxies, and where they are legitimately used.
- Choosing proxies for CAPTCHA solvingWhen a CAPTCHA task needs your proxy, which network type fits, and why answers must stay on the same IP.
- Mismatched user agentWhen the header, client hints, TLS handshake and in-page JavaScript describe different browsers, and why that draws challenges.