#38160 [BC-Insight] Governance calling `sbtc-registry.update-protocol-contract` may cause Stacks' ev
Submitted on Dec 26th 2024 at 14:52:55 UTC by @f4lc0n for Attackathon | Stacks
Report ID: #38160
Report Type: Blockchain/DLT
Report severity: Insight
Target: https://github.com/stacks-network/sbtc/tree/immunefi_attackaton_0.9/signer
Impacts:
Permanent freezing of funds (fix requires hardfork)
API crash preventing correct processing of deposits
Description
Brief/Intro
The /new_block api of Signer receives each block of Stacks and reads the events in it. It will receive the following events from sbtc-registry contract:
completed-depositwithdrawal-acceptwithdrawal-createwithdrawal-rejectkey-rotation
However, the /new_block api does not handle the event of update-protocol-contract emited by the sbtc-registry contract. Once Governance calls sbtc-registry.update-protocol-contract, the /new_block api will throw a ClarityUnexpectedEventTopic error and skip processing the block. If the block contains other events (such as users' withdrawal-create event), all events will be skipped.
Vulnerability Details
The signer/src/api/new_block.rs::new_block_handler code is as follows.
If RegistryEvent::try_new returns an error, the /new_block api will directly return StatusCode::OK and skip processing the Stacks block.
The signer/src/stacks/events.rs::try_new code is as follows.
If the event topic is update-protocol-contract, it will throw a ClarityUnexpectedValue error.
Then, once Governance calls sbtc-registry.update-protocol-contract and emits an update-protocol-contract, all events of the block will be skipped.
Impact Details
Signer may ignore some events from Stacks. The specific impacts are as follows:
If it not receive a
withdrawal-createevent, the Signer will not process the user's withdrawal request. The user’s sBTC will be frozen unless the signers manually process the withdrawal.If it not receive a
key-rotationevent, the Signer will not receive the newrotate_key. Then the Signer will process the deposits.
Since it freezes the user's funds, but it is temporary, I consider this a Medium.
References
None
Proof of Concept
Proof of Concept
Add this test case into signer/src/api/new_block.rs file.
Run the test case:
Result:
Last updated
Was this helpful?