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

p2p: Compute checksum when decoding v1 messages

Public commit record

What the developer wrote

Authored by rustaceanrob

68/100 · Adequate
p2p: Compute checksum when decoding v1 messages

The `sha2_checksum` function is updated to take a `T: Encodable`, which
is passed to `hashes::encode_to_engine`. Two calls to `sha2_checksum`
are unwound, as `Vec<u8>` is not `Encodable`, but both of these
callsites will be removed shortly when `CheckedData` is removed along
with the legacy encoding traits.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a missing security check in the Bitcoin peer-to-peer message decoder. Previously, when receiving v1 Bitcoin network messages, the code decoded the payload but did not verify the 4-byte checksum in the message header against the actual payload data. That meant corrupted or tampered messages could be accepted as valid. The change makes the decoder compute the expected checksum and reject messages where the checksum does not match.

Recommended action

Treat this as a security fix and include it in the next maintenance release. Users running P2P networking code from affected versions should upgrade. No immediate workaround is described in the commit.

Security signals we found

01

Missing integrity check on decoded P2P v1 message payloads

02

Addition of checksum mismatch rejection with explicit error variant

03

Refactoring of sha2_checksum to operate on Encodable types

04

Legacy CheckedData checksum paths preserved but marked for removal

Risk score

Why this scored 60/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 8/15
Affected reach 10/15
Confidence 8/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.