CVE-2024-38365 public disclosure (btcd `FindAndDelete` bug)

Oct 10 - Feb 27, 2025

  • The discussion primarily focuses on the nuances of Bitcoin scripting, particularly regarding the `FindAndDelete` function and its implications for transaction script execution.

It elucidates that FindAndDelete modifies a copy of the script for the purpose of sighash commitment without altering the executed script itself. This process involves removing elements like stack and pubkey post-OP_CHECKSIG or OP_CHECKMULTISIG executions. The conversation highlights an initial confusion over the extent to which FindAndDelete and its btcd equivalent, removeOpcodeByData, remove data pushes from the script, clarifying that removal ceases at the current OP_CHECKSIG, thus not affecting subsequent data pushes within the script.

Furthermore, the discussion delves into the complexities surrounding the removeOpcodeByData function in btcd, noting significant deviations from expected behavior and detailing extensive checks and re-tests of OP_CODESEPARATOR behaviors. These insights are deemed vital enough for private sharing, indicating nuanced understanding of OP_CODESEPARATOR operations and their implications in specific contexts. The discourse also covers the critical role of signature validity in scripting discrepancies between btcd and Bitcoin Core, particularly how these differences can trigger divergent script executions. The importance of public key recovery in achieving distinct outcomes is emphasized, alongside theoretical divergences in handling commands like OP_EQUALVERIFY combined with CHECKSIG.

Additionally, the significance of OP_CODESEPARATOR in SegWit transactions is detailed, illustrating how this operation allows for signature extraction from the scriptCode, thereby mitigating potential vulnerabilities associated with FindAndDelete. This aspect highlights the security layers inherent in Bitcoin's scripting design, ensuring transaction integrity against certain exploits. The narrative further explores the application of OP_CODESEPARATOR in pre-SegWit transactions and its impact on the scriptCode verification process, emphasizing the streamlined approach facilitated by pbegincodehash in determining the script code's content during OP_CHECKSIG operations.

The email also addresses a sophisticated understanding of script manipulation possibilities that could affect consensus and network integrity, including an exploration of using stack inspection operations to achieve outcomes without public key recovery. This suggests a deep comprehension of potential vulnerabilities in script handling and validation processes across different node versions.

In terms of community contributions and security improvements, the email mentions a documented Bitcoin Core unit test developed as a patch capable of generating specific transactions, shared privately due to concerns over facilitating malicious use by unskilled individuals. This cautious approach underscores the balancing act between transparency and security in the dissemination of potentially sensitive information.

Niklas Gögge and Antoine Poinsot's discovery of a significant flaw in Btcd software prior to version 0.24.2 is highlighted, marking a deviation from Bitcoin Core's legacy signature verification consensus rules. Their findings, which concerned the handling of ECDSA signatures and dummy data by consensus nodes, led to a coordinated effort to address and resolve the vulnerability, culminating in the release of Btcd version 0.24.2. This resolution process involved meticulous investigation, reporting, and collaboration, ultimately recognized through a bug bounty award and transparently disclosed to the community, showcasing a commendable commitment to maintaining network security and integrity.

Bitcoin Logo

TLDR

Join Our Newsletter

We’ll email you summaries of the latest discussions from authoritative bitcoin sources, like bitcoin-dev, lightning-dev, and Delving Bitcoin.

Explore all Products

ChatBTC imageBitcoin searchBitcoin TranscriptsSaving SatoshiBitcoin Transcripts Review
Built with 🧡 by the Bitcoin Dev Project
View our public visitor count

We'd love to hear your feedback on this project?

Give Feedback