You connect to a VPN, verify your new location on an IP lookup page, and assume your real location is hidden. Yet, a single script on a webpage can bypass that protection in milliseconds. At 365Finds, we repeatedly see users shocked when an IP leak test still displays their residential ISP address alongside their secure VPN exit node.
The culprit is WebRTC (Web Real-Time Communication). It is not a malware infection, nor is it necessarily a failure of your VPN provider's encryption algorithms. Instead, WebRTC behaves exactly as the standard was engineered to behave: aggressively discovering every possible network path to establish direct, low-latency peer-to-peer media streams. Understanding why this happens—and where browser architecture diverges from operating-system-level networking—is essential to plugging the leak.
The Architectural Conflict: Peer-to-Peer vs. Proxy Routing
WebRTC is baked into modern web browsers (Chromium, Firefox, Safari) to allow voice, video, and arbitrary peer-to-peer data transfers without external plugins. For standard web surfing, your browser acts as a client querying remote servers over TCP. If you run a full-tunnel VPN or route traffic through a proxy, that client-server TCP traffic neatly passes through the encrypted tunnel.
Peer-to-peer communication breaks this paradigm. To establish a direct audio or video link between two browsers located behind residential routers and Network Address Translation (NAT) gateways, the browsers must figure out their actual public and local network addresses.
WebRTC accomplishes this through the ICE (Interactive Connectivity Establishment) framework, relying heavily on STUN (Session Traversal Utilities for NAT) and TURN (Traversal Using Relays around NAT):
- Host Candidates: The browser queries local network adapters for internal IP addresses (such as
192.168.1.xor link-local IPv6 addresses). - Server Reflexive Candidates (
srflx): The browser fires off lightweight UDP requests to an external STUN server (frequently hosted by Google or web communication providers). The STUN server examines the incoming UDP packet and responds: "From the outside internet, your packet arrived from IP address X and port Y." - Relay Candidates (
relay): If direct firewall traversal fails, traffic is routed through an intermediary TURN server.
The critical vulnerability lies in step two. A website does not need your permission to access your camera or microphone to initiate an ICE candidate harvest. A silent, five-line JavaScript snippet can instantiate an RTCPeerConnection object in the background:
const pc = new RTCPeerConnection({
iceServers: [{ urls: "stun:stun.l.google.com:19302" }]
});
pc.createDataChannel("");
pc.createOffer().then(offer => pc.setLocalDescription(offer));
pc.onicecandidate = (event) => {
if (event.candidate) {
console.log("Candidate discovered:", event.candidate.candidate);
}
};
When this script runs, the browser sends STUN packets over UDP. How your operating system handles those UDP packets determines whether your real IP leaks.
Why the Leak Occurs Even With a VPN Connected
At 365Finds, we classify WebRTC leaks into three primary technical scenarios:
1. Browser Extensions vs. System-Wide VPN Tunnels
The most frequent cause of an "active VPN" leaking WebRTC is that the user is not running an operating-system-level VPN at all. Many commercial VPN "browser extensions" are actually SOCKS5 or HTTPS proxies configured inside the browser.
Traditional browser proxies only handle standard HTTP/HTTPS traffic. When WebRTC fires raw UDP queries to a STUN server, the browser often bypasses the extension proxy entirely and routes the packets out of the physical network interface (Wi-Fi or Ethernet), immediately exposing the real ISP IP.
2. Multihoming and Split Default Gateways
On a system running a full-tunnel desktop VPN client, the VPN creates a virtual network interface (TUN/TAP). However, modern operating systems maintain routing tables with multiple active interfaces—such as an active physical Ethernet/Wi-Fi adapter alongside the VPN tunnel.
To achieve the lowest possible latency for real-time media, WebRTC's ICE implementation explores all available interfaces unless explicitly restricted. If the operating system or VPN client fails to bind default routes strictly, or if the STUN UDP packet leaves via the physical adapter before the tunnel route binds, the STUN server sees and returns the physical public IP.
3. IPv6 Escapes
Many VPNs still only route IPv4 traffic through their tunnels. If your ISP provides native dual-stack IPv4/IPv6, but your VPN client only handles IPv4, your browser's WebRTC implementation will send STUN requests over IPv6 via your ISP's physical router. While your IPv4 address appears masked, your real IPv6 address is exposed directly to the site.
Modern browsers have mitigated internal LAN mapping by replacing local host IP candidates with randomized mDNS names (.local UUIDs). However, mDNS does nothing to stop the discovery of public server reflexive (srflx) addresses.
How to Test for Active WebRTC Leaks
To confirm whether your current setup leaks:
- Connect to your VPN service.
- Open your browser and navigate to a dedicated leak testing service like
https://browserleaks.com/webrtc. - Check the WebRTC Status and IP Address Detection sections:
- No Leak: The STUN reflexive candidate (
srflx) section matches your VPN server's public IP address, or displays no public IP at all. - Active Leak: The test displays your residential ISP IP address under public WebRTC candidates, while your HTTP exit node displays the VPN address.
- IPv6 Leak: An IPv6 address belonging to your home internet provider appears under WebRTC, even if the primary IPv4 test shows the VPN location.
- No Leak: The STUN reflexive candidate (
Actionable Steps to Disable or Mitigate WebRTC Leaks
Resolving a WebRTC leak requires balancing privacy against the need for in-browser real-time communication tools (such as Google Meet, Discord, or web-based conferencing).
Option 1: Hard Disabling WebRTC in Firefox
Mozilla Firefox remains the most straightforward browser for completely shutting down WebRTC at the engine level without third-party extensions.
- In the address bar, type
about:configand press Enter. - Accept the warning ("Accept the Risk and Continue").
- In the search bar, type
media.peerconnection.enabled. - Double-click the preference (or click the toggle button) to change its value from
truetofalse.
Trade-off: Setting this to false eliminates WebRTC IP leaks completely. However, it will break web-based video calling platforms and browser-to-browser P2P file transfers in Firefox.
Option 2: Restricting WebRTC in Chromium Browsers (Chrome, Edge, Brave)
Chromium-based browsers do not offer a native one-click GUI toggle in standard settings to turn off WebRTC completely. However, you have two effective paths:
A. Configure Brave's Native Setting
If you use Brave:
- Open Settings -> Privacy and security.
- Locate WebRTC IP handling policy.
- Change the dropdown from Default to Disable non-proxied UDP.
B. Enforce Enterprise Policy in Google Chrome / Edge
Google Chrome provides an administrative policy named WebRtcIPHandling. You can deploy this via OS registry/plist or enterprise management:
- Policy Name:
WebRtcIPHandling - Recommended Value:
disable_non_proxied_udp
When set to disable_non_proxied_udp, WebRTC will only use UDP if it can route through an established proxy, or it will fall back to TCP. This prevents ICE candidates from escaping across unproxied physical interfaces.
C. Browser Extensions
If you do not manage enterprise policies, install a vetted open-source extension such as WebRTC Leak Prevent or uBlock Origin.
- In uBlock Origin, open the dashboard, navigate to Settings, and check Prevent WebRTC from leaking local IP address.
- In WebRTC Leak Prevent, set the policy to Disable non-proxied UDP (force proxy).
Option 3: VPN Client and Network-Level Hardening
For users in our 365Finds privacy evaluations who require browser-based conferencing without leaks, the cleanest solution is enforcing full-tunnel encapsulation at the system level:
- Enable the VPN Kill Switch: Ensure your VPN software blocks all non-tunnel traffic if the connection drops.
- Disable IPv6 or Enable VPN IPv6 Leak Protection: If your VPN provider does not support dual-stack tunneling, enable their built-in "IPv6 Leak Protection" toggle (which routes or drops non-VPN IPv6 requests) or manually disable IPv6 in your operating system's network adapter properties.
- Avoid Standalone Browser Extension Proxies: Treat browser extension "VPNs" as light proxies rather than privacy tunnels. Run the dedicated desktop client (WireGuard or OpenVPN) so all system UDP traffic is captured inside the virtual network adapter before reaching the physical wire.