Skip to content
Business logic Audit finding Intermediate

Certain ERC20 token does not return bool from approve and transfer and transaction revert

The FootiumEscrow contract calls approve and transfer on ERC20 tokens using the standard IERC20 interface, which expects a boolean return value. Some tokens do not return a boolean, causing these calls to revert and preventing the club owner from approving or transferring those tokens.

0xGoodess Follow with Dug, GalloDaSballo and 7 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-04-footium-judging/issues/14

Found by

0xGoodess, Dug, GalloDaSballo, TheNaubit, ctf_sec, deadrxsezzz, innertia, juancito, mstpr-brainbot, n1punp

Summary

Certain ERC20 token does not return bool from approve and transfer and transaction revert

Vulnerability Detail

According to

https://github.com/d-xo/weird-erc20#missing-return-values

Some tokens do not return a bool on ERC20 methods and use IERC20 token interface will revert transaction

Certain ERC20 token does not return bool from approve and transfer and transaction revert

Solidity
   function setApprovalForERC20(
        IERC20 erc20Contract,
        address to,
        uint256 amount
    ) external onlyClubOwner {
        erc20Contract.approve(to, amount);
    }

and

Solidity
function transferERC20(
	IERC20 erc20Contract,
	address to,
	uint256 amount
) external onlyClubOwner {
	erc20Contract.transfer(to, amount);
}

the transfer / approve can fail slienlty

Impact

Some tokens do not return a bool on ERC20 methods and use IERC20 token interface will revert transaction

Code Snippet

https://github.com/sherlock-audit/2023-04-footium/blob/11736f3f7f7efa88cb99ee98b04b85a46621347c/footium-eth-shareable/contracts/FootiumEscrow.sol#L80

https://github.com/sherlock-audit/2023-04-footium/blob/11736f3f7f7efa88cb99ee98b04b85a46621347c/footium-eth-shareable/contracts/FootiumEscrow.sol#L95

Tool used

Manual Review

Recommendation

Use Openzeppelin SafeTransfer / SafeApprove

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

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

What the attacker needed

Club owner role; token without boolean return

The fix

Use OpenZeppelin's SafeTransfer and SafeApprove, which handle tokens that do not return a boolean.

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 follow an older standard that does not send back a 'yes' or 'no' answer when you ask to approve or transfer them. The smart contract here expects that answer, so when it is missing the whole transaction fails. This means the owner cannot move or approve those particular tokens.

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 0xGoodess

View all

13 more disclosed reports, best first.

More from Footium

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.