{"id":"CVE-2024-38365","published":"2024-10-11T19:32:12Z","modified":"2024-10-11T19:48:30Z","title":"btcd did not correctly re-implement Bitcoin Core's \"FindAndDelete()\" functionality","vendor":"btcsuite","product":"btcd","tier":"tail","description":{"text":"btcd is an alternative full node bitcoin implementation written in Go (golang). The btcd Bitcoin client (versions 0.10 to 0.24) did not correctly re-implement Bitcoin Core's \"FindAndDelete()\" functionality. This logic is consensus-critical: the difference in behavior with the other Bitcoin clients can lead to btcd clients accepting an invalid Bitcoin block (or rejecting a valid one). This consensus failure can be leveraged to cause a chain split (accepting an invalid Bitcoin block) or be exploited to DoS the btcd nodes (rejecting a valid Bitcoin block). An attacker can create a standard transaction where FindAndDelete doesn't return a match but removeOpCodeByData does making btcd get a different sighash, leading to a chain split. Importantly, this vulnerability can be exploited remotely by any Bitcoin user and does not require any hash power. This is because the difference in behavior can be triggered by a \"standard\" Bitcoin transaction, that is a transaction which gets relayed through the P2P network before it gets included in a Bitcoin block. `removeOpcodeByData(script []byte, dataToRemove []byte)` removes any data pushes from `script` that contain `dataToRemove`. However, `FindAndDelete` only removes exact matches. So for example, with `script = \"<data> <data||foo>\"` and `dataToRemove = \"data\"` btcd will remove both data pushes but Bitcoin Core's `FindAndDelete` only removes the first `<data>` push. This has been patched in btcd version v0.24.2. Users are advised to upgrade. There are no known workarounds for this issue.","provenance":"source","from":"CVE.org"},"cvss":{"score":7.4,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.01007,"percentile":0.63851,"provenance":"source"},"cwes":[{"id":"CWE-670","name":"Always-Incorrect Control Flow Implementation"}],"references":[{"url":"https://github.com/btcsuite/btcd/security/advisories/GHSA-27vh-h6mc-q6g8","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/btcsuite/btcd/commit/04469e600e7d4a58881e2e5447d19024e49800f5","tags":["x_refsource_MISC"]},{"url":"https://delvingbitcoin.org/t/cve-2024-38365-public-disclosure-btcd-findanddelete-bug/1184","tags":["x_refsource_MISC"]},{"url":"https://github.com/btcsuite/btcd/releases/tag/v0.24.2","tags":["x_refsource_MISC"]}],"priority":{"score":18.0,"factors":[{"name":"EPSS percentile","points":12.77},{"name":"CVSS severity","points":5.18}]},"vendorSlug":"btcsuite","affectedVersions":[{"vendor":"btcsuite","product":"btcd","versions":[">= 0.10.0, < 0.24.2"]}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"partial","timestamp":"2024-10-11T19:46:36.694476Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"Go","package":"github.com/btcsuite/btcd","vulnerableRanges":["<0.24.2-beta.rc1"],"patched":["0.24.2-beta.rc1"],"from":["GHSA-27vh-h6mc-q6g8","GO-2024-3189"],"provenance":"source"}],"summary":{"text":"The btcd Bitcoin full node implementation (versions 0.10 through 0.24) incorrectly re-implements Bitcoin Core's FindAndDelete() logic, which is consensus-critical, so its handling of data pushes in scripts differs from Bitcoin Core's. A remote attacker with no special network position, authentication, user interaction or hash power can exploit this by relaying a standard transaction over the P2P network, causing btcd to compute a different sighash and either accept an invalid block (enabling a chain split) or reject a valid one (denial of service).","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T20:35:55Z"},"euvd":{"id":"EUVD-2024-2904","exploited":false,"provenance":"source"},"lineage":{"packageHistory":[{"cve":"CVE-2022-44797","published":"2022-11-07","fixed":"0.23.2","kev":false},{"cve":"CVE-2024-34478","published":"2024-05-05","fixed":"0.24.0","kev":false,"link":{"from":"CVE-2024-34478","to":"CVE-2024-38365","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"Go:github.com/btcsuite/btcd","fromFixed":"0.24.0","toFixed":"0.24.2-beta.rc1","daysApart":159}]}},{"cve":"CVE-2024-38365","published":"2024-10-11","fixed":"0.24.2-beta.rc1","kev":false}],"package":"Go:github.com/btcsuite/btcd"}}