{"answers":{"affected":"3 open source packages ship an affected version, including github.com/btcsuite/btcd. It affects 1 product.","exploited":"There is no known exploitation of CVE-2024-38365 in the wild and no public exploit code.","fix":"Upgrade github.com/btcsuite/btcd to 0.24.2-beta.rc1 or later.","what":"CVE-2024-38365 is a high-severity vulnerability in btcsuite btcd, published on 11 Oct 2024. An attacker can exploit it over the internet without logging in, with no action from the victim."},"fix_prompt":"Check this codebase for CVE-2024-38365 and fix it if it is affected.\n\nWhat it is: CVE-2024-38365 is a high-severity vulnerability in btcsuite btcd, published on 11 Oct 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.\nExploitation: There is no known exploitation of CVE-2024-38365 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- github.com/btcsuite/btcd (Go): affected all versions; fixed in 0.24.2-beta.rc1\n- github.com/btcsuite/btcd (Go): affected all versions; fixed in 0.24.2-beta.rc1\n- github.com/btcsuite/btcd (Go): affected all versions; fixed in 0.24.2-beta.rc1\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2024-38365/ (Markdown: https://insights.sbomify.com/CVE-2024-38365/index.md)","id":"CVE-2024-38365","markdown":"https://insights.sbomify.com/CVE-2024-38365/index.md","name":"CVE-2024-38365","record":{"aliases":["CVE-2024-36051","GHSA-27vh-h6mc-q6g8","GO-2024-3189"],"analysis":{"component_type":"server_software","fix_type":"upgrade","impacts":["denial_of_service","other"],"network_reachable":"yes","non_default_config":false,"product_category":"Bitcoin full node","requires_auth":"none","summary":"Remote attackers can cause chain splits or denial of service in btcd nodes by exploiting a consensus logic error in script processing.","user_interaction":"not_required","vuln_class":"other"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[{"product":"btcd","vendor":"btcd_project"}],"cvss":{"score":7.4,"severity":"high","source":"cna","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:H","version":"3.1"},"cwes":[{"id":"CWE-670","name":"Always-Incorrect Control Flow Implementation"}],"description":"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 = \"\u003cdata\u003e \u003cdata||foo\u003e\"` and `dataToRemove = \"data\"` btcd will remove both data pushes but Bitcoin Core's `FindAndDelete` only removes the first `\u003cdata\u003e` push. This has been patched in btcd version v0.24.2. Users are advised to upgrade. There are no known workarounds for this issue.","ecosystems":["Go"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"none_known"},"has_fix":true,"headline":"btcd did not correctly re-implement Bitcoin Core's \"FindAndDelete()\" functionality","id":"CVE-2024-38365","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"Go","product":null,"products":[],"type":"other","year":"2024"},"n_packages":3,"n_references":4,"next":{"headline":"CoacoaPods trunk RCE in email verification system rfc-822","id":"CVE-2024-38366"},"packages":[{"ecosystem":"Go","fixed":["0.24.2-beta.rc1"],"introduced":["0"],"last_affected":[],"package":"github.com/btcsuite/btcd","purl":null,"source":"GHSA-27vh-h6mc-q6g8"},{"ecosystem":"Go","fixed":["0.24.2-beta.rc1"],"introduced":["0"],"last_affected":[],"package":"github.com/btcsuite/btcd","purl":"pkg:golang/github.com/btcsuite/btcd","source":"GHSA-27vh-h6mc-q6g8"},{"ecosystem":"Go","fixed":["0.24.2-beta.rc1"],"introduced":["0"],"last_affected":[],"package":"github.com/btcsuite/btcd","purl":"pkg:golang/github.com/btcsuite/btcd","source":"GO-2024-3189"}],"prev":{"headline":"DSpace Cross Site Scripting (XSS) via a deposited HTML/XML document","id":"CVE-2024-38364"},"products":["btcd"],"published":"2024-10-11","related":[{"cvss_score":9.8,"headline":"btcd mishandles witness size checking","id":"CVE-2022-44797","kev_date_added":null,"published":"2022-11-07"},{"cvss_score":8.2,"headline":"Witness Block Parsing DoS Vulnerability in lnd","id":"CVE-2022-39389","kev_date_added":null,"published":"2022-11-17"},{"cvss_score":7.5,"headline":"btcd susceptible to consensus failures","id":"CVE-2024-34478","kev_date_added":null,"published":"2024-05-05"}],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"CC BY 4.0","name":"Go Vulnerability Database","prefix":"GO"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":"no","exploitation":"none","technical_impact":"partial"},"state":"PUBLISHED","updated":"2024-10-11","vendors":["btcsuite"]},"summary":"Remote attackers can cause chain splits or denial of service in btcd nodes by exploiting a consensus logic error in script processing.","url":"https://insights.sbomify.com/CVE-2024-38365/"}