How Tor Prevents Sybil Attacks
A Sybil attack occurs when an adversary creates a large number of pseudonymous identities to gain disproportionate control over a decentralized network. In the Tor network, a massive Sybil attack could allow an attacker to control both the entry (Guard) and exit relays of a circuit, effectively deanonymizing user traffic. To defend against this threat, Tor relies on a trusted group of Directory Authorities (DirAuths) that manage relay admission, validate relay capabilities, and reach a cryptographic consensus every hour to neutralize attempts at mass infiltration.
1. Consensus Voting and Relay Flags
The Tor network is governed by a small, geographically distributed set of Directory Authorities operated by independent, trusted individuals. Every hour, these authorities independently evaluate the state of the network and produce a signed document known as the consensus.
For a newly created relay to participate in the network, authorities
must vote to assign it specific status flags, primarily
Valid and Running. Without these flags,
clients will not select the relay for circuits. Because individual
authorities independently probe and verify relays, an attacker cannot
simply register thousands of fake nodes simultaneously and have them
instantly routed into user circuits.
2. Earning Guard and Exit Status
The most dangerous Sybil attacks require controlling both the entry
and exit points of a Tor circuit. Directory authorities enforce strict
performance and stability requirements before granting relays the
critical Guard and Exit flags:
- Guard Flag Requirements: A relay must maintain high uptime, prove continuous reliability over days or weeks, and demonstrate significant bandwidth. This delay prevents an attacker from rapidly spinning up thousands of temporary nodes to capture traffic.
- Exit Flag Restrictions: Exit relays must explicitly publish exit policies permitting outbound traffic to the public internet, exposing malicious infrastructure to abuse complaints and external scrutiny.
3. IP Subnet and Family Grouping
To prevent an entity from launching thousands of relays from a single cloud provider or IP block, Tor enforces network diversity rules:
- Subnet Restrictions: Clients and authorities treat
all relays in the same
/16IPv4 prefix (or/32IPv6 prefix) as a single entity. Clients will never choose two relays from the same subnet in a single circuit. - MyFamily Configuration: Relays operated by the same
administrator must declare each other in their
MyFamilyconfiguration. Authorities and clients use this information to ensure that relays belonging to the same operator are never placed in the same path.
4. Active Bandwidth Measurement
In early versions of Tor, relays self-reported their available bandwidth, creating a vulnerability where an attacker could advertise massive capacity to attract traffic without spending real resources. Today, directory authorities utilize dedicated bandwidth measurement scanners (such as sbws).
These scanners continuously measure the actual throughput of relays from the outside. Authorities assign relay weights based on measured capacity rather than self-reported claims, forcing attackers to invest genuine, sustained bandwidth to attract significant amounts of network traffic.
5. Automated Heuristics and Manual Vetting
Tor Directory Authority operators and the Tor Network Health Team actively monitor the network for anomalies. They utilize heuristic analysis tools to detect suspicious registration patterns, including:
- Hundreds of new relays appearing within the same short timeframe.
- Clusters of relays sharing identical cryptographic key parameters, operating system versions, or contact information.
- Sudden mass configuration changes across seemingly unrelated relays.
When coordinated Sybil clusters are detected, directory authority
operators can quickly reject or blacklist the offending relays by adding
them to bad-relay lists (BadExit or outright exclusion from
the consensus), neutralizing the attack before it can compromise user
privacy.