min withdraw of 5 VUSD is not enough to prevent DOS via VUSD.sol#withdraw(amount)
The VUSD contract allows any address to queue unlimited withdrawal requests with a minimum of 5 VUSD, and only the first 100 requests are processed at a time. An attacker could spam the queue with many small withdrawals, delaying genuine users' withdrawals.
0xbepresent Follow with lil.eth and p-tsanev
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2023-04-hubble-exchange-judging/issues/81
Found by
0xbepresent, lil.eth, p-tsanev
Summary
A vulnerability exists where a malicious user spam the contract with numerous withdrawal requests (e.g., 5,000). This would mean that genuine users who wish to withdraw their funds may find themselves unable to do so in a timely manner because the processing of their withdrawals could be delayed significantly.
Vulnerability Detail
The issue stems from the fact that there is no restriction on the number of withdrawal requests a single address can make. A malicious actor could repeatedly call the withdraw or withdrawTo function, each time with a small amount (min 5 VUSD), to clog the queue with their withdrawal requests.
//E Burn vusd from msg.sender and queue the withdrawal to "to" address
function _withdrawTo(address to, uint amount) internal {
//E check min amount
require(amount >= 5 * (10 ** 6), "min withdraw is 5 vusd"); //E @audit-info not enough to prevent grief
//E burn this amount from msg.sender
burn(amount); // burn vusd from msg.sender
//E push
withdrawals.push(Withdrawal(to, amount * 1e12));
}
Given the maxWithdrawalProcesses is set to 100, and the withdrawal processing function processWithdrawals doesn't have any parameter to process from a specific index in the queue, only the first 100 requests in the queue would be processed at a time.
uint public maxWithdrawalProcesses = 100;
//E create array of future withdrawal that will be executed to return
function withdrawalQueue() external view returns(Withdrawal[] memory queue) {
//E check if more than 100 requests in withdrawals array
uint l = _min(withdrawals.length-start, maxWithdrawalProcesses);
queue = new Withdrawal[](l);
for (uint i = 0; i < l; i++) {
queue[i] = withdrawals[start+i];
}
}
In the case of an attack, the first 100 withdrawal requests could be those of the attacker, meaning that the genuine users' requests would be stuck in the queue until all of the attacker's requests have been processed. Moreover the fact that we can only withdraw up to 1 day long when our withdraw request is good to go.
Impact
This could result in significant delays for genuine users wanting to withdraw their funds, undermining the contract's usability and users' trust in the platform.
Code Snippet
Tool used
Manual Review
Recommendation
Either limit number of withdrawal requests per address could be a first layer of defense even if it's not enough but I don't see the point why this limit is included so removing it could mitigate this. Otherwise you could implement a priority queue regarding amount to be withdrawn
Discussion
asquare08
Since this is a temporary DOS, we will increase maxWithdrawalProcesses if such a condition arises or increase the min withdrawal amount to increase the capital requirement to do so.
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 lack of a per-address limit on withdrawal requests combined with a low minimum withdrawal amount and a fixed batch size for processing.
Impact
Genuine users could experience significant delays in withdrawing their funds, undermining trust in the platform.
What the attacker needed
Attacker needs 5 VUSD per request; no limit on requests per address
The fix
The team should limit the number of withdrawal requests per address, remove the minimum withdrawal limit, or implement a priority queue based on withdrawal amount; they have stated they will increase maxWithdrawalProcesses or the minimum withdrawal amount if needed.
How it was found
- Call the withdraw or withdrawTo function repeatedly with the minimum amount (5 VUSD) to create many withdrawal requests.
- The contract burns the VUSD and adds each request to the withdrawals queue.
- The processing function only handles the first 100 requests in the queue, so the attacker's requests block genuine ones.
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.
This is a smart contract that handles withdrawals. Anyone can ask to withdraw a small amount many times, and the system processes requests in order, only 100 at a time. A bad actor can fill the queue with their own requests, so real users have to wait much longer to get their money.
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.