Skip to content

Conversation

naiyoma
Copy link
Contributor

@naiyoma naiyoma commented Sep 29, 2025

TLDR: When a node is connected to multiple networks (e.g., clearnet and Tor), it keeps separate ADDR response caches for each network. These are refreshed about once per day (randomized between 21 and 27 hours). See → https://github.com/bitcoin/bitcoin/blob/master/src/net.cpp#L3519
This is an example of a dual-homed node’s addrman response, with separate caches:

IPv4 response:

{102.130.242.11:8333 : 1741100851}
{119.17.151.161:8333 : 1739825443}
{ubeirqalc4vj54baszpatvctpohn62hzj7vfnbncy6upa6vywvgewrad.onion:8333 : 1739825443}

Tor response:

{102.130.242.11:8333 : 1741100851}
{94.23.167.176:8333 : 1740895525}
{ubeirqalc4vj54baszpatvctpohn62hzj7vfnbncy6upa6vywvgewrad.onion:8333 : 1739825443}

Currently, there's a fingerprinting attack that exploits responses to GETADDR messages. An attacker can collect responses from supposedly different nodes and compare the timestamps. By looking at overlaps in responses, they can correlate Tor and clearnet identities — effectively linking them back to the same node.
More details on this attack here: https://delvingbitcoin.org/t/fingerprinting-nodes-via-addr-requests/1786

This PR mitigates the attack by setting the timestamps in different caches to a fixed value in the past (10.5 ± 2.5 days), preventing correlation through timestamps.
After the change, timestamps in each cache are now uniform, but differ between caches:

IPv4 response:

{102.130.242.11:8333 : 1757964675}
{119.17.151.161:8333 : 1757964675}
{ubeirqalc4vj54baszpatvctpohn62hzj7vfnbncy6upa6vywvgewrad.onion:8333 : 1757964675}

Tor response:

{102.130.242.11:8333 : 1757878277}
{119.17.151.161:8333 : 1757878277}
{ubeirqalc4vj54baszpatvctpohn62hzj7vfnbncy6upa6vywvgewrad.onion:8333 : 1757878277}

We initially considered setting the timestamps to 0, since they would eventually be updated and saved. However, this isn’t compatible with btcd (see details here → btcsuite/btcd#2411 ).
This is still a work in progress — we’re continuing to test and are open to trying other solutions as well.

This is joint work with @danielabrozzoni

@DrahtBot DrahtBot added the P2P label Sep 29, 2025
@DrahtBot
Copy link
Contributor

DrahtBot commented Sep 29, 2025

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33498.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK jonatack, mzumsande, sipa

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@jonatack
Copy link
Member

Concept ACK on working on this. Good to see proposals like this and #33464.

Copy link
Contributor

@mzumsande mzumsande left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

The suggested solution reduces the precision of timestamps for the receiving party, but makes fingerprinting harder - seems like an acceptable trade-off to me.

If there is an active node behind the address it won't be Terrible for another ~20 days - until that happens, we could update it with a more accurate timestamp when we connect to it or receive the addr via gossip relay.

@sipa
Copy link
Member

sipa commented Oct 1, 2025

Concept ACK

naiyoma and others added 2 commits October 3, 2025 14:38
Co-authored-by: Daniela Brozzoni <danielabrozzoni@protonmail.com>
Co-authored-by: Daniela Brozzoni <danielabrozzoni@protonmail.com>
@naiyoma naiyoma force-pushed the 2025_3/getaddr_timestamp_changes branch from 3a8b014 to 28fe8ec Compare October 3, 2025 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants