delvingbitcoin

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

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

Original Postby ariard

Posted on: October 15, 2024 03:35 UTC

In the realm of Bitcoin scripting, the signature mechanism does not necessitate a commitment to the scriptCode when employing OP_CODESEPARATOR for transactions pre-segwit.

This is elucidated through a sequence where a data push comprising the signature is followed by the placement of this signature on the stack. Subsequently, an OP_CODESEPARATOR is introduced before the execution of OP_CHECKSIG. The pivotal point here is the role of pbegincodehash, which, in such scenarios, determines that the scriptCode should exclusively encompass the OP_CHECKSIG operation. This specification suggests a streamlined approach, rendering OP_CHECKSIG as a fixed point in the verification process.

Furthermore, the operational mechanics within the Bitcoin Core's handling of OP_CHECKSIG reveal its functionality of removing both the signature and pubkey from the stack. This operation underscores the distinctive behavior of OP_CODESEPARATOR, which effectively acts as a null operation on the script stack. Such insights into the internals of Bitcoin scripting highlight the nuanced understanding required to grasp the implications of script execution and verification processes, particularly in the context of legacy transaction mechanisms predating SegWit's implementation.