IERC20.transfer does not support all ERC20 token
Submitted by VAD37, also found by AuditsAreUS, IllIllI, MaratCerby, rfa, and sorrynotsorry
ForgottenRunesWarriorsGuild.sol#L173-L176 ForgottenRunesWarriorsMinter.sol#L627-L630
Token like USDT known for using non-standard ERC20. (Missing return boolean on transfer).
Contract function forwardERC20 will always revert when try to transfer this kind of tokens.
Impact
Cannot withdraw some special ERC20 token through contract call. Unexpected contract functionality = Medium severity
Recommended Mitigation Steps
Use SafeTransferLib.safeTransfer instead of IERC20 transfer. This accepts ERC20 token with no boolean return like USDT.
cryppadotta (Forgotten Runes) confirmed and commented:
Ah nice. You learn something new every day. Thanks!
KenzoAgada (warden) commented:
Description is pretty much invalid as ”forwardERC20 will always revert when try to transfer this kind of tokens” is simply not true. Same with impact - “Cannot withdraw some special ERC20 token through contract call” - that’s not the impact, using SafeERC20’s transfer will not help to transfer tokens. It will just revert on failure. But generally the issue of not using SafeERC20 is kinda-correct. Duplicate of #2.
This is not a duplicate of #2. #2 describes the silent failure of ERC20 transfer, while this describes a ERC20 that return void instead of bool. The call will revert even if the transfer is successful because Solidity expected a return value. Judging as Med Risk because unlike #2, here you can actually do something to fix the function.
KenzoAgada (warden) commented:
I apologize, my mistake.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A medium-severity smart contracts bug in Forgotten Runes Warrior Guild contest. Code4rena made it public on 4 August 2022. Found in the 2022-05-runes audit contest (finding M-01).
About Smart contracts
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.