Failed withdrawals from VUSD#processWithdrawals will be lost forever
When a withdrawal call fails in VUSD#processWithdrawals, the contract only emits an event and moves on, with no way to retry. As a result, the failed withdrawal amount is permanently lost.
Source: https://github.com/sherlock-audit/2023-04-hubble-exchange-judging/issues/162
Found by
0x52, 0xDjango, 0xpinky, Delvir0, Kaiziron, dirk_y, kutugu, n1punp, ver0759, yy
Summary
When withdrawals fail inside VUSD#processWithdrawals they are permanently passed over and cannot be retried. The result is that any failed withdrawal will be lost forever.
Vulnerability Detail
(bool success, bytes memory data) = withdrawal.usr.call{value: withdrawal.amount}("");
if (success) {
reserve -= withdrawal.amount;
} else {
emit WithdrawalFailed(withdrawal.usr, withdrawal.amount, data);
}
i += 1;
If the call to withdrawal.usr fails the contract will simply emit an event and continue on with its cycle. Since there is no way to retry withdrawals, these funds will be permanently lost.
Impact
Withdrawals that fail will be permanently locked
Code Snippet
Tool used
Manual Review
Recommendation
Cache failed withdrawals and allow them to be retried or simply send VUSD to the user if it fails.
Discussion
asquare08
will add functionality to retry withdrawals
asquare08
Fixed in this PR. The description is in the PR.
IAm0x52
Fix looks good. Failed withdrawals are cached allowing them to be retried by governance on a case by case basis.
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 contract does not store failed withdrawals for retry, so a failed transfer results in permanent loss.
Impact
Withdrawals that fail will be permanently locked.
What the attacker needed
A withdrawal that fails
The fix
The issue was fixed by caching failed withdrawals so governance can retry them case by case.
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 processes withdrawal requests by sending funds to users. If sending to one user fails (for example, because their address rejects the payment), the contract just notes the failure and continues. Since there is no way to try again later, that user's funds are stuck forever.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.