Risk of Gas DoS due to Looping
The withdrawal queue is iterated in cancelWithdrawal and processWithdrawals, so an attacker could submit many small withdrawal requests to make these functions exceed the gas limit and become unusable.
Submitted by lanyi2023, also found by 0xGutzzz, 4ny0n3, Centaur, codegpt, codertjay, dhank, dreamcoder, fullstop, harry, hgrano, HighKingMargo, jerry0422, KonstantinVelev, kwad, meshaqRapha, mohitismmortal, newspacexyz, Pelz, player, qpzm, queen, r1ver, rbd3, romans, saraswati, SolidityScan, Stormy, TheWeb3Mechanic, typicalHuman, udogodwin, and Wolffey
perps/GTL.sol #L74
Both the cancelWithdrawal and processWithdrawals functions iterate over the _withdrawalQueue. Therefore, if an attacker were to maliciously submit a large number of minor withdrawal requests, any subsequent call to cancelWithdrawal or processWithdrawals would hit the gas limit, leading to a Denial of Service (DoS) attack on the protocol.
Recommended mitigation steps
Iterating through the entire queue to find a specific withdrawal request to cancel is inefficient and dangerous. Users should instead be required to provide a unique identifier for the request they wish to cancel. Using a mapping is the most gas-efficient way to implement this.
View detailed Proof of Concept
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 contract loops over the entire withdrawal queue to find or process a request, so the gas cost grows with the queue length and can exceed the block gas limit.
Impact
An attacker could block withdrawals and cancellations by making the queue too long to process within the gas limit.
What the attacker needed
Ability to submit withdrawal requests
The fix
The contract should require a unique identifier for the request to cancel and use a mapping instead of iterating over the whole queue.
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 smart contract has a list of withdrawal requests. If the list gets very long, going through it costs more gas than a transaction is allowed, so the functions that process or cancel withdrawals stop working. An attacker can make the list long by sending many tiny withdrawal requests.
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.