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
function setApprovalForERC20(
IERC20 erc20Contract,
address to,
uint256 amount
) external onlyClubOwner {
erc20Contract.approve(to, amount);
}
and
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
Tool used
Manual Review
Recommendation
Use Openzeppelin SafeTransfer / SafeApprove
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.