How Tor Prevents Nodes From Knowing the Full Path
The Tor network prevents any single node from knowing the complete transmission path through a mechanism called onion routing. By wrapping data in multiple layers of encryption and establishing a multi-hop circuit, each intermediary node only possesses the cryptographic keys needed to identify its immediate predecessor and successor. As a result, no single relay on the network can link the original sender to the final destination.
Layered Encryption
When a user initiates a connection through Tor, the local Tor client selects a path typically consisting of three nodes: the Guard (Entry) node, the Middle relay, and the Exit node. The client negotiates a separate, unique encryption key with each node using the Diffie-Hellman key exchange protocol.
The client then encrypts the payload in reverse order: 1. It encrypts the data with the Exit node’s key. 2. It encrypts that result with the Middle node’s key. 3. It encrypts that entire bundle with the Guard node’s key.
This layered structure resembles an onion, giving the routing method its name.
Step-by-Step Circuit Traversal
As the data packet travels through the circuit, each node peels away exactly one layer of encryption:
- The Guard Node: Receives the encrypted package directly from the user. It uses its symmetric key to decrypt the outermost layer. This reveals instructions directing the packet to the Middle node. The Guard node knows the user’s real IP address, but it cannot see the final destination or the underlying payload.
- The Middle Node: Receives the packet from the Guard node and decrypts the next layer using its own key. This layer only reveals the address of the Exit node. The Middle node does not know the identity of the original sender or the destination server.
- The Exit Node: Receives the packet from the Middle node and strips away the final layer of encryption. It reads the address of the destination server and forwards the unencrypted (or end-to-end encrypted) request to the public internet. The Exit node sees the destination and the content (if not using HTTPS), but it only knows the IP address of the Middle node, not the original sender.
Circuit Isolation and Ephemeral Keys
Tor builds these circuits incrementally so that downstream nodes never interact directly with the client during key negotiation. The client tunnels handshake requests through already established links in the chain. Furthermore, circuits are temporary and typically rebuild every ten minutes, preventing long-term traffic analysis from associating different requests with the same user.
Through this design, an adversary would need to control or monitor all nodes in a specific circuit simultaneously to reconstruct the complete path.