test: add a tx_valid vector for CVE-2024-38365 #35873

pull jeanpablojp wants to merge 1 commits into bitcoin:master from jeanpablojp:test-cve-2024-38365-vector changing 1 files +7 −0
  1. jeanpablojp commented at 10:30 PM on August 3, 2026: contributor

    Suggested by @darosior in #35835.

    FindAndDelete only matches whole pushes at opcode boundaries, so a push that carries the signature inside its data is left in the scriptCode. btcd (<0.24.2) removed any push containing the signature, computed a different sighash, and would have rejected a transaction Core accepts: the chain split described in CVE-2024-38365.

    We already cover the rule from the failure side: script_FindAndDelete has the "doesn't match 'inside' opcodes" cases, and tx_invalid.json has the vectors where the signature is duplicated under a non-standard pushdata prefix. What was missing is the positive direction, a transaction Core must accept because nothing is deleted.

    This adds one vector to tx_valid.json. The P2SH redeemScript is OP_CHECKSIGVERIFY <0xaaaa||sig>, spent with <sig> <pubkey> <redeemScript>, using the minimal 8-byte DER signature (r = s = 1). The pubkey is recovered from that signature and the sighash Core computes, so the signature verifies only if the <0xaaaa||sig> push survives into the scriptCode. Note that CONST_SCRIPTCODE doesn't fire here: FindAndDelete finds nothing, and the vector holds with every flag applied.

    To check the vector actually discriminates, I patched EvalChecksigPreTapscript to drop any push whose data contains the signature, the way btcd did. The vector fails with that patch applied and passes without it.

    Tested with:

    cmake --build build --target test_bitcoin
    build/bin/test_bitcoin --run_test=transaction_tests
    
  2. test: add a tx_valid vector for CVE-2024-38365 6cd2fa5fb4
  3. DrahtBot added the label Tests on Aug 3, 2026
  4. DrahtBot commented at 10:30 PM on August 3, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. DrahtBot added the label CI failed on Aug 4, 2026
  6. DrahtBot commented at 10:04 AM on August 4, 2026: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task riscv32 bare metal, static libbitcoin_consensus: https://github.com/bitcoin/bitcoin/actions/runs/30858909155/job/91944243247</sub> <sub>LLM reason (✨ experimental): CI failed because the binutils-gdb submodule clone into /riscv/gcc/binutils failed (fatal git clone error, exit code 2).</sub>

    <details><summary>Hints</summary>

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

    </details>

  7. DrahtBot closed this on Aug 4, 2026

  8. DrahtBot reopened this on Aug 4, 2026

  9. DrahtBot removed the label CI failed on Aug 4, 2026

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-08-11 09:51 UTC

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