Tor hidden services (onion services) are the backbone of the dark web, they allow websites to exist without revealing their physical location or server IP address. Understanding how they work explains both their remarkable anonymity properties and their limitations.
What are onion services?
Onion services (formerly "hidden services") are services that exist entirely within the Tor network, they have .onion addresses and never touch the regular internet. Unlike regular websites accessed through Tor, onion services communicate entirely inside the Tor network, providing end-to-end encryption and mutual anonymity.
.onion addresses: Onion services use special .onion addresses, 56-character strings derived from the service's public key. The address itself is the service's identity, it can't be spoofed or hijacked because it's mathematically derived from the key.
No physical location: Onion services don't reveal their physical location or server IP address, they can be hosted anywhere in the world, including countries with hostile internet policies.
End-to-end encryption: Communication between client and onion service is encrypted end-to-end, even Tor relays can't read the traffic.
Mutual anonymity: Both the client and the service are anonymous to each other, neither knows the other's IP address or location.
Censorship resistance: Onion services are highly resistant to censorship, blocking them requires blocking the entire Tor network or blocking .onion addresses, which is difficult because there are millions of possible addresses.
How onion services work
Introduction points: The service host chooses several Tor nodes to serve as introduction points, it builds circuits to these nodes and tells them to forward introduction requests.
Hidden service descriptors: The host builds documents called "hidden service descriptors" listing its introduction points and describing how to contact it, these are uploaded to a set of HSDir nodes.
Client connection: When a client wants to connect, it picks a Tor node at random to be its rendezvous point, builds a circuit to it, and requests the service's descriptor from HSDir nodes.
Rendezvous point: The client builds an anonymous circuit to one of the service's introduction points and gives it an introduction request, including the rendezvous point address and cryptographic handshake.
Service connection: The service receives the introduction request and makes an anonymous circuit to the rendezvous point, completing the handshake.
Circuit joining: The rendezvous point connects the client's circuit to the service's circuit, creating a single encrypted connection through the Tor network.
Application protocol: Once circuits are joined, client and service use Tor relay cells to deliver application data, the rendezvous point simply forwards cells between circuits.
Security properties
Location hiding: The service's IP address and physical location are never revealed, introduction points only know the service's public key, not its location.
Client anonymity: The service doesn't know the client's IP address or location, the client connects through Tor circuits, not directly.
End-to-end encryption: All communication is encrypted, Tor relays can't read traffic, and the service can only decrypt it with its private key.
Address authentication: The .onion address is derived from the service's public key, it's cryptographically impossible to spoof or hijack the address.
Descriptor integrity: Hidden service descriptors are signed with the service's private key, only the legitimate service can publish valid descriptors.
Deniability: The service can deny operating the onion service, the cryptographic properties make it difficult to prove ownership.
Censorship resistance: Blocking onion services requires blocking the entire Tor network or blocking .onion addresses, both are technically difficult.
Limitations and risks
Traffic analysis: While onion services provide strong anonymity, they're not immune to traffic analysis, sophisticated adversaries can correlate traffic patterns to identify services.
Timing attacks: Timing analysis can reveal information about service activity, when services are online, how much traffic they receive, etc.
Introduction point compromise: If an introduction point is compromised, it could reveal information about the service, though it still wouldn't reveal the service's location.
HSDir compromise: If HSDir nodes are compromised, they could potentially track descriptor requests, though they can't decrypt the traffic.
Endpoint compromise: If the service's server is compromised, its private key could be stolen, allowing impersonation.
Human error: Service operators can make mistakes, revealing their location, using weak keys, or other OPSEC failures.
Legal risks: Operating illegal onion services carries legal risks, law enforcement can identify operators through various means.
Onion service types
Web services: Websites and web applications, the most common type, including darknet markets and forums.
Email services: Onion email services, allowing anonymous email communication.
Chat services: Onion chat services, instant messaging and chat rooms.
File sharing: Onion file sharing services, anonymous file hosting and sharing.
APIs and services: Onion APIs and backend services, supporting other onion services.
Custom services: Custom protocols and applications, anything can be hosted as an onion service.
Onion service deployment
Tor hidden service: Run a Tor client with hidden service enabled, configure the service in torrc file.
Onion service key: Generate an onion service key, this determines the .onion address.
Service configuration: Configure the hidden service, specify what port the service runs on and where it redirects.
Descriptor upload: The service automatically uploads descriptors to HSDir nodes, making it discoverable.
Testing: Test the service through Tor Browser, verify it works correctly.
Maintenance: Maintain the service, keep it updated, monitor for issues, and ensure security.
Onion service security best practices
Strong keys: Use strong cryptographic keys, never share or lose your onion service key.
Secure hosting: Host the service securely, use dedicated servers, strong passwords, and regular updates.
OPSEC: Maintain operational security, don't reveal your location, use secure communication, and follow best practices.
Regular updates: Keep software updated, patch vulnerabilities, update Tor, and maintain security.
Monitoring: Monitor the service, watch for attacks, unusual activity, and security issues.
Backup: Backup the service, maintain copies of keys and configurations for recovery.
Legal compliance: Understand legal risks, operating onion services may have legal implications depending on content and jurisdiction.
Onion services vs regular websites over Tor
Regular websites over Tor: Regular websites accessed through Tor exit nodes, the website knows the exit node's IP, not the client's.
Onion services: Services entirely within Tor, no exit node involved, end-to-end encryption, mutual anonymity.
Privacy: Onion services provide stronger privacy, no exit node to monitor traffic, end-to-end encryption.
Anonymity: Onion services provide stronger anonymity, both client and service are anonymous to each other.
Security: Onion services provide stronger security, end-to-end encryption prevents traffic inspection.
Reliability: Onion services can be less reliable, dependent on Tor network health and service uptime.
Speed: Onion services can be slower, traffic routed through multiple Tor circuits adds latency.
Real-world onion services
Darknet markets: Markets like DrugHub, Mega, and others operate as onion services, providing anonymous marketplaces.
Forums: Forums like Dread, Pitch, and Tenebris operate as onion services, providing anonymous discussion platforms.
News sites: News sites like BBC, Guardian, and NYT operate as onion services, providing censorship-resistant news access.
Whistleblower platforms: Platforms like SecureDrop operate as onion services, enabling anonymous whistleblowing.
Privacy tools: Privacy tools and services operate as onion services, providing anonymous access to privacy-enhancing tools.
Activist sites: Activist and dissident sites operate as onion services, providing censorship-resistant communication.
The future of onion services
Onion service v3: The current version uses 56-character addresses, providing stronger security than v2's 16-character addresses.
Improved security: Ongoing development aims to improve security, better cryptography, stronger anonymity, and enhanced censorship resistance.
Broader adoption: Onion services are increasingly adopted, not just for illegal activity but for legitimate privacy needs.
Decentralization: Onion services are inherently decentralized, no central authority controls them.
Innovation: New onion services continue to emerge, supporting diverse applications and use cases.
Legal challenges: Legal challenges continue, governments grapple with regulating onion services while protecting privacy.
Technical evolution: Technical evolution continues, new features, better performance, and enhanced security.
Onion services are the foundation of the dark web, providing the anonymity and security that enable both legitimate privacy needs and illegal activity. Understanding how they work reveals both their remarkable properties and their limitations, they're not magic anonymity tools but carefully designed systems with specific security properties and vulnerabilities. The .onion address system is elegant, deriving service identity from cryptographic keys provides strong authentication and prevents spoofing. The rendezvous protocol is clever, enabling two anonymous parties to communicate without revealing their locations. But onion services are not immune to all attacks, traffic analysis, timing attacks, and endpoint compromise remain threats. For users and operators, onion services represent a powerful tool, but one that requires careful use and understanding of its limitations. The future of onion services will likely see continued evolution, better security, broader adoption, and ongoing debates about privacy versus security in the digital age.
The Tor onion service spec, Tor onion services properties, Tor onion services documentation, Tor Browser onion services, and Tor onion service protocol are the primary sources. For related coverage, see our onion services guide and dark web safety guide.
Comments 0