ERC20 return values not checked
The contract called ERC20 transfer functions without checking their boolean return value, so a token that signals failure by returning false instead of reverting would be treated as a successful transfer. This could corrupt the protocol's accounting of recovered tokens.
Submitted by cmichel, also found by defsec and jonah1005
The ERC20.transfer() and ERC20.transferFrom() functions return a boolean value indicating success. This parameter needs to be checked for success. Some tokens do not revert if the transfer failed but return false instead.
The Manager.recoverToken function does not check the return value of this function.
Impact
Tokens that don’t actually perform the transfer and return false are still counted as a correct transfer. Furthermore, tokens that do not correctly implement the EIP20 standard, like USDT which does not return a success boolean, will revert.
Recommended Mitigation Steps
We recommend using OpenZeppelin’s SafeERC20 versions with the safeTransfer and safeTransferFrom functions that handle the return value check as well as non-standard-compliant tokens.
GalloDaSballo (judge) commented:
Agree with finding, using a non reverting token can potentially cause issues to the protocol accounting
Sponsor can check each token on a case by case basis, or simply use OpenZeppelin’s
safeERC20
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 code called the token's transfer function directly and discarded the boolean it returns, instead of using a wrapper that reverts on false.
Impact
Tokens that return false without reverting are still counted as correctly transferred, and non-standard tokens such as USDT would revert, potentially disrupting protocol accounting.
What the attacker needed
A token that returns false instead of reverting
The fix
It should be fixed by using OpenZeppelin's SafeERC20 safeTransfer and safeTransferFrom helpers, which check the return value and tolerate non-standard tokens.
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.
Some tokens report whether a transfer worked by returning true or false rather than by raising an error. This code ignored that answer, so a failed transfer could look successful. The fix is to use a helper that always checks the answer.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.