Closed feezybabee closed 10 months ago
Note that this attack works when two transactions are sent in different batches. But we should also cover the case where the duplicate inputs are used within the same batch.
Addressed in this PR: https://github.com/AleoHQ/snarkVM/pull/2229
https://hackerone.com/reports/2242904
Summary
An invalid
BatchPropose
can break the BFT and take down the networkSteps To Reproduce:
1.Use the normal snarkos to start 3 validators
2.Use the modified snarkos to start 1 malicious node.The malicious node will not check the transaction is valid or not, so it will pack a transaction which's input record has already been spent.
Branch: https://github.com/ghostant-1017/snarkOS/tree/test/uncheck
3.We create two transactions which's input records is the same one, and we broadcast it to the malicious node.
Like below:
4.Check the logs and we will see: https://cdn.jsdelivr.net/gh/ghostant-1017/img@main/img/image-20231107100525204.png
Proof-of-Concept (PoC)
BatchPropose
orBatchCertificate
, it will not check the transmissions are valid or not.update_dag
->commit_leader_certificate
->order_dag_with_dfs
https://github.com/AleoHQ/snarkOS/blob/3f845c1205d3e5e1731e33099d88970410e5b003/node/bft/src/bft.rs#L476
consensus_sender.tx_consensus_subdag.send((subdag, transmissions, callback_sender)).await?;
will callprocess_bft_subdag
->try_advance_to_next_block
->check_next_block
, since the block is invalid, the check will fail.https://github.com/AleoHQ/snarkOS/blob/3f845c1205d3e5e1731e33099d88970410e5b003/node/bft/src/bft.rs#L538
Additional Materials
Truncated logs: https://raw.githubusercontent.com/ghostant-1017/logs/master/validator_0_2023_11_07_02_35_00_2023_11_07_02_36_00.log
Impact
An invalid
BatchPropose
will be certificated and the relatedBatchCertificate
can break the BFT and take down the network