Skip to content
Business logic Audit finding Intermediate

CompoundToNotionalV2.enableToken ERC20 missing return value check

The enableToken function calls ERC20.approve() but ignores the boolean return value. Tokens that return false on failed approval are still treated as approved, so the contract may proceed as if approval succeeded when it did not.

cmichel Follow

Originally disclosed on Code4rena

Submitted by cmichel

The enableToken function performs an ERC20.approve() call but does not check the success return value. Some tokens do not revert if the approval failed, returning false instead.

The impact is that, tokens that don’t actually perform the approve and return false are still counted as a correct approve.

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 return value of ERC20.approve(), so a false return is treated as success.

Impact

Tokens that return false on a failed approval 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.

When a smart contract asks a token for permission to spend your tokens, the token is supposed to reply with a true or false. This code ignores that reply. If the token says false (meaning 'no'), the contract still acts as if it said yes, which could lead to unexpected behaviour.

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.