/tor-and-onion-networks:tor-protocol-circuits-and-cell-cryptographyfrom tor-and-onion-networks
Explains Tor's wire protocol: cells, channels, telescoping circuit handshake, ntor/ntor-v3, cell-crypto migration, SENDME flow control, congestion control, and Conflux. Corrects common misconceptions about Tor's anonymity guarantees.
Ships in tor-and-onion-networks. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Part 1 of 8 of the Tor and Onion Networks reference (plugin
tor-and-onion-networks), covering §1–§5. Sibling skills:tor-network-consensus-guards-and-paths(§6–§7),tor-onion-services-and-hardening(§8–§9),tor-censorship-circumvention-and-bridges(§10),tor-attack-literature-and-threat-model(§11),tor-ecosystem-alternatives-and-governance(§12, §14–§16),tor-building-on-tor-software-patterns(§13.1–§13.4, handbook §1),tor-running-relays-bridges-and-hardware(§13.5, handbook §2–§6). Section numbers are shared across the set; a reference written as §N →skillpoints into that sibling skill.Currency: compiled 16 September 2026. Protocol fundamentals (cell formats, handshake math) are stable and change slowly. Version numbers and deployment status are dated — the tor1 → CGO transition in §4 and the Conflux rollout in §5 are mid-flight, so verify against https://spec.torproject.org/ before relying on them months from now.
⚠️ A low-latency anonymity overlay: three independently operated relays and layered encryption, so no single party links who you are to what you are doing.
⚠️ GOTCHA boxes mark where the mental model people carry is wrong in ways that cause real deanonymization or broken tooling.
The three ideas that organize this document:
- ⚠️ TOR SEPARATES IDENTIFICATION FROM ROUTING (§1, §3). The guard knows who you are but not what you do; the exit knows what you do but not who you are. Every design decision downstream — guards, families, path restrictions — exists to keep those two facts in different hands.
- ⚠️ THE TLS BETWEEN RELAYS IS NOT THE ANONYMITY LAYER (§3.3). Hop-to-hop TLS protects against someone sitting between relays. The anonymity comes from the onion-encrypted relay cells riding inside it. Confusing the two is the most common architectural misreading of Tor.
- ⚠️ TOR'S PERFORMANCE PROBLEM WAS NEVER CRYPTOGRAPHIC — IT WAS QUEUEING (§5). Twenty years of latency complaints came from unmanaged queues at slow relays, which is why the 2022–2026 work is congestion control and traffic splitting, not faster ciphers.
Tor is a low-latency anonymity overlay network: roughly 9,200 volunteer relays and 2,300
bridges carrying traffic for several million daily users (network-size and user CSV data
from Tor Metrics, 8–14 Sept 2026; see §6 →
tor-network-consensus-guards-and-paths for detail). A client's traffic is routed through a
chain ("circuit") of three independently operated relays, with layered ("onion") encryption
such that:
The design goal is unlinkability: no single entity — relay, ISP, destination server — should be able to connect a user's identity to their activity. Tor provides transport-layer anonymity: it hides network endpoints, not the content or the behavior inside the stream.
Per its own threat model:
tor-ecosystem-alternatives-and-governance).tor-censorship-circumvention-and-bridges). Tor hides destinations, not
the fact of its use.A useful mental model: Tor gives you three organizational trust boundaries per circuit plus layered crypto, and then throws engineering effort (guards, congestion control, padding research, anti-enumeration transports) at shrinking the residual deanonymization surface.
| Era | Development |
|---|---|
| Mid-1990s | Onion routing invented at the U.S. Naval Research Laboratory (Paul Syverson, David Goldschlag, Michael Reed). The insight: separate identification from routing by nesting encrypted hops. |
| 2002 | First-generation onion routing prototype deployed at NRL. |
| 2003–2004 | Roger Dingledine, Nick Mathewson, and Paul Syverson build the second-generation system — "Tor" — fixing the first gen's problems (no directory system, replay/integrity weaknesses, usability). The USENIX Security 2004 paper Tor: The Second-Generation Onion Router remains the canonical design document. |
| 2004–2006 | EFF funds early development; the network opens to the public. |
| Dec 2006 | The Tor Project, Inc. founded as a U.S. 501(c)(3) nonprofit. |
| 2008–2011 | Tor Browser Bundle (originally "Torbutton") makes the system usable by non-experts; bridges introduced to counter blocking in Iran and China. |
| 2013–2014 | Snowden-era scrutiny and usage spike; ntor replaces the old RSA/TAP handshakes for circuit extension; hidden-service deanonymization research (and at least one real-world attack campaign that surfaced in 2014) catalyzes the v3 redesign. |
| 2015–2018 | .onion registered as a special-use domain (RFC 7686); v3 onion service spec written (224/225 proposals era); ed25519 relay identities roll out. |
| 2017 | Directory authority diversity pushed; Tor Browser 7 based on Firefox ESR 52 brings multiprocess. |
| Oct 2021 | v2 onion services (16-char, RSA-1024, SHA-1-derived) removed from the network. All onion services are now v3 (56-char). |
| 2022–2023 | Congestion control (proposal 324) ships in C tor 0.4.7 and is tuned through 0.4.8; Conflux traffic-splitting (proposal 329) developed. |
| 2023 | Onion-service proof-of-work DoS defense (proposal 327) ships in tor 0.4.8 (Aug 2023). |
| 2024 | Conflux enabled network-wide in C tor (controlled by consensus parameter); Arti (the Rust rewrite) reaches client-side feature parity and gets native vanguards. Tor Project and Tails merge organizations. WebTunnel transport introduced. |
| 2025 | Tor 0.4.9 alphas introduce CGO cell crypto and happy families; Tor Browser 15 (Firefox ESR 140); Arti 2.x series begins; Tor VPN beta (Arti-based Android VPN); Conflux hardening continues; Tails 7 (Debian 13) and Qubes 4.3 ship. |
| 2026 (as of Sept) | C tor 0.4.9.5 is the first stable 0.4.9 (12 Feb 2026); the 0.4.8 series is on the deprecation path. Arti 2.6.0 (1 Sept 2026) makes CGO and congestion control always-on, and pushes toward Arti-as-relay (directory mirror, DNS streams, channel auth). |
⚠️ The pattern to internalize: C tor is in managed decline, Arti is the future. In 2026 the frontier work is relay/directory-authority support in Arti + post-SHA-1 cell crypto (CGO) + congestion/flow-control modernization.
Everything in Tor happens in cells — fixed-size messages multiplexed over TLS connections ("channels") between relays. The classic cell is 514 bytes on the wire: a 2-byte circuit ID (4 bytes on modern link protocols), a 1-byte command, and a 509-byte payload. Variable-length cells exist for protocol negotiation and directory data.
Cell commands split into two families:
CREATE/CREATED (now CREATE2/CREATED2), DESTROY, NETINFO,
CERTS, AUTH_CHALLENGE/AUTHENTICATE, PADDING — negotiated directly with the
immediate neighbor.RELAY (and RELAY_EARLY near circuit creation) — onion-encrypted
payloads that tunnel through the channel, understood only by whichever hop peels that
layer.CREATE2)
with its chosen guard. Both sides now share a symmetric key pair (forward/backward
digests) for that hop. Result: circuit hop 1.EXTEND2 relay cell containing the link
specifiers of the middle relay plus a fresh ntor handshake blob, onion-encrypted for the
guard. The guard unwraps, opens (or reuses) a channel to the middle, forwards the
handshake, and returns the middle's CREATED2 response inside an EXTENDED2 relay cell.
The client now has shared keys with hop 2 as well — negotiated through hop 1 without hop
1 learning the hop-2 key.Each hop strips one layer of symmetric crypto from outbound cells and adds one layer to inbound cells — the "onion." The exit decrypts the final layer and forwards plaintext to the destination (for client circuits) or the service.
// Outbound (client → destination)
Client builds: Layer1(Layer2(Layer3(payload)))
Guard: strips Layer1 → forwards Layer2(Layer3(payload)) to middle
Middle: strips Layer2 → forwards Layer3(payload) to exit
Exit: strips Layer3 → forwards payload to destination
// Inbound (destination → client) reverses: exit adds Layer3, middle adds Layer2,
// guard adds Layer1, and the client — holding keys for all three hops — strips all three.
This is the whole reason the client must hold keys for every hop and each hop holds keys only for itself: the client is the only party that can construct or unwrap the full stack.
Two safety rails worth knowing:
RELAY_EARLY cells bound circuit construction: only the first N (8) relay cells in a
circuit's life may extend it, which prevents infinitely long circuits being used as a
resource-exhaustion vector and bounds certain tagging/confirmation games.NETINFO cells exchange timing/address data used
for NAT traversal and address confirmation.Once a circuit exists, the client attaches streams (TCP connections) to it with
RELAY BEGIN; the exit answers CONNECTED. Data flows as RELAY DATA cells; RELAY END
closes a stream. Tor multiplexes many streams over one circuit, and one client's circuits may
carry arbitrarily many streams — but see stream isolation (§13.1 →
tor-building-on-tor-software-patterns) for why Tor Browser splits streams by first-party domain
anyway.
A subtlety newcomers miss: the hop-to-hop transport is TLS over TCP, but that TLS only
protects against attackers sitting between relays — it is not the anonymity layer. The
anonymity comes from the onion-encrypted relay cells riding inside. Relay channels
authenticate with ed25519 identities (since the 0.3.0 era), and as of C tor 0.4.9 (Feb 2026)
the last pre-ed25519 link authentication methods (v1/v2 handshakes, the old
RSA-SHA256-TLSSecret auth) were removed, along with fake-TLS cipher advertisement code.
| Generation | Used for | Status (Sept 2026) |
|---|---|---|
| TAP | RSA-1024 + DH-1024 first-hop create, old extend | Fully removed from C tor in 0.4.9 (2026) |
| ntor | Curve25519/X25519 one-way-authenticated key exchange for CREATE2/EXTEND2; variant hs-ntor for onion-service intro/rendezvous handshakes | Standard, universal |
| ntor-v3 | Extended ntor with authenticated client→server data in the handshake (needed by CGO's crypto negotiation) | Rolling out; required for CGO negotiation |
The ntor design (Goldberg–Stebila–Ustaoglu, 2012–2013) gives one-way authentication in a single round trip: the server proves identity via its long-term key, the client stays anonymous, and both derive forward-secret session keys. The cost that motivated it — the old TAP handshake needed full RSA operations per hop and was CPU-dominant for relays — is why modern Tor scales at all.
For two decades the relay-level symmetric crypto ("tor1") was AES-128 in counter mode plus a 4-byte running SHA-1 digest for integrity. Cryptographers flagged its problems for years:
The replacement, Counter Galois Onion (CGO), designed by Degabriele, Melloni, Münch and Stam (proposal 308, 2019; revised and instantiated as proposal 359, "CGO Redux"), is the biggest change to Tor's wire format since v3 onion services:
Recognized field disappear (SENDMEs now bind to the cell tag).UPDATE_UIV), so old cells can't be re-decrypted later even with
the current key — forward secrecy at the cell layer.⚠️ GOTCHA for tooling authors: this is still a negotiated transition. Mixed networks run tor1 and CGO side by side until client/relay adoption saturates. When reading packet traces or writing parsers, expect both formats on the wire through at least the rest of 2026 — a parser that assumes the 4-byte SHA-1 digest, or one that assumes the 16-byte tag, will silently mis-frame half the network.
Tor's performance problems were never mainly cryptographic; they're queueing. Three successive systems matter.
The original design gives each stream a 50-cell window and each circuit a 100-cell window;
receivers return a SENDME acknowledgment every N cells to refill the sender's credit. This
prevents memory overload at exits but says nothing about congestion inside the network —
queues built up at slow relays, and the result was Tor's infamous multi-second latency spikes.
Prop 324 adapts TCP-grade algorithms to circuits: Tor-Westwood and Tor-Vegas
estimators pace cells by measured RTT and bandwidth-delay product, with NOLA as a
bandwidth-oracle fallback. Circuit windows can now grow and shrink, and new round-trip
signaling (XON/XOFF-style flow control cells on the newer subprotocol) replaces some
SENDME behavior. Measured effect: large-file and interactive performance improved markedly,
with much smaller inter-relay queues. In Arti, flow control + congestion control
(flowctl-cc) became stable in 2.4.0 (June 2026) and always-on with CGO in 2.6.x.
Conflux lets a client split one logical stream across two circuits to the same exit,
reassembling out-of-order data at the endpoints — head-of-line blocking on one circuit no
longer stalls everything. The relay side adds RELAY_CONFLUX_LINK/LINKED/SWITCH cells and
reorder buffers; scheduling algorithms (MinRTT, LowRTT, BLEST) decide which leg gets the next
cell. Status: enabled on the live network in C tor since 2024 (controlled by the
cfx_enabled consensus parameter), with bug-fix work through 2025–2026 (a non-fatal assertion
fixed in 0.4.8.20; a Conflux queue DoS, CVE-2026-44600, fixed in 0.4.9.7). Benefits are
largest for interactive/bursty traffic. Arti porting was active through 2025 (Arti 1.4.5
changelog) — check release notes for client-side status.
⚠️ GOTCHA for onion-service operators: the legacy Python
vanguardsaddon is incompatible with Conflux (it requiresConfluxEnable 0). That is one of the main reasons the vanguards path now runs through Arti — see §9.1 →tor-onion-services-and-hardening.
tor-network-consensus-guards-and-paths.tor-onion-services-and-hardening.tor-censorship-circumvention-and-bridges.tor-attack-literature-and-threat-model.tor-ecosystem-alternatives-and-governance.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub the-vibey-project/vibey --plugin tor-and-onion-networks8 skills in this plugin
/tor-attack-literature-and-threat-modelUse when assessing what actually threatens Tor users, or when checking a deanonymization claim against the literature — end-to-end confirmation, website fingerprinting and why no defense ships by default, guard discovery, Sybil and malicious-relay campaigns (KAX17, the 2020 exit wave), exit content attacks, HSDir harvesting, DoS, and client-side compromise. Covers §11. Companion to the other Tor and onion-network skills./tor-building-on-tor-software-patternsUse when writing code that talks to Tor — SOCKS with socks5h and stream isolation, the control port, ephemeral onion services via ADD_ONION or stem, long-lived onion services in torrc, client authorization v3, Onion-Location and Alt-Svc headers, torsocks and its limits, embedding Arti, testing against a private chutney network, and building your own private or custom onion-routing network. Covers §13.1–§13.4, §13.6 and handbook §1. Companion to the other Tor and onion-network skills./tor-censorship-circumvention-and-bridgesUse when reasoning about Tor under censorship — bridges, pluggable transports (obfs4, Snowflake, WebTunnel, meek, Conjure), how bridges are distributed, and how blocking actually works — or when reading a blocking-event report. Includes the 2026 Snowflake DTLS fingerprinting campaign and Iran's 2025 stealth blackout as worked cases. Covers §10. Companion to the other Tor and onion-network skills./tor-ecosystem-alternatives-and-governanceUse when choosing a Tor implementation or client (C tor vs Arti, Tor Browser, Tor VPN, Orbot, Tails, Whonix), picking operator tooling (nyx, stem, txtorcon, chutney), comparing Tor against I2P, mixnets or VPNs, or looking up the specs, proposals and foundational papers. Covers §12, §14–§16. Companion to the other Tor and onion-network skills./tor-network-consensus-guards-and-pathsUse when reasoning about the Tor network as an operated system — relays and flags, the nine directory authorities, the hourly consensus, bandwidth weights, guard pinning and why it exists, path-selection restrictions, and happy families — or when looking up a relay with Relay Search, Onionoo, ExoneraTor or CollecTor. Covers §6–§7. Companion to the other Tor and onion-network skills./tor-onion-services-and-hardeningUse when working with v3 onion services — the 56-character address format, blinded descriptor keys, introduction and rendezvous points, client authorization, single-onion mode — or when hardening one with vanguards, proof-of-work DoS defense, Onionbalance and Onionspray, or advertising it via Onion-Location. Covers §8–§9. Companion to the other Tor and onion-network skills.