Monitor vulnerabilities like this one.
Sign up free to get alerted when software you use is affected.
7.5
TBTC V2: Malicious Bitcoin Transaction Can Cause Insolvency
GHSA-8986-v76q-8vr2
Summary
A bug in the TBTC V2 system can cause the protocol to run out of funds due to a specific type of Bitcoin transaction. This bug does not allow attackers to steal funds directly, but it can lead to the protocol's insolvency. To fix this, the team is pausing optimistic minting, deploying a new smart contract, and upgrading the system after a 24-hour delay.
What to do
- Update keep-network tbtc-v2 to version 1.8.2.
Affected software
| Vendor | Product | Affected versions | Fix available |
|---|---|---|---|
| keep-network | tbtc-v2 | <= 1.8.1 | 1.8.2 |
Original title
@keep-network/tbtc-v2 revealing P2PKH deposit with a wrapped P2SH script
Original description
# 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.
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 CVSS3.1
7.5
Vulnerability type
CWE-328
Published: 2 Mar 2026 · Updated: 7 Mar 2026 · First seen: 6 Mar 2026