#46570 [SC-Insight] account list DoS issue
Submitted on Jun 1st 2025 at 19:34:10 UTC by @gln for IOP | Paradex
Report ID: #46570
Report Type: Smart Contract
Report severity: Insight
Target: https://github.com/tradeparadex/audit-competition-may-2025/tree/main/paraclear
Impacts:
Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)
Description
Brief/Intro
Paradex contract stores all accounts in a linked list.
If the account list is large enough, the code which traverse this list may revert with out of gas error.
Vulnerability Details
To add new account the following function is called from paraclear/src/account/account.cairo :
fn _add_new_account_if_not_exists(
ref self: ComponentState<TContractState>, account_address: ContractAddress,
) -> bool {
let current_account_address = self
.Paraclear_account
.entry(account_address)
.account_address
.read();
if !current_account_address.is_zero() {
return true;
}
let current_tail = self.Paraclear_account_tail.read();
let new_account = Account {
account_address: account_address, prev: current_tail, next: Zero::zero(),
};
self.Paraclear_account.write(account_address, new_account);
self.Paraclear_account_tail.write(account_address);
if !current_tail.is_zero() {
let tail_account = self.Paraclear_account.read(current_tail);
self
.Paraclear_account
.write(
current_tail,
Account {
account_address: current_tail,
prev: tail_account.prev,
next: account_address,
},
);
}
true
}
Let's see how the code traverses this list, from paraclear/src/paraclear/paraclear.cairo:
If account list is large enough, the getSettlementAssetTotalBalance() function call will fail due to out of gas error.
This creates a potential Denial of Service issue:
Attacker creates huge amount of dummy accounts, they will be stored in a linked list (self.account.Paraclear_account)
A call to getSettlementAssetTotalBalance() will always revert
Impact Details
Denial of Service issue, call to getSettlementAssetTotalBalance() will always fail with out of gas.
Proof of Concept
Proof of Concept
How to reproduce:
add the following test to paraclear/src/account/tests/test_account.cairo
run the test
Was this helpful?