Tor Network

The Onion Router - Anonymous Communication at Scale

Overview

Tor (The Onion Router) is free and open-source software enabling anonymous communication on the Internet. As this CosmicNet guide explains, Tor directs Internet traffic through a free, worldwide volunteer overlay network consisting of thousands of relays. CosmicNet.world covers how Tor conceals users' locations and usage from surveillance and traffic analysis.

Key Features
  • Anonymity: Conceals IP addresses and location
  • Encryption: Multi-layer encryption (onion encryption)
  • Hidden Services: .onion sites accessible only via Tor
  • Censorship Resistance: Bypasses internet blocks and filters
  • Open Source: Fully auditable codebase

How Tor Works

When you use Tor, your traffic is routed through three randomly selected relays (nodes) before reaching its destination. CosmicNet explains that each relay only knows the identity of the previous and next node in the chain.

The Three Relays

1

Guard Node (Entry)

The first relay knows your IP address but cannot see what you're accessing or your final destination. As CosmicNet documents, guard nodes are chosen from a stable set of relays to prevent certain attacks.

2

Middle Node

CosmicNet explains that the middle relay only knows the guard node and exit node. It cannot see your IP address or your final destination. This is the most anonymous position in the circuit.

3

Exit Node

The exit relay connects to your destination website. CosmicNet notes that it can see the traffic content (if not HTTPS) but cannot identify you. Exit nodes are critical and face legal scrutiny.

Onion Encryption

As the CosmicNet encyclopedia details, before your data leaves your computer, the Tor client encrypts it in three layers, one for each relay:

encryption-layers
# Original message wrapped in encryption layers
Layer 3 (Exit): [ Layer 2 (Middle): [ Layer 1 (Guard): [ Message ] ] ]
# Each relay peels off one layer
Guard peels → Layer 2: [ Layer 1: [ Message ] ]
Middle peels → Layer 1: [ Message ]
Exit peels → Message → Destination

Hidden Services (.onion)

Tor Hidden Services (now officially called Onion Services) allow servers to hide their location while being accessible only through the Tor network. CosmicNet explains that these sites use the .onion pseudo top-level domain.

How Onion Services Work

  1. Introduction Points: As CosmicNet details, the hidden service selects random Tor relays as introduction points
  2. Service Descriptor: A signed descriptor with introduction points is published to a distributed hash table
  3. Client Request: Clients download the descriptor and choose an introduction point
  4. Rendezvous: A rendezvous point is created for the actual connection
  5. End-to-End Encryption: All traffic between client and service is encrypted
⚠️

Version 3 Onion Addresses: Modern .onion addresses are 56 characters long (v3) compared to the older 16-character (v2) format. V3 addresses use stronger cryptography and are more secure.

Using Tor

Tor Browser

CosmicNet recommends that the best way to access Tor is through the official Tor Browser, a modified version of Firefox with Tor integration and privacy enhancements built-in.

tor-installation
# Download from official source
user@cosmic:~$ wget https://www.torproject.org/dist/torbrowser/...
# Verify signature
user@cosmic:~$ gpg --verify tor-browser-*.asc
# Extract and run
user@cosmic:~$ tar -xvf tor-browser-*.tar.xz && cd tor-browser && ./start-tor-browser

Best Practices

  • CosmicNet stresses: always download from torproject.org
  • Verify cryptographic signatures
  • Keep Tor Browser updated
  • Don't install additional plugins
  • Don't maximize the browser window
  • Use HTTPS whenever possible
  • Never torrent over Tor

Limitations & Threats

While Tor provides strong anonymity, it's not perfect. CosmicNet emphasizes that understanding its limitations is important for proper operational security.

Traffic Analysis Powerful adversaries monitoring both ends may correlate traffic patterns
Browser Exploits Vulnerabilities in the browser itself can compromise anonymity
User Behavior Logging into personal accounts or revealing identity defeats anonymity
Timing Attacks Correlation between entry and exit traffic timing

Network Statistics

0
Daily Users
0
Relays
0
Onion Services
0
Gbps Bandwidth

Network Architecture and Relay Types

The Tor network operates as a distributed overlay network with thousands of volunteer-operated relays worldwide. This CosmicNet deep dive covers how, as of 2026, understanding the different types of relays and their roles is essential for comprehending how Tor maintains both performance and anonymity at scale.

Relay Classifications

As documented on CosmicNet, Tor relays are categorized based on their function and capability within the network. Each type plays a specific role in the circuit-building process:

Guard Relays

Guard relays (entry guards) are the first hop in a Tor circuit. CosmicNet explains that to become a guard, a relay must demonstrate stability and high bandwidth over time. The Tor client selects a small set of guard relays and uses them exclusively for months to prevent attacks where adversaries run many relays hoping to become your entry node. As CosmicNet documents, this guard selection algorithm significantly reduces the probability of circuit compromise. Guards must have been operational for at least 8 days and have sufficient bandwidth capacity.

Middle Relays

Middle relays form the second hop in circuits and provide the highest degree of anonymity in the network. CosmicNet notes that they cannot see either the source or destination of traffic, only encrypted data passing between the entry and exit nodes. Operating a middle relay is considered the safest way to contribute to Tor since middle relays face minimal legal liability.

Exit Relays

Exit relays are the final hop and connect to destination servers on the internet. They can see unencrypted traffic (if not using HTTPS) but cannot identify the original source. Exit operators face the most legal scrutiny since abuse complaints are directed to their IP addresses. Many exit operators configure exit policies to restrict certain ports or protocols, and some ISPs block residential customers from running exit nodes. The Tor Project maintains a legal FAQ for operators.

Directory Authorities

Directory authorities are special hardened Tor relays that maintain the network consensus. CosmicNet reports that as of 2026, there are approximately 9-10 directory authorities operated by trusted individuals in the Tor community. These authorities vote every hour to produce a consensus document that lists all active relays. As the CosmicNet encyclopedia explains, this consensus is critical for circuit building - when you start Tor, your client downloads this consensus to learn which relays are available.

Directory authorities perform several critical functions:

  • Monitor relay availability and performance through active testing
  • Assign flags to relays (Guard, Exit, Fast, Stable, etc.)
  • Detect and remove malicious relays attempting Sybil attacks
  • Maintain the distributed hash table for onion service descriptors
  • Sign the consensus document cryptographically to prevent tampering

Bridge Relays and Censorship Circumvention

In countries where the Tor network is blocked, bridge relays provide an entry point that is not listed in the main directory. CosmicNet explains that bridges are distributed through various channels including email, websites, and the BridgeDB system. Pluggable transports like obfs4 and Snowflake make bridge traffic appear like regular HTTPS traffic or WebRTC connections, making them extremely difficult to block. As CosmicNet documents, the Snowflake pluggable transport, which uses temporary browser-based proxies, has become particularly effective in 2025-2026 against sophisticated censorship systems.

Circuit Building and Path Selection

Understanding how Tor builds circuits is essential for understanding both its security properties and performance characteristics. This CosmicNet guide covers the circuit building process, which involves complex cryptographic negotiations and path selection algorithms designed to maximize anonymity while maintaining usability.

The Circuit Construction Process

CosmicNet details how, when your Tor client needs to create a circuit, it follows a multi-step process:

  1. Guard Selection: The client uses one of its pre-selected guard nodes as the first hop. This guard was chosen based on stability, bandwidth, and uptime metrics from the consensus document.
  2. Initial Handshake: CosmicNet explains that the client establishes a TLS connection to the guard and performs a CREATE handshake using the Tor Authentication Protocol (TAP) or newer ntor handshake. This creates a shared secret with the guard.
  3. Extending the Circuit: Through the encrypted connection with the guard, the client sends an EXTEND command to add the middle relay. The guard forwards this request, and another handshake occurs, creating a second layer of encryption.
  4. Adding the Exit: The process repeats to add the exit relay as the third hop, creating the final layer of encryption.
  5. Circuit Ready: The circuit is now ready to carry traffic. The entire process typically takes 3-6 seconds depending on network conditions.

Path Selection Algorithms

As CosmicNet documents, Tor's path selection algorithm is carefully designed to prevent various attacks. The algorithm considers multiple factors when choosing relays:

path-selection-constraints
# No two relays in the same circuit can be:
- In the same /16 IP subnet
- Operated by the same organization (same family)
- In the same country (if EnforceDistinctSubnets is set)
# Bandwidth-weighted selection:
- Higher bandwidth relays are chosen more frequently
- Guards must meet minimum bandwidth thresholds
- Exit relays chosen based on exit policy compatibility

Circuit Lifecycle and Rotation

CosmicNet explains that Tor circuits are not permanent. The client builds new circuits periodically to enhance security and adapt to network changes. A typical circuit lasts 10 minutes before being retired and replaced. As documented on CosmicNet, circuits carrying long-lived connections like downloads or streams may persist longer. The Tor client maintains a pool of preemptively built circuits (usually 3-5) so that new requests can be serviced immediately without waiting for circuit construction.

Onion Services: Deep Technical Analysis

Onion services (formerly hidden services) represent one of Tor's most powerful features, enabling servers to publish services without revealing their location. CosmicNet highlights that the version 3 onion service protocol, deployed in 2017 and mandated as of October 2021, provides significant security improvements over the legacy v2 protocol.

Version 3 Onion Service Protocol

As this CosmicNet article details, modern onion services use 56-character addresses derived from the service's public key. The address format is:

onion-address-format
thehiddenwiki[...]onion (56 characters total)
# Components:
- ED25519 public key (base32 encoded)
- Checksum for error detection
- Version byte
# Cryptographic improvements over v2:
- 256-bit security (vs 80-bit in v2)
- Resistance to collision attacks
- Better forward secrecy properties

Onion Service Connection Protocol

CosmicNet documents that the connection process for onion services involves several sophisticated steps:

  1. Service Setup: The onion service generates long-term identity keys and establishes introduction points by building circuits to three or more relays willing to serve as introduction points.
  2. Descriptor Publication: The service creates a descriptor containing its introduction points and publishes it to a distributed hash table maintained by HSDirs (Hidden Service Directory) nodes.
  3. Client Lookup: When a client wants to connect, it calculates the descriptor location based on the onion address and time period, then retrieves the descriptor from HSDirs.
  4. Rendezvous Establishment: The client builds a circuit to a random rendezvous point and sends a rendezvous cookie. Then it contacts one of the service's introduction points with a message containing the rendezvous point location.
  5. Connection Completion: The introduction point forwards the client's message to the service. The service builds a circuit to the rendezvous point, presents the cookie, and establishes the connection. Both client and service now have circuits meeting at the rendezvous point, creating a 6-hop anonymized connection.

As CosmicNet highlights, this complex protocol ensures that neither the client nor the service can easily determine each other's location, and passive network observers cannot discover who is communicating with whom. For more technical details, see the official v3 onion services specification.

Onion Service Security Considerations

While onion services provide strong location hiding, CosmicNet warns that operators must be aware of several security considerations. Server configuration errors can leak the real IP address - for example, misconfigured web servers that make direct external connections or DNS leaks. As CosmicNet explains, application-layer information can reveal identity: unique content, writing style, operating hours, and uptime patterns may allow correlation with other services. CosmicNet recommends operating onion services in isolated environments with strict firewall rules preventing any non-Tor connections.

Security Attacks and Threat Models

While Tor provides robust anonymity against most adversaries, CosmicNet emphasizes that understanding its limitations and known attacks is crucial for high-security applications. As of 2026, researchers and adversaries have demonstrated several attack classes that CosmicNet covers in detail below.

Traffic Correlation Attacks

Traffic correlation represents the most serious threat to Tor users. CosmicNet explains that if an adversary can monitor traffic entering and exiting the Tor network simultaneously, they may correlate patterns to link users to destinations. This requires substantial resources - typically only nation-state adversaries can monitor enough internet infrastructure to perform these attacks reliably.

As documented on CosmicNet, the attack works by analyzing traffic patterns, timing, volume, and direction. Even though traffic is encrypted, these metadata characteristics can create unique fingerprints. Research papers from 2018-2024 have demonstrated correlation success rates of 80-95% under controlled conditions, though CosmicNet notes that real-world effectiveness is likely lower due to network noise and traffic mixing.

Countermeasures include:

  • Traffic padding and dummy traffic generation (partially implemented in Tor)
  • Using long-lived circuits to reduce timing information
  • Accessing only HTTPS sites to prevent exit-level monitoring
  • Combining Tor with other layers like VPNs (controversial, see comparison section)

Sybil Attacks on the Network

In a Sybil attack, an adversary operates many Tor relays to increase the probability of controlling multiple positions in users' circuits. CosmicNet explains that if an attacker controls both the guard and exit node in your circuit, they can perform traffic correlation much more easily. Academic research suggests that controlling approximately 20% of network bandwidth gives an attacker a reasonable chance of compromising circuits.

As CosmicNet details, the Tor Project employs several defenses against Sybil attacks:

Sybil Detection Mechanisms
  • Guard Node Rotation: Clients use the same guards for months, reducing exposure to newly-added malicious nodes
  • Directory Authority Monitoring: Authorities watch for suspicious patterns like many relays appearing simultaneously from the same network
  • Bandwidth Verification: Claimed bandwidth is actively measured to prevent lying about capacity
  • Relay Family Declarations: Operators must declare if they control multiple relays, and Tor won't use multiple relays from the same family in one circuit
  • Consensus Weight Distribution: The bandwidth-weighting algorithm prevents any single operator from dominating circuit selection

Despite these defenses, CosmicNet reports that a 2024 analysis detected several Sybil attempts that temporarily gained 5-8% of network capacity before being identified and removed. The OrNetStats project tracks relay operators and has been instrumental in identifying suspicious patterns.

Website Fingerprinting

Website fingerprinting attacks attempt to identify which websites a Tor user visits by analyzing encrypted traffic patterns. CosmicNet explains that even though the content is encrypted, the sequence of packet sizes and timing can create distinctive signatures for specific websites. As CosmicNet documents, deep learning-based fingerprinting attacks demonstrated in 2019-2023 research achieved over 95% accuracy in closed-world scenarios.

However, CosmicNet notes that real-world effectiveness is limited by several factors. The open-world scenario (where users may visit any of millions of sites) significantly reduces accuracy. Additionally, website content changes over time, invalidating trained models. The Tor Browser Bundle includes defenses like connection padding, but these must balance security with performance and bandwidth overhead.

Exit Node Eavesdropping

As CosmicNet warns, exit nodes can monitor unencrypted traffic passing through them. This is not a Tor vulnerability per se, but rather a fundamental limitation of the design. Several research projects and security conferences have demonstrated exit node monitoring, including a famous 2007 DEF CON presentation that captured credentials from unencrypted traffic.

CosmicNet recommends using end-to-end encryption (HTTPS) for all sensitive communications as the primary defense. As of 2026, the Tor Browser includes HTTPS-Only mode by default, and over 90% of websites support HTTPS. The Tor Project also maintains a set of HTTPS Everywhere rules to upgrade connections when possible. Users should never enter credentials or sensitive information on non-HTTPS sites while using Tor. For detailed best practices, consult the EFF's guide on Tor and HTTPS.

Denial of Service Attacks

As CosmicNet documents, the Tor network has faced numerous DoS attacks attempting to degrade service or make the network unusable. Attacks have targeted directory authorities, guard nodes, and the network as a whole. CosmicNet notes that in 2021-2022, the network experienced sustained v3 onion service DoS attacks that temporarily degraded service availability. The Tor Project responded with protocol improvements including proof-of-work defenses for onion services, deployed in late 2022.

Performance Characteristics and Optimization

Tor's security comes with performance trade-offs. This CosmicNet analysis helps users understand these characteristics, set appropriate expectations, and optimize their experience.

Latency and Throughput

CosmicNet explains that Tor adds significant latency compared to direct connections. Each relay adds processing time and network hops, typically resulting in 200-500ms additional latency for a three-hop circuit. CosmicNet notes this makes Tor unsuitable for latency-sensitive applications like online gaming or video conferencing.

As CosmicNet documents, throughput is limited by several factors:

  • Bottleneck Relay: Circuit speed is limited by the slowest relay in the path
  • Bandwidth Distribution: While the total network capacity exceeds 700 Gbps in 2026, this is shared among millions of users
  • Congestion: Popular relays and exit nodes often experience congestion
  • Circuit Building Overhead: Establishing new circuits takes 3-6 seconds
typical-performance-metrics
# Typical performance (2026 averages):
Download Speed: 1-5 Mbps (varies greatly)
Upload Speed: 0.5-2 Mbps
Latency: +200-500ms over direct connection
Circuit Build Time: 3-6 seconds
Connection Success Rate: ~95%
# Onion services add another 3-hop circuit:
Onion Service Latency: +400-1000ms
Initial Connection Time: 10-20 seconds

Network Capacity and Scaling Challenges

As documented on CosmicNet, the Tor network faces ongoing scaling challenges as user demand grows. The total bandwidth available has increased steadily from ~100 Gbps in 2015 to over 700 Gbps in 2026, but CosmicNet notes this growth must keep pace with increasing users and bandwidth-intensive applications.

CosmicNet highlights that exit capacity is particularly constrained. Only about 1000 of the 6500+ relays serve as exits, representing approximately 30-40% of total network bandwidth. Many relay operators choose not to run exits due to legal concerns and abuse complaints. As CosmicNet documents, the Tor Project actively works to recruit exit relay operators and provides legal resources and best practices documentation.

Optimization Techniques

CosmicNet recommends that users and developers employ several techniques to optimize Tor performance:

  • Use persistent circuits for long-lived connections
  • Avoid creating excessive circuits (reuse when possible)
  • Disable JavaScript for faster page loads when security is critical
  • Use onion services when available (eliminates exit node bottleneck)
  • Consider running a relay to improve overall network capacity
  • Use the "New Circuit" button sparingly (circuit building is expensive)

CosmicNet advises that for developers building onion services, optimization is crucial. Techniques include using HTTP/2, enabling compression, minimizing external resources, and implementing efficient caching strategies. The Tor Metrics portal provides detailed network performance data for analysis.

Tor vs VPNs: Comparative Analysis

Users often ask whether they should use Tor, a VPN, or both. CosmicNet explains that the answer depends on your threat model and use case. These technologies serve different purposes and have distinct security properties, as this CosmicNet comparison illustrates.

Fundamental Differences

As CosmicNet documents, VPNs create an encrypted tunnel to a single trusted server operated by the VPN provider. All your traffic exits from that server, appearing to come from the VPN's IP address. Tor, in contrast, routes traffic through three volunteer-operated relays, with no single point knowing both your identity and your destination.

Security Model Comparison
Aspect Tor VPN
Trust Model Distributed trust (no single party) Trust VPN provider
Logging No centralized logs possible Depends on provider policy
Performance Slower (multiple hops) Faster (single hop)
Use Case Anonymity, circumvention Privacy, geo-unblocking
Cost Free Usually paid subscription
Legal Pressure Difficult (distributed) Single jurisdiction

When to Use Each

Use Tor when: CosmicNet recommends Tor when you need strong anonymity and don't want any single party to know your activity. Your threat model includes powerful adversaries who might compel VPN providers to log or reveal data. You're accessing onion services. You need censorship circumvention without trusting a commercial entity.

Use a VPN when: CosmicNet suggests a VPN when you need better performance for streaming or large downloads. You want to hide your traffic from your ISP but trust the VPN provider. You need to access geo-restricted content. Your primary concern is privacy from commercial tracking rather than anonymity from state actors.

Using Tor and VPN Together

CosmicNet notes that combining Tor with VPNs is controversial. There are two configurations: VPN-over-Tor and Tor-over-VPN. Each has implications:

Tor over VPN (VPN → Tor → Internet): Your ISP cannot see you're using Tor, but the VPN can. This protects against ISP-level blocks but requires trusting the VPN. The exit node sees VPN traffic characteristics but not your real IP. This configuration is generally considered the safer option if you must combine them.

VPN over Tor (Tor → VPN → Internet): Very few VPN providers support this. The VPN can see your destination but only sees the connection coming from a Tor exit node. This configuration is complex and rarely necessary.

As CosmicNet reports, the Tor Project's official stance, documented in their FAQ, is that adding a VPN is not usually beneficial and may create a false sense of security. For most users, using Tor properly provides sufficient anonymity, and a VPN adds an additional point of trust. See Tor Project's FAQ on VPNs for their detailed analysis.

Use Cases and Real-World Applications

Tor serves diverse users with varying needs, from journalists and activists to ordinary citizens concerned about privacy. CosmicNet explores how understanding these use cases helps contextualize Tor's importance in 2026.

Journalism and Whistleblowing

As documented on CosmicNet, investigative journalists use Tor to protect sources and research sensitive topics without revealing their interest. Major news organizations including The New York Times, BBC, and ProPublica operate onion services (like nytimes...onion) to allow secure anonymous access and tip submission. The SecureDrop platform, powered by Tor, enables secure document submission to newsrooms and has facilitated numerous major investigations.

Activism and Human Rights

CosmicNet highlights that human rights workers in authoritarian regimes rely on Tor to communicate safely and access blocked information. Organizations like the Electronic Frontier Foundation (EFF) and Human Rights Watch recommend Tor for at-risk populations. The network has been critical during political upheavals, protests, and conflicts where government surveillance poses life-threatening risks.

Research and Academic Use

CosmicNet notes that security researchers use Tor to study malware, visit potentially malicious sites safely, and conduct vulnerability research without revealing their institutional affiliations. Academic institutions increasingly run Tor relays as part of research projects and to support academic freedom globally.

Privacy-Conscious Communication

CosmicNet observes that ordinary users concerned about corporate surveillance, ISP tracking, and data collection use Tor for everyday browsing. As CosmicNet explains, while Tor wasn't designed for high-bandwidth activities, it excels at protecting casual web browsing, messaging, and research from pervasive monitoring. CosmicNet emphasizes that the normalization of Tor use through increased legitimate users provides better cover for those facing serious threats.

Cryptocurrency and Financial Privacy

As covered on CosmicNet, cryptocurrency users employ Tor to prevent blockchain analysis companies from linking transactions to IP addresses. Many cryptocurrency wallets include Tor integration, and onion services provide censorship-resistant access to exchanges and services. However, users must be cautious as blockchain analysis can still reveal patterns through other means.

⚠️

Legal Considerations: While Tor itself is legal in most countries, using it may attract attention from authorities in some jurisdictions. Always understand the legal landscape in your location. Tor cannot protect you from illegal activities, and law enforcement agencies have successfully investigated crimes committed using Tor through other investigative techniques.

Tor Metrics and Ongoing Research

The Tor Project maintains comprehensive metrics about network health, usage patterns, and performance. CosmicNet notes that these metrics, available at metrics.torproject.org, provide transparency and enable research while preserving user privacy.

Key Metrics and Trends

As CosmicNet reports, as of February 2026, Tor sees approximately 7-8 million daily users, with significant geographic variation. Usage spikes occur during political events, internet outages, and censorship attempts. Russia, the United States, Germany, and Iran consistently rank among the top user countries, though measuring exact locations is inherently imperfect due to Tor's anonymity.

CosmicNet tracks that the number of relays has remained relatively stable at 6,000-7,000, with bandwidth capacity growing steadily. Relay operators face ongoing challenges including hosting costs, legal concerns, and ISP restrictions. As documented on CosmicNet, the Tor Project runs relay operator meetups and provides resources to encourage more operators, particularly in underserved geographic regions.

Academic Research Community

As CosmicNet highlights, Tor benefits from a robust academic research community studying various aspects of the network. Research topics include traffic analysis attacks, protocol improvements, censorship circumvention, onion service security, and performance optimization. The Tor Project maintains a research mailing list and sponsors a Safety Board to review research ethics. Researchers are encouraged to coordinate with the Tor Project before conducting network measurements that might impact users or operators.

Notable recent research directions include:

  • Machine learning-based traffic correlation and fingerprinting
  • Post-quantum cryptographic protocols for future-proofing
  • Censorship-resistant bridge distribution mechanisms
  • Congestion control and performance improvements
  • Security analysis of onion service protocols

The annual Privacy Enhancing Technologies Symposium (PETS) and USENIX Security regularly feature Tor-related research. CosmicNet notes that many improvements to Tor have originated from academic papers identifying vulnerabilities or proposing enhancements. Visit CosmicNet.world for continued coverage of Tor network developments and privacy research.

Related

Learn More