<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Bitcoinj — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/vendors/bitcoinj/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata. Fed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Wed, 03 Jul 2024 12:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/vendors/bitcoinj/feed.xml" rel="self" type="application/rss+xml"/><item><title>bitcoinj ScriptExecution P2PKH/P2WPKH Verification Bypass</title><link>https://feed.craftedsignal.io/briefs/2024-07-bitcoinj-script-bypass/</link><pubDate>Wed, 03 Jul 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-07-bitcoinj-script-bypass/</guid><description>A vulnerability in bitcoinj's ScriptExecution.correctlySpends() allows attackers to bypass signature verification for P2PKH and P2WPKH spends, potentially leading to unauthorized transaction validation.</description><content:encoded><![CDATA[<p>A critical vulnerability exists within the bitcoinj library, specifically affecting versions 0.15 to 0.17.0. The <code>ScriptExecution.correctlySpends()</code> function contains flawed fast-path verification logic for standard Pay-to-Public-Key-Hash (P2PKH) and native Pay-to-Witness-Public-Key-Hash (P2WPKH) spends. This flaw allows an attacker to construct a transaction using an arbitrary keypair that bitcoinj will incorrectly validate as legitimate. This bypass occurs because bitcoinj fails to properly verify that the public key used in the signature matches the one committed to by the output being spent. Applications relying on bitcoinj for transaction validation are at risk of accepting fraudulent transactions. The vulnerability was reported on May 8th, 2026 and patched in versions 0.17.1 and later.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>Attacker identifies a vulnerable application using bitcoinj library (versions 0.15 to 0.17.0) for transaction validation.</li>
<li>Attacker crafts a malicious transaction targeting a P2PKH or P2WPKH output of a victim.</li>
<li>For P2PKH, the attacker creates a <code>scriptSig</code> containing an arbitrary signature and public key. The signature is created using attacker&rsquo;s private key over victim&rsquo;s output.</li>
<li>For P2WPKH, the attacker creates a witness containing an arbitrary signature and public key. The signature is created using attacker&rsquo;s private key over victim&rsquo;s output.</li>
<li>Attacker submits the malicious transaction to the vulnerable application.</li>
<li>The application calls <code>ScriptExecution.correctlySpends()</code> for validation. Due to the flawed logic, the function verifies the attacker&rsquo;s signature against their public key but fails to validate the binding between the public key and the output being spent.</li>
<li>The vulnerable application incorrectly validates the transaction as legitimate due to successful signature verification, even though the attacker does not own the output.</li>
<li>The application processes the fraudulent transaction, leading to potential financial loss for the victim.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability allows attackers to bypass signature verification in bitcoinj-based applications. This can result in the acceptance of fraudulent transactions, leading to financial losses for affected users or services. The scope of impact depends on the number of applications relying on vulnerable versions of bitcoinj for transaction validation. While the specific number of victims is unknown, the potential for widespread abuse exists given the library&rsquo;s usage within the Bitcoin ecosystem.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade to bitcoinj version 0.17.1 or later to patch the vulnerability as mentioned in the <a href="https://github.com/advisories/GHSA-hfcf-v2f8-x9pc">GHSA advisory</a>.</li>
<li>Deploy the Sigma rule &ldquo;Detect BitcoinJ P2PKH Script Bypass&rdquo; to identify potential exploitation attempts in your environment.</li>
<li>Deploy the Sigma rule &ldquo;Detect BitcoinJ P2WPKH Script Bypass&rdquo; to identify potential exploitation attempts in your environment.</li>
<li>Review and audit any custom transaction validation logic that relies on <code>ScriptExecution.correctlySpends()</code> in affected applications.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>bitcoin</category><category>transaction-validation</category><category>script-execution</category><category>verification-bypass</category></item></channel></rss>