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

p2p: Implement `encoding` traits for `AddrV2Message`

Public commit record

What the developer wrote

Authored by rustaceanrob

81/100 · Strong
p2p: Implement `encoding` traits for `AddrV2Message`

Member of `AddrV2Payload` which is ultimately apart of
`NetworkMessage`.

Some non-zero number of clients advertise services outside of 32 bits of
precision, which requires decoding arbitrarily large compact sizes. As
these integers do not represent collection lengths and will not be used
for allocation, this is acceptable.

ref: https://github.com/bitcoin/bitcoin/blob/4d7d5f6b79d4c11c47e7a828d81296918fd11d4d/src/protocol.h#L332
ref: https://github.com/bitcoin/bitcoin/issues/34768
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit adds encoding and decoding support for a Bitcoin peer-to-peer network address message type (AddrV2Message). It changes how the 'services' field is decoded so it can accept very large numbers sent by some real Bitcoin nodes, instead of being limited to 32-bit values. The commit message says this is safe because the value is not used to allocate memory. There is no direct evidence in the commit that this fixes a security vulnerability, but handling unexpectedly large input values is a common place where bugs can occur.

Recommended action

Review whether ServiceFlags correctly rejects or masks service bits above the protocol-defined range, and verify that downstream code does not later use the raw u64 as a length, bitmask index, or allocation trigger. Consider adding unit tests with malformed compact-size service values at the boundary.

Security signals we found

01

Change in deserialization boundary: widens accepted integer range for untrusted network input

02

Commit explicitly discusses decoding 'arbitrarily large compact sizes' from peer messages

03

References upstream Bitcoin Core issue #34768 about non-standard service flag advertisement

04

No bounds/validation logic for services value beyond wrapping in ServiceFlags

05

No explicit security framing or CVE/fix language in commit message

Risk score

Why this scored 27/100

Our methodology →
Potential impact 5/30
Exploitability 4/25
Stealth signal 3/15
Affected reach 6/15
Confidence 6/10
Evidence quality 3/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.