Skip to content
Smart contracts Audit finding Intermediate

Unhandled return values of transfer and transferFrom

The smart contract calls ERC20 transfer and transferFrom functions without checking their return values. If a token returns false on failure instead of reverting, the contract may continue as if the transfer succeeded, potentially causing loss of funds or incorrect state.

2997ms Follow

Originally disclosed on Code4rena

Submitted by 2997ms

ERC20 implementations are not always consistent. Some implementations of transfer and transferFrom could return ‘false’ on failure instead of reverting. It is safer to wrap such calls into require() statements to these failures.

Proof of Concept

https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L205 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L280 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L399 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L537 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L570 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L602

Recommended Mitigation Steps

Check the return value and revert on 0/false or use OpenZeppelin’s SafeERC20 wrapper functions.

08xmt (Inverse) acknowledged and commented:

Every deployment of a market will use a trusted token, and be audited by the DAO and governance. Even when using safe transfer, there’s no guarantee that an ERC20 token will behave as expected.


The original report as published on Code4rena, by 2997ms. 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

Likely the contract does not check the boolean return value of ERC20 transfer and transferFrom calls, so a false return is treated as success.

What the attacker needed

A token that returns false on failure; trusted token assumption is broken

The fix

The contract should check the return value and revert on false, or use OpenZeppelin’s SafeERC20 wrapper functions.

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 digital tokens signal a failed transfer by returning a false value rather than stopping the program with an error. If the contract ignores that false value, it may think the transfer worked when it did not, which can lead to lost funds or wrong balances.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

More from Inverse Finance contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.