GHSA-8986-v76q-8vr2: @keep network/tbtc v2 @keep-network/tbtc-v2 Revealing P2PKH Deposit With Vulnerability

HIGH
CVSS 7.5
CWE-328
Published
Advisory Summary

GHSA-8986-v76q-8vr2 is a HIGH (CVSS 7.5) @keep-network/tbtc-v2 revealing p2pkh deposit with vulnerability (CWE-328: Use of Weak Hash) affecting @keep network/tbtc v2 libraries in the npm ecosystem. The issue involves @keep-network/tbtc-v2 revealing p2pkh deposit with a wrapped p2sh script. Remediation is available by upgrading affected packages to version 1.8.2.

GHSA-8986-v76q-8vr2 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-8986-v76q-8vr2
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-328: Use of Weak Hash
Affected Product @keep network/tbtc v2
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix GHSA-8986-v76q-8vr2

To remediate this vulnerability, upgrade all affected @keep network/tbtc v2 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@keep-network/tbtc-v2 fixed: 1.8.2
npm install @keep-network/tbtc-v2@1.8.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @keep-network/tbtc-v2

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-8986-v76q-8vr2, inspect your project dependencies using npm:

npm ls @keep-network/tbtc-v2

Analyze the terminal output to locate any version of @keep network/tbtc v2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.8.2), your application is affected.

Note: The npm ls @keep-network/tbtc-v2 command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-328: Use of Weak Hash, where the product uses an algorithm that produces a digest (output value) that does not meet security expectations for a hash function that allows an adversary to reasonably determine the original input (preimage attack), find another input that can produce the same hash (2nd preimage attack), or find multiple inputs that evaluate to the same hash (birthday attack). In @keep network/tbtc v2, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

# Overview P2PKH has 20 bytes just like P2SH. We protect against revealing P2PKH deposits by manually assembling the expected P2SH script in the smart contract and comparing hashes. However, we missed the case when the attacker embeds a valid P2SH inside of P2PKH as an output script. bitcoin-spv library [extracts the P2SH from P2PKH](https://github.com/keep-network/bitcoin-spv/blob/856849612ef49114af18c0f407eaa74afc2ee4be/solidity/contracts/BTCUtils.sol#L610-L612) and we treat it as a valid P2SH output. This does not lead to stealing funds but can lead to protocol insolvency. The off-chain client handles this case correctly, but the problem is in the optimistic minting bot. The bot assumes that if the funding TX exists on Bitcoin with the right amount and it was successfully revealed, the transaction is valid. https://bugs.immunefi.com/magnus/672/projects/502/bug-bounty/reports/55982 # Steps Since there is a 24-hour governance delay on upgrading the Bridge smart contract, we are going to pause optimistic minting. 1. Pause optimistic minting. 2. Deploy new Bridge implementation with Deposit library containing a fix, WITHOUT VERIFYING THE CODE on Etherscan. 3. Schedule upgrade transaction. 4. After 24 hours, finalize upgrade. 5. Unpause optimistic minting.

GHSA-8986-v76q-8vr2 Affected @keep network/tbtc v2 Versions

1 component(s)
Fixed Versions:
1.8.2
Product / Package Ecosystem Affected Versions Fixed Version
@keep-network/tbtc-v2
npm
< 1.8.2
1.8.2

References

Frequently Asked Questions

What is GHSA-8986-v76q-8vr2?
GHSA-8986-v76q-8vr2 is a security vulnerability in @keep network/tbtc v2 involving @keep-network/tbtc-v2 revealing P2PKH deposit with a wrapped P2SH script under CWE-328: Use of Weak Hash.
Which @keep network/tbtc v2 versions are affected?
Affected versions include releases prior to 1.8.2 across affected packages: @keep-network/tbtc-v2.
What version fixes GHSA-8986-v76q-8vr2?
Upgrading to 1.8.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @keep-network/tbtc-v2 affected?
Yes, @keep-network/tbtc-v2 is affected in releases prior to 1.8.2. Upgrade your dependency to 1.8.2 or later.
What is the CVSS score of GHSA-8986-v76q-8vr2?
GHSA-8986-v76q-8vr2 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with GHSA-8986-v76q-8vr2?
GHSA-8986-v76q-8vr2 is classified under CWE-328: Use of Weak Hash (The product uses an algorithm that produces a digest (output value) that does not meet security expectations for a hash function that allows an adversary to reasonably determine the original input (preimage attack), find another input that can produce the same hash (2nd preimage attack), or find multiple inputs that evaluate to the same hash (birthday attack).).
How can I check npm dependencies for GHSA-8986-v76q-8vr2?
Run the dependency tree command: 'npm ls @keep-network/tbtc-v2'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-8986-v76q-8vr2",
  "modified" : "2026-03-02T22:09:19Z",
  "published" : "2026-03-02T22:09:19Z",
  "aliases" : [ ],
  "summary" : "@keep-network/tbtc-v2 revealing P2PKH deposit with a wrapped P2SH script",
  "details" : "# Overview\n\nP2PKH has 20 bytes just like P2SH. We protect against revealing P2PKH deposits by manually assembling the expected P2SH script in the smart contract and comparing hashes. However, we missed the case when the attacker embeds a valid P2SH inside of P2PKH as an output script. bitcoin-spv library [extracts the P2SH from P2PKH](https://github.com/keep-network/bitcoin-spv/blob/856849612ef49114af18c0f407eaa74afc2ee4be/solidity/contracts/BTCUtils.sol#L610-L612) and we treat it as a valid P2SH output.\n\nThis does not lead to stealing funds but can lead to protocol insolvency.\n\nThe off-chain client handles this case correctly, but the problem is in the optimistic minting bot. The bot assumes that if the funding TX exists on Bitcoin with the right amount and it was successfully revealed, the transaction is valid.\n\nhttps://bugs.immunefi.com/magnus/672/projects/502/bug-bounty/reports/55982\n\n# Steps\n\nSince there is a 24-hour governance delay on upgrading the Bridge smart contract, we are going to pause optimistic minting.\n\n1. Pause optimistic minting.\n2. Deploy new Bridge implementation with Deposit library containing a fix, WITHOUT VERIFYING THE CODE on Etherscan.\n3. Schedule upgrade transaction.\n4. After 24 hours, finalize upgrade.\n5. Unpause optimistic minting.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@keep-network/tbtc-v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.8.2"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.8.1"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/threshold-network/tbtc-v2/security/advisories/GHSA-8986-v76q-8vr2"
  }, {
    "type" : "WEB",
    "url" : "https://bugs.immunefi.com/magnus/672/projects/502/bug-bounty/reports/55982"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/keep-network/bitcoin-spv/blob/856849612ef49114af18c0f407eaa74afc2ee4be/solidity/contracts/BTCUtils.sol#L610-L612"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/threshold-network/tbtc-v2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-328" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-02T22:09:19Z",
    "nvd_published_at" : null
  }
}