The idea
Liv runs the tip line at Fjordposten, a newspaper in Bergen. This week a clerk at the city council wants to send her a document about a housing contract.
The clerk must be able to reach the tip line without anyone, the paper included, learning where they are. And the paper would rather not tell the world where the tip line's server sits.
A Tor onion service does both: a website that lives inside Tor and has no address anyone can look up. Here Liv's tip line and the source's laptop both run real Tor.
Steps
-
An onion address is a key, not a place
Tor hides who visits a website, but not where the website is. An ordinary site sits at a public IP address, and anyone can look its name up in DNS and find the machine, Tor or not. If the tip line were an ordinary site, anyone could learn where its server is and which company hosts it.
An onion service has no address to look up: its name is its own public key. A key pair is two matching keys. The public key can be handed to anyone, the secret key never leaves the machine, and only the holder of the secret key can prove that it matches the public one.
That is why nobody has to vouch for an onion name. On the open web you trust a DNS server to give the right address and a certificate authority, a company that vouches for websites, to say the site is real. With an onion address, Tor checks that the service proves it holds the secret key behind the name you typed, and nobody in between can fake that proof.
When Liv set up the tip line, Tor made its key pair and saved the matching address in a file called
hostname. Read it on the tip line.tipline:~# cat /var/lib/tor/onion-service/hostname
-
Only Tor can reach the tip line's web server
An onion address alone does not hide the server. The tip line machine still has its own IP address on the network,
10.0.1.20. If its web server answered there, anyone could scan the network, find it and see where it is, with no Tor needed.So the web server listens only on
127.0.0.1, an address that means "this machine", which no other machine can reach. Picture a phone extension that rings only inside the building. Tor runs on the same machine, so Tor can hand requests to the web server, and nothing outside can.The tip line's web server is otherwise an ordinary one. Ask the tip line which ports it has open, then try to reach it straight from the source's laptop, without Tor.
tipline:~# ss -ltn source:~# curl -m 5 http://10.0.1.20/
-
The tip line reaches out first, to introduction points
A visitor cannot connect to a server that nobody can find, so the tip line makes the first move. Picture someone in hiding who asks a few shopkeepers: "If anyone asks for me, pass the message on." They never say where they live, and they phone the shops to collect their messages.
The tip line builds a circuit to a few relays and asks each one to pass on requests for it: these relays are its introduction points. A circuit is a chain of relays that Tor sets up for one connection, where each relay knows only the one before it and the one after it. So an introduction point sees a circuit arrive from another relay and does not learn where the tip line is.
Visitors still need to know which relays those are. The tip line writes a short note, its descriptor, that lists its introduction points, signs it so it cannot be forged, and uploads it to a few relays that work as Tor's phone book, marked
HSDirin Tor's relay list. The note is locked with a key worked out from the onion address, so only someone who already has the address can read it.Ask the tip line's Tor for its circuits. Tor answers on its control port,
9051, which takes typed commands.tipline:~# nc 127.0.0.1 9051
-
The visit never leaves Tor
The source has only the address, so the Tor client on their laptop starts from it. The source picks a meeting place and invites the tip line there, so nobody ever connects to anybody's real address. The client does this in four moves:
- It fetches the descriptor from the phone book and unlocks it with the address, which gives the introduction points.
- It picks a relay as the rendezvous point, the meeting place, builds a circuit to it and leaves a one-time secret there.
- Through an introduction point, it sends the tip line a sealed note: meet me at this relay and show this secret. Only the tip line can open the note.
- The tip line builds its own circuit to the rendezvous point and shows the secret, and the relay joins the two circuits.
Two kinds of relay share the work for a reason. Anyone with the address can see which relays are the tip line's introduction points, so they only ever carry short invitations. The conversation goes through a relay the visitor picks fresh, which never learns which service it joins.
source:~# curl --socks5-hostname 127.0.0.1:9050 http://a4jwffgjru3imm3nmzve7l3hsqtspgpo3r5edh6tdgae5h7gej3dzgad.onion/
-
Two circuits meet at the rendezvous point
The visit used two circuits that meet in the middle, like two people who each take their own route to a cafe that neither of them lives near. The source built one circuit, ending at the rendezvous point it chose. The tip line, invited through its introduction point, built a second one, ending at the same relay.
Each side builds its own half, so each side knows only its own relays, and no relay holds both ends. The rendezvous point sees one circuit arrive from a relay on the source's side and one from a relay on the tip line's side, and passes traffic between them.
The tip line's half has one relay more. The source picked the meeting place, and a hostile visitor could pick a relay they run. The extra relay keeps the tip line's guard, the first relay of all its circuits, further from that relay.
Ask both machines for their circuits, the source first.
source:~# nc 127.0.0.1 9051 tipline:~# nc 127.0.0.1 9051
-
Neither side ever sees the other's address
The circuit lists show what Tor says it did. A recording of the real packets on each machine shows what crossed the wire, which is stronger proof. If the onion service works, the source never exchanges a single packet with
10.0.1.20, and the tip line never with10.0.1.30.Each machine should talk only to its own guard, on port
9001, the port the relays in this lab listen on. Visit the tip line again while the lab records Tor traffic on both machines at once, then look for the other side's address in each recording.source:~# curl --socks5-hostname 127.0.0.1:9050 http://a4jwffgjru3imm3nmzve7l3hsqtspgpo3r5edh6tdgae5h7gej3dzgad.onion/
Run these steps on real machines