Skip to content
Documentation Background

Anonymity, proxies, and onion routing

Privacy on a network has three separate goals, and people often assume one tool delivers all three.

  1. Hide who you are from the site you visit (your IP address).
  2. Hide where you are going from your local network or provider.
  3. Hide what you send from anyone on the path.

HTTPS encrypts the request and the response, so goal 3 is met. It does nothing for the first two:

  • The destination site sees your source IP address on every packet.
  • Your local network and provider see the destination IP address in each packet header, and usually the site name too, from DNS lookups and the TLS server name indication. The page content is hidden, but the fact that you contacted the site is not.
Terminal window
# What a network observer can see even for HTTPS traffic
sudo tcpdump -ni eth0 'port 443 or port 53'
# DNS query for app.example.com, then TCP to 203.0.113.10:443

Encrypted DNS and encrypted client hello reduce some of that leakage. The destination IP address still shows.


Route your traffic through one intermediary and the picture changes.

  1. The client opens an encrypted tunnel to the proxy.
  2. The proxy forwards the request to the site and returns the response through the tunnel.
GoalResult
Hide who you are from the siteMet. The site sees the proxy’s address
Hide where you are going from the local networkMet. It sees only a tunnel to the proxy
Hide content from the local networkMet
Hide anything from the proxyNot met. It sees your address, the destination, and (without end-to-end TLS) the content

This is the model behind commercial VPN services and corporate proxies. It does not remove trust, it relocates it, from your network provider to the operator of the proxy. If that operator logs, is compelled to disclose, or is compromised, there is nothing else between you and the site. For privacy from a local network (public Wi-Fi, a hotel) it is useful. For anonymity from a determined adversary it is weak.

Terminal window
# Route a single request through a SOCKS proxy; resolve the hostname at the proxy
curl --socks5-hostname proxy.example.net:1080 https://app.example.com/

The --socks5-hostname form matters. It sends the hostname to the proxy for resolution, instead of leaking a DNS lookup from your own machine.


To remove the single point of trust, send traffic through a chain of several relays so that no relay knows both ends. Tor is the best-known system, using three relays chosen at random from a public pool.

The client builds layered encryption, one layer for each relay in the circuit, like the skins of an onion:

  1. The client picks an entry relay, a middle relay, and an exit relay, and negotiates a separate key with each.
  2. To send a request, it encrypts the message to the exit relay’s key, then wraps that in encryption to the middle relay’s key, then wraps that to the entry relay’s key.
  3. The entry relay removes its layer and sees only the next hop, the middle relay. It knows your address but not the destination.
  4. The middle relay removes its layer and learns only the next hop, the exit. It knows neither end.
  5. The exit relay removes the last layer and sends the request to the destination. It knows the destination and the content (unless TLS is used end to end), but not who you are.
flowchart LR
    C["Client"] -->|"3 layers"| E["Entry relay<br/>knows the client"]
    E -->|"2 layers"| M["Middle relay<br/>knows neither end"]
    M -->|"1 layer"| X["Exit relay<br/>knows the destination"]
    X -->|"plain or TLS"| S["Destination"]

As long as the relays do not collude, nobody sees both who you are and where you are going. The responses return along the same circuit, each relay adding its layer.

  • Performance. Three hops of added latency and volunteer-run bandwidth. Expect slower connections.
  • The exit sees traffic. Without TLS to the destination, the exit relay can read and alter it. Use HTTPS.
  • Traffic correlation. An observer who can watch both the entry and the exit can match patterns of timing and volume, even with encryption. Onion routing protects against casual observers and single relays, not against a global one.
  • Application leaks. Browsers and apps can reveal identity through cookies, fingerprints, WebRTC, or logins. The tooling around the network matters as much as the network.
  • Blocking. Public relay lists are known, and some networks and services block them. Bridges and obfuscated transports exist for that.
  • Services need to allow it. Many sites treat exit traffic as risky.

Related: Network hardening covers proxies as a defensive control, and Zero trust architecture covers identity-aware access instead of network position.