TokenHandler.setToken ERC20 missing return value check
The setToken function calls ERC20.approve() but ignores the boolean return value. Tokens that return false instead of reverting on failed approval are treated as successfully approved, so the contract may proceed with an unapproved token.
Submitted by cmichel
The setToken function performs an ERC20.approve() call but does not check the success return value. Some tokens do not revert if the approval failed but return false instead.
The impact is that tokens that don’t actually perform the approve and return false are still counted as a correct approve.
We recommend using OpenZeppelin’s SafeERC20 versions with the safeApprove function that handles the return value check as well as non-standard-compliant tokens.
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 code does not check the boolean returned by ERC20.approve(), so a false return is treated as success.
Impact
Tokens that return false on a failed approve are still counted as correctly approved, potentially allowing operations that should have been blocked.
What the attacker needed
Token returns false instead of reverting
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 signal a failed approval by returning false rather than stopping with an error. If the code ignores that false, it thinks the approval worked when it did not. This can let the contract continue as if it had permission when it does not.
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.