fuzz: Add a target that feeds arbitrary bytes to V2Transport #36635

pull fametrano wants to merge 1 commits into bitcoin:master from fametrano:fuzz-v2-transport-arbitrary-bytes changing 1 files +102 −0
  1. fametrano commented at 11:46 PM on October 23, 2026: none

    No fuzz target feeds V2Transport bytes that an honest peer would not send past the v2 key exchange. I add p2p_transport_v2_receive. It knows the keys of the transport it tests. It builds the input from arbitrary bytes and from the parts of a valid handshake: the peer key, garbage, the garbage terminator and encrypted packets, which may be corrupted. It feeds the input in pieces of arbitrary size. It reaches every v2 receive state and the failures on the way to them.

    I ran it for about 13 minutes in total from an empty corpus, with libFuzzer and the address and undefined sanitizers, and it found no crash. Replaying the corpus gets both accepted and rejected messages out of the transport.

    This is one of several PRs from a large audit of Bitcoin Core that I did with the help of LLM tools. The audit produced its evidence all at once, which is why the PRs arrive together. I understand each change fully and will answer review questions myself.

  2. fuzz: Add a target that feeds arbitrary bytes to V2Transport
    No fuzz target feeds V2Transport bytes that an honest peer would not
    send past the v2 key exchange.
    
    Add p2p_transport_v2_receive. It knows the keys of the transport it
    tests, and builds a byte stream from arbitrary bytes and from the parts
    of a valid handshake: the peer key, garbage, the garbage terminator and
    encrypted packets, which may be corrupted. The stream is received in
    pieces of arbitrary size. This reaches every v2 receive state, and the
    failures on the way to them.
    0b0fa362fe
  3. DrahtBot added the label Fuzzing on Oct 23, 2026
  4. DrahtBot commented at 11:46 PM on October 23, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #36074 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36074.svg"></sub> (scripted-diff: [test] Add util/check.h includes for assertions by maflcko)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

Contributors
Labels

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-10-30 15:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me