The Core Idea & Traffic Flow

WebRTC is best known for browser audio and video, using ICE and SDP signaling to set up encrypted UDP connections between peers. Its DataChannel feature also provides a general-purpose, DTLS-encrypted bidirectional message pipe over SCTP/UDP.

The Tor Project's Snowflake transport uses WebRTC DataChannels to route censored traffic through volunteer browser proxies. The client talks to a volunteer peer over WebRTC, and that peer resolves and fetches the destination on the client's behalf.

To see what enterprise security tools actually catch when this runs, I built a small, strictly bounded Go lab with four parts (cmd/broker, cmd/relay, cmd/webclient / cmd/browserui, and cmd/target).

Here is the traffic flow and what each side sees:

+---------------------------------------------------+       +---------------------------------------------------+
| MONITORED CLIENT ZONE (Device B)                  |       | REMOTE PROXY ZONE (Device A)                      |
|                                                   |       |                                                   |
|  [ Local DNS Filter (NextDNS Agent) ]             |       |  [ Upstream DNS Resolver ]                        |
|    * Blocks target.example                        |       |    * Resolves target.example (Seen here only)     |
|    * Sees ZERO queries for target.example         |       |                     ^                             |
|                                                   |       |                     | 3. DNS Lookup               |
|  [ Browser UI (:7777) / CLI WebClient ]           |       |  [ Go Proxy Server (cmd/relay) ]                  |
|    |                                    \         |       |    * Restricted to single -TargetUrl              |
|    | 1. HTTP SDP Offer                   \        |       |    * Only GET/POST allowed                        |
|    v                                      \       |       |                     |                             |
|  [ Firewall / Endpoint EDR ]               \      |       |                     | 4. HTTPS Fetch              |
|    * Sees HTTP signaling (:8080)            \     |       |                     v                             |
|    * Sees UDP/DTLS flow (:40000)             +====|=======|==> [ Encrypted WebRTC DataChannel (SCTP/DTLS) ]   |
|    * Sees unsigned Go binary opening UDP          |  2.   |                     |                             |
+---------------------------------------------------+       |                     v                             |
                         |                                  |  [ Controlled Target HTTP Server (cmd/target) ]   |
                         +--- 1. SDP Offer/Answer --------->|  [ Signaling Broker (cmd/broker :8080) ]          |
                              (No payload relayed)          +---------------------------------------------------+

Lab Architecture & Safety Bounds

  • Broker (cmd/broker): A simple HTTP server that swaps SDP offer/answer messages so peers can find each other. It never relays payload data.
  • Proxy (cmd/relay): Connects to the broker, opens a WebRTC DataChannel with the client, and forwards GET/POST requests only to the single -TargetUrl set at startup. It is not an open proxy and has no persistence or evasion tricks.
  • Client (cmd/webclient / cmd/browserui): Either a CLI tool or a localhost viewer (127.0.0.1:7777) that opens the DataChannel and renders sanitized HTML (stripping scripts, forms, and external assets).
  • Target (cmd/target): A controlled HTTP server that logs requester IPs to prove requests come from the proxy host instead of the client.

Empirical Tests: NextDNS & Off-LAN NAT Traversal

Test 1: Client-Side DNS Filter (NextDNS)

  • Setup: Device B ran NextDNS with the target domain blocked. Device A ran the broker and proxy. Device B opened the target through browserui at http://127.0.0.1:7777.
  • Result: Direct browsing on Device B was blocked by NextDNS, while the WebRTC viewer loaded cleanly (HTTP 200). Device B's NextDNS logs showed zero queries for the blocked domain; Device A resolved it and showed up as the requester in the target's logs.
  • What's still visible: Bypassing DNS filtering doesn't hide the traffic. Device B's firewall and network monitors still see HTTP signaling to the broker, STUN lookups, and the encrypted UDP stream to Device A.

Test 2: Remote Router WebRTC (Off-LAN NAT)

  • Setup: Device A sat behind a home NAT router forwarding TCP 8080 (signaling) and UDP 40000 (ICE). Device B connected from an external network.
  • Result: Without -AdvertiseIP, Device B's firewall logged outbound UDP 40000 probes to RFC 1918 private IPs (192.168.x.x, 172.16.x.x) because the proxy advertised its local NICs in SDP. Adding -IcePortMin 40000 -IcePortMax 40000 -AdvertiseIP <public_ip> pinned the public candidate and brought the off-LAN DataChannel right up.

Why Endpoint & Network Defenders Can Still Catch This

Even when a client-side DNS filter never sees the domain, a standalone WebRTC proxy still stands out (more in DETECTION_NOTES.md):

  • WebRTC outside a browser: In corporate environments, WebRTC UDP/DTLS sockets almost always come from signed browsers or meeting apps (Teams, Zoom). An unsigned Go binary opening STUN/DTLS sockets is an obvious EDR anomaly.
  • Signaling & UDP blocking: Blocking unapproved outbound UDP and restricting STUN/signaling endpoints stops direct peer-to-peer setup—forcing fallback to TURN/TURNS relays, which we test against Zeek, Suricata, and TLS inspection in Part 2 and Part 3.

Running the Lab Yourself

Run only in owned or explicitly authorized lab environments:

# Linux local smoke test (all components on one host)
python3 scripts/run_lab.py proxy-local --session proxy-local --no-stun
# Windows local smoke test
.\scripts\run-lab.ps1 -Role proxy-local -Session proxy-local -NoStun

# Off-LAN split test (with TCP 8080 and UDP 40000 forwarded on the proxy router)
.\scripts\run-lab.ps1 -Role proxy -BrokerUrl http://127.0.0.1:8080 `
  -Session split-test -TargetUrl https://your-owned-target.example `
  -IcePortMin 40000 -IcePortMax 40000 -AdvertiseIP YOUR_PUBLIC_IP

Repository: View the snowflake-inspired-webrtc-proxy-lab on GitHub