#38392 [BC-High] Signer can steal STX tokens in multi-sign wallet by setting a high stacks tx fee
Submitted on Jan 2nd 2025 at 10:52:58 UTC by @f4lc0n for Attackathon | Stacks
Report ID: #38392
Report Type: Blockchain/DLT
Report severity: High
Target: https://github.com/stacks-network/sbtc/tree/immunefi_attackaton_0.9/signer
Impacts:
Direct loss of funds
Description
Brief/Intro
When a signer acts as a coordinator, it will initiate some sBTC stacks contract calls. And he can set the tx fee for these contract calls. These tx fees will be rewarded to the miners of the stacks chain.
The problem now is that signers do not check the tx fee set by the coordinator. Therefore, a malicious signer can set a very large tx fee to reward the multi-sign wallet's STX to the stacks miner. And he can cooperate with the stacks miner to steal this amount of funds.
Vulnerability Details
The signer/src/transaction_signer.rs::handle_stacks_transaction_sign_request
code is as follow.
In the above code, it does not do any check on request.tx_fee
. Therefore, a malicious signer can set any tx_fee
, and all other signers will agree to this tx_fee
.
Impact Details
It will cause signers multi-signature wallets to lose STX tokens.
If the malicious signer and miner cooperate, the malicious signer can benefit from it.
References
None
Proof of Concept
Proof of Concept
Base on: https://github.com/stacks-network/sbtc/releases/tag/0.0.9-rc4
Patch
signer/src/config/mod.rs
, add attacker flag configPatch
signer/src/main.rs
, load attacker flagPatch
docker/docker-compose.yml
, add attacker flagPatch
signer/src/transaction_coordinator.rs
, add attack actionRun docker
This PoC sets sbtc-signer-3 as an attacker, which will automatically attack if it is the coordinator
Keep running the demo until the trigger the coordinator is sbtc-signer-3. You can observe the log of sbtc-signer-3. When
"@audit; attacker set large tx fee"
appears, it is triggered.Track the transaction initiated by sbtc-signer-3 on explorer, and you will find that it consumes a lot of STX
Was this helpful?