Front running initial account data distribution
The message handler for initial account data distribution lacks verification of incoming messages, allowing a malicious validator to send wrong initial account balances before transaction execution. This lets the malicious validator control the final balance after a coin transfer, causing direct loss of funds.
Originally disclosed on Immunefi
- Disclosed after under an hour
33151 - [BC - Critical] Front running initial account data distribution
Submitted on Jul 12th 2024 at 21:44:47 UTC by @doxtopzhivago for Boost | Shardeum: Core
Report ID: #33151
Report type: Blockchain/DLT
Report severity: Critical
Target: https://github.com/shardeum/shardus-core/tree/dev
Impacts:
- Direct loss of funds
Description
Brief/Intro
Sending wrong initial account data information at the beginning of transaction processing can cause loss of account balance.
Vulnerability Details
The message handler 'broadcast_state_complete_data' is lacking incoming message verification, as a result it is possible to frontrun initial account data distribution in a way so it will be possible to have a full control over the amount of the final balance after transaction (before transaction execution validators are exchanging initial account data between each other). When transaction is received by malicious validator it will immediately send internal message 'broadcast_state_complete_data' to the validators in transaction group with the wrong initial account balance of the crypto coin transfer source address. Execution group validators will use this wrong initial account data in transaction execution and provide result of coin transfer based on it. Transaction will be successfully executed and completed. This will work only if malicious validator is participating in transaction group.
Impact Details
Full control of the initial account balance for transactions where malicious validator is participating in transaction group.
References
Link to the internal message handler: https://github.com/shardeum/shardus-core/blob/4d75f797a9d67af7a94dec8860220c4e0f9ade3c/src/state-manager/TransactionQueue.ts#L323
Proof of Concept
I’ve added callbacks before transaction gets in the processing queue and after processing is successfully completed. For POC I’ve used malicious validator which is removing some constant (1eth) amount from initial account balance for the source account of the coin transfer. Patch should be applied only for malicious validator shardeum-core repository.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the internal message handler 'broadcast_state_complete_data' does not verify that the sender is authorised or that the data is correct before validators use it.
Impact
A malicious validator could fully control the initial account balance for transactions it participates in, leading to direct loss of funds.
What the attacker needed
Malicious validator in the transaction group
How it was found
- A malicious validator receives a transaction.
- It immediately sends the internal message 'broadcast_state_complete_data' to the validators in the transaction group with a wrong initial account balance for the source address.
- The execution group validators use this wrong initial account data when executing the transaction.
- The transaction completes successfully based on the wrong balance.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Validators are computers that check transactions in a blockchain. Before running a transaction, they share the starting account balances with each other. This report says a bad validator can send a fake starting balance, so the transaction runs with wrong numbers and money is lost.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.