WebRTC IP Leak: Why a VPN Does Not Always Hide Your IP
What WebRTC is, how a page can learn your real IP address through it even with a VPN on, how to check it in a minute and how to close the leak in Chrome, Firefox and Brave.
You turn on a VPN, check your IP on any site, see someone else's address and relax. But there is a way for a page to learn your real address around the VPN or proxy. It is called the WebRTC leak.
What WebRTC is
WebRTC is the technology built into browsers for calls, video conferences and file transfer directly between users, without a server in the middle. For two browsers to find each other, each needs to know its own network addresses: the local one in the home network and the public one the internet sees.
To get them, the browser gathers ICE candidates, a list of addresses it can be reached at. It learns the public address by asking a STUN server: "which address did my request come from?".
How the leak happens
A page can open a WebRTC connection without a call and without asking you, only to collect the candidates. The trouble is that the STUN request sometimes goes around the VPN:
- A VPN that is a browser extension. Most of them set a proxy only for ordinary HTTP requests. WebRTC uses UDP and goes straight out through your real connection.
- Split tunnelling. If the browser is excluded from the tunnel, all of its traffic, WebRTC included, goes directly.
- IPv6. The VPN protects only IPv4 while your provider also gave you an IPv6 address, and WebRTC shows it.
Browsers used to reveal the local address too, something like 192.168.1.10. Chrome and other Chromium-based browsers now hide it behind a random *.local name (mDNS) by default, but on some devices and older versions the local address is still visible.
How to check in a minute
- Turn on your VPN or proxy the way you normally use it.
- Open the IP leak test. It compares the address the server sees with the addresses WebRTC gives out.
- If WebRTC shows an address different from your VPN's, that is a leak.
- Check for a DNS leak as well: even with the IP protected, DNS queries can go to your provider and give it away.
How to close the leak
- Use a system VPN, not an extension. A VPN client at the operating system level puts all traffic, UDP included, into the tunnel. Turn on its leak protection (kill switch) and, if the VPN does not support IPv6, disable IPv6 or turn on IPv6 blocking in the client.
- Firefox. In about:config you can restrict WebRTC (
media.peerconnection.ice.default_address_onlyset totrue) or turn it off completely (media.peerconnection.enabledset tofalse). The second one breaks video calls in the browser. - Brave. The privacy settings have a "WebRTC IP handling policy": choose the option that disables non-proxied UDP.
- Chrome. There is no switch for WebRTC in the normal settings. Google's official WebRTC Network Limiter extension or the
WebRtcIPHandlingenterprise policy does the job.
Run the test again after any change: browser settings and updates sometimes reset.
Summary
WebRTC is a useful technology and not a hole by itself. The leak happens when the VPN does not cover all traffic. Checking takes a minute, and fixing it usually comes down to the right VPN client and one browser setting. To see what else your browser tells sites besides its address, read about the browser fingerprint.
Check what your browser gives away
Run the free fingerprint test: canvas, WebGL, fonts, WebRTC, TCP/IP and TLS, checked for consistency on our server.