Tor's design document says it plainly: Tor does not defend against an adversary who can observe both ends of a connection. That limitation has been there since 2004 and it isn't a bug that will be patched. It follows from wanting low latency. If packets go in one end and come out the other within half a second, someone watching both ends can line up the timing.

That's a correlation attack, sometimes called an end-to-end confirmation attack. The rest of this page is about how practical it is, who can pull it off, and what Tor does about the parts it can do something about.

How the matching works

Picture the observer's view. On the entry side they see a TLS connection from your IP to a Tor guard: a sequence of 514-byte cells with timestamps, bursting when you load a page and going quiet when you read it. On the exit side they see a connection from a Tor exit to some website, with its own bursts and pauses. The content is different (encrypted on one side, plain HTTPS on the other) but the pattern of activity is the same, shifted by the circuit latency.

Matching those two patterns is not hard statistics. Simple correlation over packet counts in time windows works surprisingly well when the flows are long. Machine learning made it work on shorter flows: the DeepCorr paper (Nasr, Bahramali and Houmansadr, 2018) trained a neural network on flow pairs and reported high accuracy with only a few hundred packets per flow, far better than earlier statistical methods. Later papers have pushed this further, including approaches that match whole sessions made of many flows.

An active attacker has it easier still. If they can delay or drop packets on one side, they can stamp a pattern into the traffic and look for it on the other side. Tor's protocol makes active tagging inside cells hard to do silently, but timing manipulation at the network level is another matter.

Who can actually see both ends

This is where the threat model matters more than the maths. For an attacker to correlate your traffic, they need to observe:

  • Your link to your guard (by being your ISP, your guard, the guard's ISP, or an internet exchange or backbone network in between), and
  • The exit's link to the destination, or the destination itself.

Some cases are easy. If you use Tor to visit a site run by the same organisation that's your ISP, or a site hosted in a country whose government can tap your national networks, both ends may already be visible to one party. A corporate network admin watching both your workstation and the company's web server has the same position.

Running relays is another way in. An adversary who runs a large share of guard and exit capacity sees both ends of some fraction of circuits directly. The 2013 paper "Users Get Routed" (Johnson and colleagues, CCS 2013) modelled this and found that over months of use, a well-resourced relay adversary had a good chance of compromising at least one circuit for a typical user. Guard design changes since then, especially moving to a single long-lived guard, were partly a response to that work. See guard relays for that reasoning.

Then there's routing. The RAPTOR paper (Sun and colleagues, 2015) showed that internet routing is asymmetric and dynamic, so the set of autonomous systems that can see some part of your traffic is bigger than a naive model suggests, and that BGP hijacks could be used to steer traffic towards an observer. Large network operators and the intelligence agencies that work with them are the realistic threat here. The Snowden documents suggested the NSA found Tor users hard to deanonymise in bulk at the time, but nobody sensible reads that as a guarantee about what's possible now. There's more on that in Snowden, "Tor Stinks" and the NSA.

A real case

In September 2024, German public broadcasters reported that police had used timing analysis to identify a user of the Ricochet chat client connected to a child abuse site. The method, as described, involved watching relays over a long period to find the guard used by the target's onion service client, then getting the guard's ISP to identify the connecting IP. The Tor Project responded publicly, noting that the person had used an old version of Ricochet that lacked protections like vanguards-lite, which Tor had since added to make exactly this kind of guard discovery harder.

The details that reached the public were limited. Still, it's a good illustration of how these attacks look in practice: long-running, targeted, combining relay observation with legal requests, not a magic button that unmasks everyone.

What Tor does about it

Tor can't fully defeat a global passive observer without becoming a high-latency mixnet that would be useless for browsing. What it does is make the attacker's job more expensive.

Long-lived guards reduce how often a new party gets to see your entry side. Path rules stop two relays from the same family or /16 being used in one circuit. Bandwidth measurement makes it costly to attract traffic with fake capacity. Monitoring by the bad-relays team catches some groups of suspicious relays, as described in Sybil attacks and malicious relays.

Padding helps at the edges. Connection padding between clients and guards breaks up the long idle and active periods that show up in netflow records, which many ISPs keep in bulk. That specifically targets the cheap version of the attack where someone reads historical flow logs instead of capturing packets. The circuit padding framework could support stronger defences, but heavy padding costs bandwidth that the volunteer network doesn't have to spare.

For onion services, vanguards restrict the second and third hops to a slowly rotating set, which makes the guard discovery stage (the first step of most practical onion service deanonymisation) much slower. Recent Tor versions include vanguards-lite by default; high-risk services can run the fuller version.

What you can do

Not a lot at the protocol level, and anyone selling a product that "stops correlation" should be treated with suspicion. Practical steps are about not making yourself easy:

Keep Tor and anything built on it up to date, because the defences above only help if you're running them. Avoid situations where the same organisation controls your network and your destination. Don't keep one very long-running, distinctive connection open for hours; long flows correlate more easily than short ones. And don't rely on Tor alone if your threat model includes a national intelligence agency actively targeting you. At that level the bigger risks are usually endpoint compromise and mistakes, and correlation is the backstop they use to confirm a suspicion they already have.

#correlation-attack #traffic-analysis #tor-security #anonymity