Complete shutdown of the transaction processing
The handler for an internal message did not limit the number of account IDs it processed, and it held a lock also used by transaction processing. An attacker could send a large list of random accounts to slow or stop transaction processing on a node or across the network.
Originally disclosed on Immunefi
- Disclosed after under an hour
33655 - [BC - Critical] Complete shutdown of the transaction processing...
Submitted on Jul 25th 2024 at 22:31:08 UTC by @doxtopzhivago for Boost | Shardeum: Core
Report ID: #33655
Report type: Blockchain/DLT
Report severity: Critical
Target: https://github.com/shardeum/shardus-core/tree/dev
Impacts:
- Network not being able to confirm new transactions (total network shutdown)
Description
Brief/Intro
The handler of the internal message 'binary/get_account_data_with_queue_hints' can cause transaction processing queue blocking because of the sharing the same locking mechanism.
Vulnerability Details
The handler of the internal message 'binary/get_account_data_with_queue_hints' is not setting correct bounds for length of the accounts list (Actually it is 2^32). For each account the handler is executing app.getAccountDataByList which is calling AccountStorage.getAccount -> getAccountEntry -> creates and runs SQL query for each account ID. Also the handler is creating fifoLock('accountModification') which is used in the following functions: preApplyTransaction and commitConsensedTransaction. Which are two critical functions for transaction processing. If this fifoLock is occupied by this handler, transaction processing will be slowed down or even stopped. So by sending a big list (2^32) of random accounts it can create a significant delay in transaction processing on the single node.
It also can be scaled so that whole network performance will fall down:
For incomming messages there is no check that remote IP address belongs to the node, only verification by signature. So private key from single standby node can be used by multiple senders.
In case of mass sending from multiple senders to all validators (list is open) attacker can completely stop transaction processing or significantly slow it down because the fifoLock is shared between transaction processing flow and the handler.
In my experiment it was causing onProcesssingQueueStuck and node became offline.
Impact Details
I want to emphasize that it is not just a simple DOS, it is overloading bottleneck (fifoLock) which is also used in some critical functions in a system. By increasing number of accounts in a message you can impact transaction processing on target nodes or the whole network itself.
References
Proof of Concept
Please apply the following gist to Shardeum repository. In order to activate this attack call the http GET /attack method on any active validator in the network.
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 handler lacked a limit on the number of account IDs it would process and shared a lock with critical transaction functions, allowing a single request to monopolise the lock.
Impact
An attacker could cause a significant delay in transaction processing on a single node, and by scaling the attack could completely stop or significantly slow transaction processing across the whole network.
What the attacker needed
Private key from a standby node; ability to send internal messages to validators; knowledge of validator IP addresses
How it was found
- Apply the provided proof-of-concept code to the Shardeum repository.
- Call the HTTP GET /attack method on any active validator in the network.
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.
A lock is a mechanism that stops two parts of a program from using the same resource at once. Here, a message handler took a lock that transaction processing also needs, and it could be made to hold that lock for a very long time by sending a huge list of account IDs. This meant normal transactions could not proceed, effectively freezing the node.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.