Skip to content
Business logic Audit finding Intermediate

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.

cmichel Follow

Originally disclosed on Code4rena

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.

jeffywu (Notional) confirmed

The original report as published on Code4rena, by cmichel. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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.

More by cmichel

View all

196 more disclosed reports, best first.

More from Notional contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.