Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 4 min read

WebRTC Leaks in Chrome: Why a Proxy Doesn't Stop Them, and How to Actually Check

WebRTC Leaks in Chrome: Why a Proxy Doesn't Stop Them, and How to Actually Check If you've configured a proxy in Chrome and assumed your real IP is hidden everywhere, WebRTC is the thing most likely to prove you wrong.

WebRTC Leaks in Chrome: Why a Proxy Doesn't Stop Them, and How to Actually Check

If you've configured a proxy in Chrome and assumed your real IP is hidden everywhere, WebRTC is the thing most likely to prove you wrong.

Quick answer

A standard HTTP/HTTPS (or even SOCKS5) proxy only routes traffic through the proxy types it's configured for. WebRTC's connection negotiation uses ICE candidates gathered over UDP, which can include your real local and public IP addresses β€” and most HTTP proxies don't touch UDP traffic at all. The fix is a separate browser-level setting, not a "better proxy."

Why a proxy doesn't cover this

A typical proxy configuration (whether system-level, a launch flag, or an extension) intercepts the traffic types it's set up for β€” usually HTTP/HTTPS, sometimes SOCKS. WebRTC, used for video calls, screen sharing, and some real-time web apps, negotiates connections through an ICE (Interactive Connectivity Establishment) process that gathers candidate addresses β€” including, in many configurations, your actual local network IP and your public IP as seen by a STUN server β€” independent of whatever proxy your HTTP traffic is going through.

In other words: your page requests might be routing through 203.0.113.50 (the proxy), while a WebRTC connection on the same page reveals your real IP is 198.51.100.12. Two different code paths, two different IPs.

Check it yourself β€” no third-party site needed

You don't need to trust an external "WebRTC leak test" site with your data. Open DevTools on any page and run this in the console:

(function checkWebRTCLeak() {
  const ips = new Set();
  const pc = new RTCPeerConnection({ iceServers: [{ urls: 'stun:stun.l.google.com:19302' }] });
  pc.createDataChannel('');
  pc.onicecandidate = (event) => {
    if (!event.candidate) {
      console.log('IPs found via WebRTC ICE candidates:', [...ips]);
      pc.close();
      return;
    }
    const match = event.candidate.candidate.match(/([0-9]{1,3}\.){3}[0-9]{1,3}/);
    if (match) ips.add(match[0]);
  };
  pc.createOffer().then((offer) => pc.setLocalDescription(offer));
})();

Compare the IPs this logs against whatever IP your proxy is supposed to be presenting. If you see an IP that isn't your proxy's, that's the leak.

Reading the result: a host candidate is typically a local network address (e.g. 192.168.x.x or 10.x.x.x) and isn't by itself a public-internet leak. A srflx (server-reflexive) candidate from a STUN exchange is the one that can reveal your actual public IP, bypassing an HTTP-level proxy entirely.

How to actually stop it in Chrome

Chrome extensions can control WebRTC leak behavior through the privacy API, specifically the webRTCIPHandlingPolicy setting. The relevant policy values:

  • default β€” no restriction (the leaky default).
  • default_public_interface_only β€” only exposes the IP of the default public interface; local/private IPs are hidden from candidates.
  • disable_non_proxied_udp β€” forces WebRTC to only use UDP if it's going through a proxy that supports it, which in practice blocks most direct UDP-based IP exposure.

An extension sets this with:

chrome.privacy.network.webRTCIPHandlingPolicy.set({
  value: 'disable_non_proxied_udp',
});

This requires the privacy permission in the extension's manifest, and it's a browser-wide setting β€” it affects all tabs, not just the one connected to a proxy.

Axio Proxy, which I work on, sets disable_non_proxied_udp while a proxy session is active and clears it when you disconnect β€” the same mechanism described above, nothing more exotic.

What this doesn't cover

  • Firefox and Edge have their own WebRTC leak settings (Firefox: media.peerconnection.enabled in about:config, among others) β€” this post is Chrome/Chromium-specific.
  • This doesn't make you anonymous. It closes one specific leak vector. Canvas fingerprinting, font enumeration, and other browser fingerprinting techniques are separate problems with separate mitigations.
  • Disabling WebRTC entirely (rather than just restricting its IP handling) will break legitimate uses β€” video calls, some screen-sharing tools, certain real-time collaboration apps. disable_non_proxied_udp is a narrower fix than turning WebRTC off outright.

FAQ

What is a WebRTC leak?
WebRTC's ICE candidate-gathering process can expose your real local and/or public IP address even when your HTTP traffic is routed through a proxy or VPN that doesn't also handle UDP.

Does a VPN have the same problem?
Many VPNs route all traffic including UDP, which sidesteps this specific issue β€” but that depends on the VPN's implementation, not something you can assume from "it's a VPN."

Is disabling WebRTC good for privacy generally?
It closes one leak vector. It's not a general-purpose anonymity switch, and sites with legitimate real-time-communication features will stop working if you disable WebRTC outright rather than just restricting its IP handling policy.

Does a proxy extension automatically stop WebRTC leaks?
Only if it explicitly sets the IP handling policy β€” proxying your HTTP traffic alone does not touch WebRTC's UDP-based candidate gathering.

If you've tested this against your own proxy setup, what did the console script show β€” any srflx candidates leaking through?

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.