WebRTC `tcp_only` / `auto` leaks the host's real IP
Versions: Python SDK shardx 2.1.2, Windows Server, SOCKS5 proxy UDP.
Also reproduced in the desktop launcher with WebRTC = auto.
Summary
With webrtc="tcp_only" (which auto switches to when the proxy has no UDP), a page can read the
machine's real public interface IP, bypassing the proxy. srflx/relay candidates are correctly
replaced with the proxy IP and host candidates are hidden behind xxxx.local mDNS names, so
common leak tests (browserleaks etc.) look clean. But a page can make the browser resolve its own
mDNS name by connecting the peer connection to itself, and then read the resolved address from
getStats().
This exact technique is used in production by anti-fraud scripts (e.g. Forter, field ice-pi), so
every profile on the same host shows the same datacenter IP next to the proxy IP.
Steps to reproduce
-
Launch a temporary profile with a proxy and
webrtc="tcp_only"(orautoon a proxy UDP). -
Run in any page (e.g.
about:blank):(async () => { const pc = new RTCPeerConnection({}); const done = new Promise(r => { pc.onicecandidate = e => { if (!e.candidate) r(); }; setTimeout(r, 4000); }); pc.createDataChannel(''); await pc.setLocalDescription(await pc.createOffer()); await done; const sdp = pc.localDescription.sdp .replace(/a=setup:(.*?)\s{1,2}/, 'a=setup:active\r\n') .replace(/(\.local)/g, '$1.'); // "xxxx.local" -> "xxxx.local." (FQDN) await pc.setRemoteDescription({ sdp, type: 'answer' }); await new Promise(r => setTimeout(r, 1500)); const out = []; (await pc.getStats()).forEach(s => { if (s.type === 'remote-candidate') out.push([s.address, s.candidateType, s.protocol]); }); pc.close(); return out; })()
Expected
remote-candidate is empty or contains only the proxy IP / an unresolved mDNS name.
Actual
[["<host public IP>", "host", "udp"]]: the real IP of the machine's network interface.
It does not depend on the proxy (tested with several providers and countries, residential and static).
Test matrix (SDK 2.1.2)
| Mode | Result |
|---|---|
tcp_only |
leak |
auto (proxy UDP → tcp_only) |
leak |
launcher, WebRTC auto |
leak |
block |
clean (no candidates) |
Suggested fix
In tcp_only / auto, the host candidate's mDNS name should not resolve to the real interface address
when it comes back in a remote description (with or without the trailing dot), and getStats()
remote-candidate.address should never expose a non-proxy IP. For example, resolve it to the configured
webrtc_public_ip, or drop such candidates.
in v2.1.3