Add_mempool_transaction() does not check if the transaction already exist in the mempool
The single-transaction mempool insertion function does not check whether the transaction already exists, so it writes to RocksDB again. An attacker could repeatedly submit the same transaction to cause redundant writes and potentially slow down legitimate transactions.
- Disclosed after under an hour
#42430 [BC-Insight] `add_mempool_transaction()` does not check if the transaction already exist in the mempool
Submitted on Mar 23rd 2025 at 21:23:34 UTC by @avoloder for Attackathon | Movement Labs
- Report ID: #42430
- Report Type: Blockchain/DLT
- Report severity: Insight
- Target: https://github.com/immunefi-team/attackathon-movement/tree/main/protocol-units/mempool/move-rocks
- Impacts:
Description
Brief/Intro
add_mempool_transaction in the move-rocks does not check for duplicates but instead writes into the database regardless
Vulnerability Details
Inside mempool there are two functions for adding transactions, one for batch processing (add_mempool_transactions()) and another one for single processing add_mempool_transaction(). Inside the batch processing function there is a check against duplicate transactions to prevent unnecessary writes to the database, as it can be seen from the snipet below:
async fn add_mempool_transactions(
&self,
transactions: Vec<MempoolTransaction>,
) -> Result<(), anyhow::Error> {
--- SNIPET ---
for transaction in transactions {
if Self::internal_has_mempool_transaction(&db,
transaction.transaction.id())? {
continue;
}
--- SNIPET ---
However, the function for single processing fails to check if the transaction already exists in the mempool, and does redundant updates.
Impact Details
Since the add_mempool_transaction function does not check for duplicates, an attacker could repeatedly submit the same transaction to the mempool, causing RocksDB to continually overwrite the same transaction
References
Proof of Concept
Proof of Concept
- User A submits transaction A that gets added to the mempool with
add_mempool_transaction(), i.e., saved to the rocksDB. - User A submits the same transaction again (using the same data) and the mempool tries to add the transaction again.
- The transaction is overwritten in the rocksDB as the key is already present.
Currently there is no direct harm, as there will be no duplicate transactions created, however everytime, the redundant overwrites (updates) will happen. By doing this, a malicious user could flood the system with repeated write operations, potentially blocking or slowing down other legitimate transactions. The system would still perform I/O operations, database locking, and updates even though the data may be identical.
By checking for duplicates, the redundant writes could be avoided, like in the add_mempool_transactions() (batch processing)
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
The single-transaction insertion function lacks the duplicate check that the batch insertion function has.
Impact
There is no direct harm such as duplicate transactions, but repeated redundant writes could flood the system and potentially block or slow down legitimate transactions.
What the attacker needed
Ability to submit transactions to the mempool
The fix
The single-transaction function should check for duplicates before writing, as the batch function does.
How it was found
- User A submits a transaction that is added to the mempool and saved to RocksDB.
- User A submits the same transaction again with the same data.
- The transaction is overwritten in RocksDB because the key already exists.
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 mempool is a waiting area for transactions before they are confirmed. The code that adds one transaction at a time does not check if that transaction is already waiting, so it saves it again. Repeating this could waste the system's resources.
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.