Return values of transfer() / transferFrom() not checked and unsafe usage
The contract calls ERC20 transfer() without checking its return value, so a failed transfer may go unnoticed. Also, some tokens like USDT do not return a boolean, causing calls to revert when cast to IERC20.
Submitted by henry
Note: This finding was reported via the winning Automated Findings report. It was declared out of scope for the audit, but is being included here for completeness.
Return values not checked
Not all ERC20 implementations revert() when there’s a failure in transfer() or transferFrom(). The function signature has a boolean return value and they indicate errors that way instead. By not checking the return value, operations that should have marked as failed, may potentially go through without actually transfer anything.
Unsafe usage
Some tokens do not implement the ERC20 standard properly. For example, Tether (USDT)‘s transfer() and transferFrom() functions do not return booleans as the ERC20 specification requires, and instead have no return value. When these sorts of tokens are cast to IERC20/ERC20, their function signatures do not match and therefore the calls made will revert. It is recommended to use the SafeERC20’s safeTransfer() and safeTransferFrom() from OpenZeppelin instead.
Instances
There is 1 instance of these issues:
WildcatSanctionsEscrow.sol (#L38)
38: IERC20(asset).transfer(account, amount);
laurenceday (Wildcat) confirmed and commented:
Fixed by utilising
SafeERC20.
Even checking the return values of ERC-20 transfers is problematic and insufficient due to popular tokens like USDT deviating from the spec. One always has to use SafeERC20 (as already mentioned by the sponsor), otherwise this is a valid Medium severity finding.
However, there is an exception in case the transferred tokens cannot be chosen freely by the users but need to be whitelisted. Also there are occasions where only a protocol’s own correctly implemented tokens can be used (Wildcat market tokens for example). In these cases, the severity is only Informational, since no malfunction can occur.
In case of Wildcat, if I remember correctly, the
WildcatSanctionsEscrowcontract could hold user-defined assets and not only their own market tokens. Therefore, Medium severity is justified.
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 uses the standard ERC20 transfer function directly without checking its return value or using a safe wrapper that handles non-standard tokens.
Impact
A failed transfer could be treated as successful, and tokens that do not return a boolean could cause the call to revert, potentially locking funds or disrupting the escrow.
What the attacker needed
Contract holds user-defined ERC20 tokens; token may not return boolean or may fail silently
The fix
The issue was fixed by using SafeERC20's safeTransfer and safeTransferFrom.
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 tokens signal a failed transfer by returning false instead of stopping with an error. If the code ignores that return value, it may think the transfer worked when it did not. Also, some tokens like USDT do not return a value at all, so calling them in the standard way can cause an error.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.