出海数字营销宝典 Logo
出海数字营销宝典evaoo.com
PRV-01·Privacy & Security · PRV-01

WebRTC Leak Principles: How STUN/ICE Bypasses TCP Proxies & Cross-Platform Defense

Without triggering any camera or microphone prompt, silent JavaScript can send UDP STUN requests straight around TCP-only proxies—exposing your true ISP public IP inside ICE candidates.

6 min read·Updated 2026-11-15
Executive Summary (TL;DR)
  • Any webpage running JavaScript can instantiate RTCPeerConnection silently in the background to collect ICE candidates with zero permission dialogs.
  • Leaks happen because STUN defaults to UDP while standard HTTP/HTTPS/SOCKS TCP-only proxies skip UDP traffic, letting packets egress over your local ISP interface.
  • Modern Chrome, Edge, and Safari mask LAN host IPs (192.168.x.x) using random xxxx.local mDNS labels—the critical exposure is your public srflx candidate returned by STUN.
  • The cleanest fix is routing UDP inside a TUN virtual interface, or enforcing disable_non_proxied_udp / browser-level Replace/Forward policies in isolated profiles.

1. What Is WebRTC & Why Scripts Need Zero Permissions to Probe IPs

WebRTC (Web Real-Time Communication) powers browser-native video meetings, voice support widgets, live streaming, and P2P file transfers. To connect peers directly whenever possible, the browser must first inventory every viable network path via ICE candidate gathering.

Because discovering reachable IP addresses is purely a signaling preparation step, any page can create an invisible RTCPeerConnection offer and dispatch lightweight UDP Binding packets to public STUN servers without ever requesting webcam or microphone access.

Why your webpage IP looks right while risk engines still catch your origin

HTTP/HTTPS fetches travel strictly over TCP through your proxy tunnel, so "What is my IP" headers show your exit node. Simultaneously, anti-fraud telemetry triggers UDP STUN probes; if srflx differs from the TCP egress country or ASN, risk engines instantly flag an obfuscated connection.

2. Anatomy of a Leak: ICE Candidate Types & the UDP Bypass Path

During ICE gathering, browsers collect three main candidate categories (plus occasional prflx peer-reflexive candidates). Real public IP leaks almost always center on srflx:

Candidate A · LAN Interface

host (Local NIC / mDNS Obfuscation)

Represents local adapter addresses such as 192.168.1.x or 10.x.x.x. Older browsers printed raw RFC 1918 subnets, revealing office LAN layouts or virtual VPN adapter ranges.

Modern Status:Chrome/Edge/Safari substitute xxxx.local mDNS aliases until media permission is granted
Edge Caveat:Outdated Chromium builds or unmasked WebViews may still leak virtual TUN ranges like 198.18.x.x
Candidate B · Primary Leak Vector

srflx (Server Reflexive · Public NAT Egress)

The browser sends a UDP packet to a STUN server, which echoes back the source IP and port it observed. Whenever UDP bypasses your proxy, STUN reflects your true residential or corporate ISP IP.

Transport Protocol:STUN typically runs over UDP ports 3478 or 19302
Root Cause:HTTP/SOCKS TCP-only proxies never encapsulate UDP sockets unless TUN or UDP Associate is active
Candidate C · Relayed Path

relay (TURN Media Relay Address)

When direct UDP is blocked by corporate firewalls or browser policies restrict ICE to proxied hops, traffic routes via a TURN relay server—exposing only the TURN or proxy exit address.

Best For:Hardened multi-account profiles and strict corporate sandboxes
Trade-off:Negligible overhead for web browsing; adds slight hop latency only to live WebRTC calls
Supplemental · Mid-Handshake

prflx (Peer Reflexive Address)

Dynamic NAT address discovered mid-connectivity-check during direct peer handshakes. Standard fingerprinting tests rely primarily on host and srflx via STUN.

When Triggered:Active data-channel or media handshake with a remote peer
Prevention:Tunneling or blocking non-proxied UDP neutralizes prflx alongside srflx

Interactive Simulator: WebRTC ICE Exposure by Proxy Setup

PRV-01 LAB
host (LAN Candidate)
xxxx.local (mDNS masked)
srflx (Domestic STUN)
Policy exit (Local or Proxy)
srflx (Global STUN)
Clean Proxy Exit IP (Matches TCP)
OPTIMAL: Virtual NIC tunnels UDP STUN cleanly so srflx agrees 100% with your HTTPS proxy exit.
Test My Live WebRTC STUN Candidates

3. Why Diagnostics Split-Test Domestic vs. International STUN Servers

Users running rule-based split-tunneling often hit subtle partial leaks: one STUN endpoint passes while another exposes their real broadband IP because routing tables treat domestic and foreign STUN hostnames differently.

Auditing both regional and global STUN targets exposes whether your proxy actually forwards UDP globally. If an international STUN endpoint still sees your local ISP IP, UDP traffic is bypassing the tunnel altogether—or your proxy server does not support UDP Associate and silently falls back.

Common Cross-Border Pitfall: Proxies Without UDP Associate Support

Many budget static residential proxies provision TCP-only sockets. Even if your local client switches to TUN mode, upstream UDP packets either drop silently or leak if bypass fallback is enabled. Always verify against international STUN endpoints before logging into ad managers or merchant payouts.

4. Hardening Matrix: Choosing the Right Mitigation Without Triggering Anti-Bot Flags

Balance zero IP leakage against looking like a normal everyday browser by selecting the right mitigation tier for your operational setup:

Table: WebRTC Hardening Options & Anti-Fraud Compatibility
Mitigation TierConfiguration MethodObserved Test OutputRisk-Engine Compatibility
TUN Mode / Full UDP Proxy (Preferred)Enable virtual NIC (TUN) and ensure upstream node relays UDP cleanlysrflx reports your clean proxy exit IP matching HTTP trafficOptimal: Full native WebRTC functionality with zero real-IP exposure
Chrome / Edge Proxy-Only PolicySet WebRTCIPHandlingPolicy to disable_non_proxied_udpNo local public IP exposed; restricts ICE to proxied UDP or TURN relayHigh: Ideal when using local HTTP/SOCKS ports without OS-wide TUN
Isolated Profile "Replace/Forward"Enable IP replacement tied to exit IP while retaining mDNS .local host maskingsrflx matches proxy public IP smoothlyHigh: Standard safe posture for Shopify, Meta BM & TikTok operations
Firefox Complete DisablementSet media.peerconnection.enabled = false in about:configZero candidates; WebRTC constructor disabledModerate: Zero leak guarantee, though rare strict anti-fraud SDKs note stripped WebRTC APIs
Post-Switch Audit Rule

Re-run WebRTC + DNS leak diagnostics every time you update your proxy client, switch node providers, or edit split-tunnel rule lists.

WebRTC Leak Troubleshooting FAQ

Do modern browsers still expose 192.168.x.x LAN addresses via WebRTC?

Mostly mitigated. Chrome, Edge, and Safari use random UUID.local mDNS placeholders for host candidates while camera/microphone permissions remain ungranted. However, once a site receives media permission, real local IPs can appear, and public srflx candidates are never hidden by mDNS.

Is completely disabling WebRTC safer than spoofing or proxying it?

For personal anonymity, yes—disabling eliminates any chance of a UDP leak. For high-trust commerce, Stripe, or ad accounts, nearly all organic browsers have WebRTC enabled; disabling the API completely can look anomalous to advanced anti-fraud heuristics compared to proxying UDP cleanly through TUN.

Why does WebRTC show empty srflx results on my static SOCKS5 proxy?

Your static SOCKS5 vendor likely supports TCP only without UDP forwarding, causing STUN packets routed through the proxy to time out. Ensure your browser blocks non-proxied UDP fallback so timeouts do not leak to your physical interface.

Can mobile devices (iOS / Android) also suffer WebRTC leaks?

iOS packet-tunnel apps route system-wide sockets reliably unless STUN ports are bypassed manually, whereas some Android per-app proxies or older in-app WebViews may still allow cellular/Wi-Fi UDP directly. Always test the exact browser profile on mobile too.

Verify Your Live WebRTC & STUN Posture Zero-Log

Run instant multi-STUN leak verification and check whether your current proxy exit matches across TCP and UDP.

Privacy & Security Series

Back to Privacy & Security Hub