INTERACTIVE LAB

Anonymity Part 1: Tor Fundamentals

Five interactive exercises covering onion routing architecture, Tor installation, configuration, hidden services, and OPSEC limitations. Features an animated circuit walkthrough.

1
2
3
4
5
Lab Exercises
1
How Tor Works: Onion Routing
BEGINNER COMPLETE

Tor routes traffic through three volunteer-operated relay nodes. Each relay knows only its immediate neighbors — never the full path. Click through each hop to see how encryption layers are peeled at every relay.

ONION ROUTING — CORE CONCEPT

Before sending data, your Tor client wraps it in three layers of encryption — one for each relay. Each relay decrypts its own layer to reveal the next hop address, then forwards the payload. By the time the packet exits, no single node has seen both the origin and destination.

TOR CIRCUIT — THREE-HOP RELAY PATH
YOU
(Client)
Encrypted
Layer 1
GUARD
Relay
Encrypted
Layer 2
MIDDLE
Relay
Encrypted
Layer 3
EXIT
Relay
Plaintext*
WEBSITE
(Destination)
Outer Layer (Guard)
Middle Layer (Middle)
Inner Layer (Exit)
Click "Next" to start the circuit walkthrough.
RELAY TYPES — WHAT EACH NODE KNOWS

Guard (Entry): Knows your real IP, does not know the destination. Middle: Knows neither your IP nor the destination — only the adjacent relays. Exit: Knows the destination, does not know your IP. This division is why no single node can de-anonymize you without controlling multiple positions simultaneously.

OBJECTIVE

Walk through all 5 steps of the circuit to complete this exercise. Use the Next / Prev buttons above.

2
Install & Start Tor
BEGINNER COMPLETE

Install Tor, start the service, watch it bootstrap to the network, and verify your traffic is exiting through Tor. A three-step terminal sequence with a live bootstrap animation.

OBJECTIVE — STEP 1 OF 3

Install Tor using apt. Type: sudo apt install tor

student@hexworth: ~
student@hexworth:~$
Hint: sudo apt install tor
TOR BOOTSTRAP PROGRESS
KEY INSIGHT — SOCKS5 PROXY

Tor exposes a SOCKS5 proxy on localhost:9050 by default. Any application that supports SOCKS5 can route through Tor without additional configuration. The curl --socks5 flag, torsocks wrapper, and the Tor Browser all use this socket. HTTP traffic exiting through the exit node is unencrypted unless the site uses HTTPS — always prefer HTTPS sites when using Tor.

3
Tor Configuration — /etc/tor/torrc
INTERMEDIATE COMPLETE

The torrc file controls Tor's behavior: exit node country selection, strict routing, and exclusions. You will edit it and understand the trust and censorship implications of each directive.

OBJECTIVE — STEP 1 OF 2

Open the Tor config file for editing. Type: sudo nano /etc/tor/torrc

student@hexworth: ~
student@hexworth:~$
Hint: sudo nano /etc/tor/torrc
GNU nano 7.2 /etc/tor/torrc [Modified]
OPSEC — EXIT NODE COUNTRY SELECTION

Specifying ExitNodes {us} forces exit traffic through US-based relays. This can help reach geo-restricted content, but it also concentrates trust in one jurisdiction — that government could compel relay operators to log traffic. ExcludeExitNodes {cn},{ru} avoids adversarial infrastructure, but Tor's own position is that restricting nodes weakens the anonymity set. Use country restrictions only when the operational need is clear.

4
.onion Hidden Services
INTERMEDIATE COMPLETE

Set up a Tor Hidden Service that makes a local web server accessible via a .onion address — without a public IP or open port. Both client and server use Tor circuits; there is no exit node involved.

OBJECTIVE — STEP 1 OF 2

Add hidden service directives to torrc. Type: sudo nano /etc/tor/torrc

student@hexworth: ~
student@hexworth:~$
Hint: sudo nano /etc/tor/torrc
GENERATED .ONION ADDRESS
HIDDEN SERVICE — RENDEZVOUS POINT ARCHITECTURE
  CLIENT SIDE                           SERVER SIDE
  ┌─────────────┐                       ┌─────────────┐
  │  Tor Client │                       │ Hidden Svc  │
  │  (Browser)  │                       │ (your site) │
  └──────┬──────┘                       └──────┬──────┘
         │ Tor Circuit                         │ Tor Circuit
         │ (3 hops)                            │ (3 hops)
         ▼                                     ▼
  ┌─────────────────────────────────────────────────┐
  │         RENDEZVOUS POINT (volunteer relay)       │
  │  Client picks this relay & tells server         │
  │  Server builds a circuit TO the same relay      │
  │  They meet in the middle — no exit node needed  │
  └─────────────────────────────────────────────────┘

  .onion address = public key hash of the service's
  Ed25519 keypair. Tor uses this to authenticate
  and route to the hidden service automatically.
  No DNS, no public IP, no port forwarding needed.
KEY INSIGHT — END-TO-END ENCRYPTION

Unlike regular Tor circuits where exit traffic can be plaintext, .onion connections are end-to-end encrypted using the service's Ed25519 key. There is no exit node — both sides use Tor circuits that meet at a rendezvous point. This makes .onion services more private and resistant to exit node monitoring than clearnet Tor browsing.

5
Tor Limitations & OPSEC
ADVANCED COMPLETE

Tor is a tool, not a magic cloak. Identify real attack surfaces, understand DNS leaks, and distinguish behaviors that destroy anonymity from behaviors that preserve it.

DNS LEAK — WHAT IT IS AND WHY IT MATTERS

A DNS leak occurs when your DNS queries bypass Tor and reach your ISP's resolver, revealing which hostnames you are looking up even if the TCP connection itself is tunneled. Use torsocks to force DNS resolution through Tor as well.

DNS LEAK (Without torsocks)
student@hexworth:~$ nslookup example.com Server: 192.168.1.1 <-- YOUR ISP resolver Address: 192.168.1.1#53 DNS query visible to ISP! example.com → 93.184.216.34 ISP sees: you looked up example.com at 14:32 UTC
NO LEAK (With torsocks)
student@hexworth:~$ torsocks nslookup example.com Tor SOCKS resolver: <-- exit node resolver 127.0.0.1:9050 DNS routed through Tor circuit example.com → 93.184.216.34 ISP sees: encrypted Tor traffic (destination unknown)
Which of the following does Tor protect against? (Select all that apply)
Which behaviors compromise Tor anonymity? (Select all that apply)
CRITICAL OPSEC — TOR IS NOT ENOUGH ALONE

Logging into a personal account instantly de-anonymizes you regardless of Tor. Torrent clients often make UDP connections that bypass Tor entirely, leaking your real IP to tracker servers. Browser fingerprinting (canvas, WebGL, fonts, screen size) can identify you even without an IP address. Full-disk encryption, compartmentalization (separate VMs or Tails OS), and disciplined behavior matter more than the network tool itself.

OBJECTIVE

Run a Tor verification check using curl through the SOCKS5 proxy. Type: curl --socks5 localhost:9050 https://check.torproject.org/api/ip

student@hexworth: ~
student@hexworth:~$
Hint: curl --socks5 localhost:9050 https://check.torproject.org/api/ip

Lab Progress

Complete all five exercises to mark this lab finished and record your progress.

0 / 5 exercises complete
Lab recorded. Returning to Linux Admin...