Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
📦 npm
Not in CISA KEV

GHSA-wg2x-rv86-mmpx @keep-network/tbtc-v2

Fix: keep-network/tbtc-v2@20a6fb1

GHSA-wg2x-rv86-mmpx is a security vulnerability in @keep-network/tbtc-v2. A fix is available for @keep-network/tbtc-v2 — see the affected versions and patch details below.

SPV Merkle proof malleability allows the maintainer to prove invalid transactions

Published
Jan 19, 2024
Updated
Jan 19, 2024
Affected
1 pkg
Patched
1 / 1
Exploits
None indexed
Exploitation data as of Jan 19, 2024 · OSV.dev, FIRST.org (EPSS)

Real-World Exposure

1 pkg affected

How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.

5other npm packages depend on this — each one inherits the vulnerability until it's patched upstream
@keep-network/tbtc-v2npm
885downloads / week

Description

Summary

By publishing specially crafted transactions on the Bitcoin blockchain, the SPV maintainer can produce seemingly valid SPV proofs for fraudulent transactions.

The issue was originally identified by Least Authority in the tBTC Bridge V2 Security Audit Report as Issue B: Bitcoin SPV Merkle Proofs Can Be Faked. A mitigation was believed to have been in place, but this turned out to contain an error, and the issue had not been effectively mitigated.

Details

This is achieved by creating a 64-byte transaction that the fraudulent transaction treats as a node in its merkle proof:

The attacker creates the malicious transaction E and calculates an unusual but valid transaction D, so that the last 32 bytes of D are a part of the merkle proof of E:

D = foo | hash256(E')
E' = bar | hash256(E)

foo and bar are arbitrary 32-byte values selected to facilitate this attack.

The attacker can then publish D and wait for it to be mined. A valid SPV proof for D can then be transformed into a proof for E by prepending bar and foo to the merkle proof, and changing the transaction index into one matching E's implied position in the merkle tree.

Calculating a suitable value for E' has been estimated to require between 2^60 to 2^81 operations. By contrast, the current Bitcoin hashrate is approximately 2^69. Thus the cost of performing the requisite brute-force is at most similar to, or possibly up to 1,000,000 times lower than, the cost of mining 6 Bitcoin blocks at the current difficulty.

Impact

The vulnerability does not enable the SPV maintainer to do anything they would not have been able to do otherwise. However, the ability to bypass the need to mine 6 blocks at the current difficulty makes abusing the SPV maintainer position significantly cheaper.

Patches

Adding the coinbase transaction and its merkle proof into the SPV proofs prevents this issue, by increasing the brute-force required to 2^224. If the length of the coinbase proof matches the length of the transaction proof, and both proofs are valid for the same header, we can trust that the exploit has not been abused for the transaction.

Workarounds

The trusted SPV maintainer position prevents this issue

References

Weaknesses in Bitcoin’s Merkle Root Construction

Leaf-Node weakness in Bitcoin Merkle Tree Design

SPV proof verification vulnerable to potential (but expensive to exploit) Merkle tree problem #192

tBTC Bridge V2 Security Audit Report

Affected Packages

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
📦npm@keep-network/tbtc-v2all versions1.5.2npm install @keep-network/tbtc-v2@1.5.2

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for @keep-network/tbtc-v2, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update @keep-network/tbtc-v2 to 1.5.2 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-wg2x-rv86-mmpx is resolved across your whole dependency graph.

  3. Workarounds

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

  4. How O3 protects you

    O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like GHSA-wg2x-rv86-mmpx can be triaged on real exposure rather than presence alone.

Tailored to GHSA-wg2x-rv86-mmpx. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Frequently Asked Questions

## Summary By publishing specially crafted transactions on the Bitcoin blockchain, the SPV maintainer can produce seemingly valid SPV proofs for fraudulent transactions. The issue was originally identified by Least Authority in the tBTC Bridge V2 Security Audit Report as _Issue B: Bitcoin SPV Merkle Proofs Can Be Faked_. A mitigation was believed to have been in place, but this turned out to contain an error, and the issue had not been effectively mitigated. ### Details This is achieved by creating a 64-byte transaction that the fraudulent transaction treats as a node in its merkle proof: T
O3 Security · Impact-Aware SCA

Is GHSA-wg2x-rv86-mmpx in your dependencies?

O3 Security finds GHSA-wg2x-rv86-mmpx across npm dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.

GHSA-wg2x-rv86-mmpx: @keep-network/tbtc | O3 Security