← Glossary

What Is a WebRTC Leak?

Learn what a WebRTC leak is, how ICE candidate gathering and STUN requests can reveal real IP addresses, the role of host and server-reflexive candidates, and the privacy implications defined in WebRTC standards.

Updated:

A WebRTC leak happens when a browser’s Web Real-Time Communication (WebRTC) execution exposes the network addresses, usually a public IP address or a local network address, to a certain web page through the ICE candidate gathering process. This can happen even when the user expects those addresses to stay behind the VPN, proxy, or other routine configuration.

WebRTC is made for individual audio, video, and data exchange happening directly in the browser. In order to build a connection, the browser should discover possible network paths. The process that performs this discovery can make certain addresses visible to JavaScript running on any web page that creates an RTCPeerConnection.

This behavior is called by the WebRTC specifications and related IETF documents, including RFC 8828 (WebRTC IP Address Handling Requirements) and the ICE framework in RFC 8445.

How WebRTC Discovers Network Addresses

WebRTC relies on Interactive Connectivity Establishment (ICE) to find usable network paths between the two endpoints. When a page creates an RTCPeerConnection, the browser’s ICE agent starts collecting the candidates. Each candidate is a potential transport address (IP address and port) at which the local peer can be reached.

Focal candidates are as follows:

  • Host candidates — Addresses belonging to the device’s own network interfaces. These are often private (RFC 1918) addresses such as those on a local LAN.
  • Server-reflexive (srflx) candidates — Public addresses learned by sending a request to a STUN server. The STUN server returns the source address from which it received the request.
  • Relay candidates — Addresses on a TURN server that can forward traffic when direct paths fail.

STUN itself is specified in RFC 8489. A STUN Binding request is typically sent over UDP. The response contains the observed source address, which becomes the server-reflexive candidate.

Why a WebRTC Leak Happens

Ordinary browser HTTP and HTTPS traffic usually follows the routing configuration that’s set by a VPN client, system proxy, or browser proxy settings. WebRTC’s ICE agent, however, can open its own network sockets and perform STUN queries just outside those constraints in certain configurations.

Some of the common situations that produce a leak include:

  • A VPN that does not capture all UDP traffic or that uses split tunneling, allowing STUN packets to leave through the physical network interface.
  • A browser-level or application-level proxy that handles TCP web traffic but does not intercept the UDP sockets used by WebRTC.
  • Multiple network interfaces present on the device, so the ICE agent discovers both the intended tunnel address and the underlying ISP address.

Whenever a server-reflexive candidate contains the ISP-assigned public IP instead of the VPN or proxy exit address, the page learns about the real public address. Local host candidates can also reveal internal network topology, although modern browsers have replaced these with the temporary mDNS names that end in .local to reduce exposure.

RFC 8828 explicitly discusses these cases, noting that split-tunnel VPNs and certain proxy setups can allow WebRTC to discover addresses beyond those used for ordinary HTTP traffic.

What Information Can Be Exposed

A WebRTC leak can surface several kinds of addressing data:

  • Public IP address seen by the STUN server along the actual route of the STUN request.
  • Private/local IP addresses related to the local interfaces (unless they are hidden through mDNS).
  • In the case of multi-homing or dual-stack, other IPv4 or IPv6 addresses apart from those used in the usual web requests.

The public address is the most important from a location or identity association point of view. The local address gives network topological information and can be used as a fingerprinting mechanism, but it is not globally routable.

It is crucial to be able to differentiate between candidate types. The relay candidate refers to the TURN server and does not refer to the user's actual address. The mDNS .local is a deliberate attempt at obfuscation of the host candidate.

Relationship to Proxies and VPNs

However, WebRTC leakage is most often associated with proxies and Virtual Private Networks because these solutions are designed to provide a single address through which traffic exits. If WebRTC traffic travels on another path, then there is more than one exit address.

The full tunneling VPN that properly routes all traffic, including UDP packets, will ensure that the STUN queries exit the tunnel and thus the server-reflexive address will be the address of the tunnel. However, certain configurations can lead to a mismatch of addresses.

Browser proxy settings are usually applicable to the HTTP(S) and WebSocket traffic. They don’t automatically govern the native UDP sockets used by the ICE agents unless the browser or operating system provides additional controls.

The WebRTC specification and RFC 8828 define modes of IP address handling that trade media quality for reduced address exposure. Applications can also request relay-only candidates (iceTransportPolicy: "relay") so that only TURN addresses are used.

Browser Mitigations and Standards Guidance

Browser vendors have implemented multiple measures such as:

  • Replacements of locally hosted candidates with mDNS candidates that have been randomly created in such a way that no private IP addresses can be sent to the page.
  • Configurable IP handling options that help restrict the interfaces and types of addresses collected by the ICE agent.
  • RFC 8828-compliant modes of operation, from fully exhaustive mode to more restrictive default-route and proxy modes.

Such measures reduce, but don’t always terminate, the exposure of the public addresses when STUN traffic leaves outside the intended tunnel. The standards themselves know the tension between optimal individual connectivity and address privacy.

Limitations of the Concept

A WebRTC leak isn’t a vulnerability in the cryptographic sense; it’s a consequence of the address-discovery process needed for connectivity. The browser is reporting the addresses its network stack can use.

However, not all the addresses shown in the list are considered a privacy breach. Local addresses within the mDNS network, TURN relay addresses, and public addresses that correspond to the correct target VPN or proxy exit point are legitimate occurrences.

The detection process relies on comparing the addresses found through the ICE procedure with those revealed during the standard HTTPS connection. The occurrence of a discrepancy does not necessarily indicate the media will be delivered through this route but rather reveals the availability of the address.

Frequently asked questions

Is a WebRTC leak the same as a DNS leak?

No. A DNS leak occurs when domain-name resolution queries leave through an unintended resolver. A WebRTC leak concerns IP addresses discovered through ICE candidate gathering and STUN.

Does disabling WebRTC completely prevent the leak?

Disabling WebRTC prevents the browser from gathering and exposing candidates through the WebRTC APIs. It also disables legitimate WebRTC applications such as browser-based video calls.

Can a website learn my IP through WebRTC without my permission?

A page can initiate ICE gathering and read the resulting candidates without requesting camera or microphone access. Modern browsers apply address-handling policies and mDNS obfuscation, but public server-reflexive addresses can still become visible under some network configurations.

Do all VPNs prevent WebRTC leaks?

No. Only configurations that consistently route the UDP traffic used by STUN and ICE through the VPN tunnel will cause the server-reflexive candidate to reflect the VPN’s address. Split-tunnel or incomplete implementations may still allow exposure of the underlying public address.

What is the difference between a host candidate and a server-reflexive candidate?

A host candidate is an address belonging to a local network interface. A server-reflexive candidate is the public address observed by a STUN server when it receives a Binding request from the browser.