#36635 fuzz: Add a target that feeds arbitrary bytes to V2Transport
| Reviewability | Reviews | Agreement | Size | ||||
|---|---|---|---|---|---|---|---|
| #36635 fuzz: Add a target that feeds arbitrary bytes to V2Transport | Ready | 0 | Crickets | 0 + 102 tests | |||
|
|
|
|
| |||
Reviewability: ReadyStalePaused Agreement: StrongPositivePositive w/ caveatsNeutralMildDisputedBlockedCrickets Reviews: current code-review ACKs, then (+stale ACKs) and -NACKs; greener = more ACKs. Size: lines added or modified outside tests, then in tests; greener = smaller. | |||||||
Goal
Adds the `p2p_transport_v2_receive` fuzz target to test BIP 324 `V2Transport` message reception. The target generates byte streams containing mixtures of arbitrary data and valid or bit-flipped handshake elements (keys, garbage, terminators, encrypted packets) and feeds them in arbitrary slice sizes to reach all receive states and failure transitions.
Problem: Existing fuzz targets do not feed malformed or arbitrary byte streams to `V2Transport` past the initial key exchange, leaving post-handshake BIP 324 receive state transitions and error handling under-tested against hostile peer traffic.
Evidence of importance:
- PR description: 'No fuzz target feeds V2Transport bytes that an honest peer would not send past the v2 key exchange.'
- Author reports running the target for 13 minutes under libFuzzer with ASan/UBSan without crashes, confirming it successfully exercises both accepted and rejected message handling paths.
Scope: Adds a single standalone fuzz target in `src/test/fuzz/p2p_transport_serialization.cpp`.
Risk of a mistake: low (tests). Only adds a new fuzzing target; no production or consensus code is touched.
Changed since the previous assessment: Now includes the complete patch implementing the `p2p_transport_v2_receive` fuzz target.
Reviewability
Ready
Nothing known that would invalidate a review now.
Waiting on (from the thread read):
- reviewer: uqlidi to review the changes in 984a01619e 2026-11-01
Agreement
Crickets
no substantive comment either way
Thread notes: fametrano addressed all review comments from uqlidi and updated the PR in 984a01619e.
Objections, suggestions, and questions:
| Reviewer | Type | Harm, request, or question | Status | Must be | Author replied | Quote |
|---|---|---|---|---|---|---|
| uqlidi (none) | suggestion, correctness | Assert that transport.GetInfo().session_id matches the peer session ID when transport_type is V2 | fixed · fix pushed · author implemented the session ID assert in 984a01619e | answered | yes | 2026-10-31: 'At that point its session id should match the peer's. Would an assert on that work?' Status from: 2026-11-01: fametrano: 'Once the transport reports v2, the target asserts that its session id matches the peer's' |
| uqlidi (none) | suggestion, approach | Add an action appending empty decoys so the fuzz target covers the transport rekey interval | fixed · fix pushed · author added empty decoys action in 984a01619e | answered | yes | 2026-10-31: 'Maybe add an action that appends a run of empty decoys? With the diff below, libFuzzer's coverage report shows this rekey branch hit' Status from: 2026-11-01: fametrano: 'a new action appends a run of empty decoys' |
Participants:
- uqlidi (none, question, 7 statements 2026-10-31 to 2026-10-31): suggested asserting session ID on V2 transport and adding decoy run action to hit rekey branch, along with several nits
Files
102 lines under test/bench/ci.
- src/test/fuzz/p2p_transport_serialization.cpp +102/-0
Card
The short text the ranking pass compares across PRs.
Adds the `p2p_transport_v2_receive` fuzz target to exercise BIP 324 `V2Transport` byte reception. Existing fuzz tests do not feed malformed or arbitrary byte streams past the initial key exchange, leaving transport error handling and receive state transitions under-tested. The author notes the target crafts streams containing arbitrary bytes mixed with corrupted handshake segments in variable slice sizes, reaching all receive states without crashes under ASan and UBSan.
Data
thread read through 2026-11-01 (8 statements), head 984a01619e
labels: Fuzzing
Categories
Test infrastructure
P2 · test coverage
Adds fuzz coverage for high-risk p2p message handling paths that fuzzers currently do not reach. The target exercises BIP 324 V2Transport receive states and error handling against arbitrary byte streams past the initial handshake, addressing an area directly targeted at hostile peer traffic.
Membership: Fuzzing label and adds a new fuzz harness in src/test/fuzz/p2p_transport_serialization.cpp
Factors: security/stability 1, bug 0, performance 0, user value 0, leverage 0