AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 44 Bitcoin

fix: Onion v3 parse/format order and render lowercase

Public commit record

What the developer wrote

Authored by Erick Cestari

100/100 · Strong
fix: Onion v3 parse/format order and render lowercase

Tor v3 addresses are base32 of 35 bytes laid out as:
[32-byte ed25519 pubkey][2-byte checksum big-endian][1-byte version]

see: https://spec.torproject.org/rend-spec/encoding-onion-addresses.html

* Parsing now slices 0..32 = pubkey, 32..34 = checksum (BE), 34 = version.
* Display now appends pubkey + checksum + version and lowercases base32.
* Adds/updates test vector accordingly.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit fixes how rust-lightning reads and writes Tor onion v3 network addresses. Previously the code treated the 56-character onion address as if its bytes were arranged in the wrong order: it put the version and checksum at the front and the public key at the back, which is the opposite of the real Tor specification. It also printed onion addresses in uppercase base32 instead of lowercase. The fix reorders parsing and formatting to match the official Tor layout (pubkey first, then checksum, then version) and forces lowercase output. Because of the old bug, a valid real-world onion address would have been parsed into the wrong internal fields, and addresses produced by the library would not have been valid Tor addresses.

Recommended action

Review whether any persisted onion addresses, peer announcements, or logs produced before this patch need re-parsing, because old formatted addresses were invalid. Consider adding explicit checksum verification and version-range validation during parsing to detect corrupt or malicious onion addresses. Backport to release branches that expose OnionV3 socket parsing.

Security signals we found

01

Incorrect parsing of network address format

02

Non-conformant serialization of network address format

03

Spec-mismatch in Tor Onion v3 address encoding

04

Potential interoperability / connectivity failure with Tor peers

05

No explicit validation of checksum or version value

Risk score

Why this scored 44/100

Our methodology →
Potential impact 12/30
Exploitability 8/25
Stealth signal 6/15
Affected reach 7/15
Confidence 7/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.