Bitcoin Core #36757 · merged 2026-11-12
Ignore a privacy-network peer's view of our address
A malicious Tor or I2P peer could make your node reveal its listening port, then use that port to link your onion identity to your clearnet IP.
Author: stratospher · Found by Project Loupe and instagibbs · github.com/bitcoin/bitcoin/pull/36757
Background
Nodes ask peers "what's my address?"
- Every
VERSIONmessage carriesaddrMe: the IP the sender thinks the receiver has. - With
-discoveron, Core sometimes trusts that view and self-advertises it back to the peer in anADDRmessage, so the peer can gossip how to reach us. - On an outbound connection the peer can't see our listening port, so Core keeps the IP the peer reported and fills in our real listening port.
- Honest Tor/I2P peers send
addrMeas all zeroes, since they can't see our IP. A malicious one can put anything there.
The leak
A Tor peer fakes addrMe and gets our port back
The IP in the advertisement is junk the attacker chose. The port is the real secret.
The correlation
An unusual port links the two identities
On the default port 8333 the leak blends in with thousands of nodes. A rare port is a near-unique fingerprint.
How bad was it?
Real, but hard to pull off
You must pick them
The attacker's Tor/I2P peer has to be one your node chooses for an outbound connection from addrman.
You need a rare port
The leak only singles you out if your listening port is unusual. On 8333 you're one of thousands.
You run both networks
The node has to be reachable on clearnet and Tor/I2P, with -discover on, so there are two identities to link.
The PR notes this "would become easier in a future if we ever support random ports."
The fix
Never trust a Tor/I2P peer's view of us
// src/net.cpp · IsPeerAddrLocalGood() - return fDiscover && pnode->addr.IsRoutable() && addrLocal.IsRoutable() && + // Tor/I2P peers can't see our clearnet address and the Tor/I2P address + // won't fit in addrMe (addrv1). so ignore it. + return fDiscover && !pnode->IsConnectedThroughPrivacyNet() && + pnode->addr.IsRoutable() && addrLocal.IsRoutable() && g_reachable_nets.Contains(addrLocal);
- One condition: if the peer is on a privacy network, its
addrMeis ignored for both inbound and outbound connections. - A Tor peer can never legitimately see our IP anyway, so nothing useful is lost.
- New unit tests cover an inbound I2P peer and an outbound onion peer.
Discussion
Questions for the room
- Second Loupe find this month (after CVE-2026-117348). Are LLM scanners now the main source of Core bug reports?
- Should mixed clearnet + Tor nodes be discouraged entirely, or is that too much to ask of node runners?
- Random listening ports would make this attack easier. What other leaks would they enable?
- Running on a non-default port for "privacy": does it help or hurt?