The emergencyWithdrawERC20()
function does not validate that the contract actually holds the requested amount of tokens before attempting the transfer.
This can lead to failed transactions when the owner tries to withdraw more tokens than available.
Additionally, the function lacks validation for zero amounts, allowing wasteful transactions:
Current problematic implementation:
Likelihood:
Emergency situations require quick action where the owner may not have time to check exact token balances before calling the function.
Multiple emergency withdrawal attempts may occur during incident response, increasing chances of exceeding available balance.
Impact:
Transaction failures waste gas and delay emergency response when time-sensitive token recovery is needed.
Failed emergency withdrawals may prevent recovery of accidentally sent tokens during critical time windows.
The following scenario demonstrates how the lack of balance validation can cause transaction failures during emergency situations. An owner attempting to recover accidentally sent tokens may not know the exact contract balance and could request more than available, causing the entire transaction to revert and preventing legitimate emergency recovery operations.
The fix involves adding proper balance validation and zero amount checks to ensure the emergency function operates reliably and efficiently.
This prevents transaction failures during emergency situations and ensures the function can only be used for legitimate recovery amounts. The validation also prevents wasteful zero-amount transactions that consume gas unnecessarily.
By checking the contract's actual token balance before attempting transfer, the owner can reliably recover accidentally sent tokens without encountering unexpected transaction reverts.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.