#37814 [BC-High] Signers can crash other signers by sending an invalid `DkgPrivateShares` due to missing check before passing the payload to `SignerStateMachine::process`
Submitted on Dec 16th 2024 at 16:26:55 UTC by @n4nika for Attackathon | Stacks
Report ID: #37814
Report Type: Blockchain/DLT
Report severity: High
Target: https://github.com/stacks-network/sbtc/tree/immunefi_attackaton_0.9/signer
Impacts:
Network not being able to confirm new transactions (total network shutdown)
Description
Summary
Signers do not verify received DkgPrivateShares
payloads enough, allowing any signer to send such a payload with a share
containing an empty bytes
object, which will cause the signer to crash due to an OOB read in the wsts
library.
Finding Description
When a signer receives a DkgPrivateShares
message, they process the received message without doing much verification of the message:
transaction_signer.rs::handle_wsts_message
In relay_message
, the msg.inner
gets passed to process
:
After a few steps, this then calls wsts::dkg_private_shares
which calls wsts::decrypt
:
Here key
and data
are passed and taken from the DkgPrivateShares
message without validation. Since there is no validation, the slicings will cause the program to crash since it accesses OOB memory.
Impact
Since DkgPrivateShares
messages are accepted by any signer and not only the coordinator, this allows ANY signer in the signer set to crash all other signers, causing a complete network shutdown.
Mitigation
Consider verifying the validity of received wsts payloads either in the signer itself or the wsts
library.
Proof of Concept
PoC
In this PoC I simulate sending such a malformed payload.
Please apply the following diff and execute the test with cargo test --package signer --test integration -- transaction_coordinator::sign_bitcoin_transaction --exact --show-output --ignored --nocapture
. This will crash at <PATH>/.cargo/git/checkouts/wsts-deb3c7c6853b6eab/ebd7d77/src/util.rs:66:25
.
Was this helpful?