The contract contains unchecked ERC20 token transfers (transfer and transferFrom) across multiple functions, violating the ERC20 standard by not verifying the return values. This oversight can result in silent transfer failures for certain tokens, leading to fund loss, and inconsistent states.
The contract contains multiple instances of unchecked ERC20 token transfers (IERC20.transfer and IERC20.transferFrom) where the return value is not verified. This violates the ERC20 standard, which specifies that these functions should return a boolean value indicating the success or failure of the transfer.
Ignoring these return values can result in undetected failures when certain tokens do not revert on failure but instead return false. This behavior is common in some non-standard ERC20 tokens, such as USDT or EURS. If a transfer fails but the contract continues execution as if the operation succeeded, it can lead to severe issues, such as inconsistent contract state or potential fund loss.
Using buyOrder
function to explain,
The transfer function of the IERC20 interface is called, but the return value (a bool indicating success or failure) is ignored. If the transfer fails (returns false), the function does not handle it. This means: The contract assumes the transfer succeeded even though it didn't. Tokens like USDT
, BNB
and others are missing a return value on transfer
and transferFrom
, which would break integration with the application. There are also tokens that do not revert on failure in transfer but return a false
boolean value like EURS
. The current implementation would continue execution even in these failure cases, treating them as successful transfers.
sellErc20
Function
The IERC20.transferFrom
function is called without verifying the return value:
A seller attempts to sell tokens using the sellErc20
function. If transferFrom
fails silently, the tokens are never deposited into the contract, but the user is falsely credited with a successful transaction.
transferErcTokens
Function
Here, the return value of IERC20.transferFrom
is also ignored:
In transferErcTokens
, a user tries to transfer tokens to another address. The transferFrom
call fails silently, causing the contract to operate under the assumption that the transfer succeeded.
Users could lose funds if transfers fail silently
Contract state would become out of sync with actual token balances
Subsequent operations might be executed based on the assumption of a successful transfer
Manual Review
Slither
Add proper return value checks for all ERC20 transfers and transferFrom calls:
These changes ensure that the contract only proceeds with the assumption of success if the transfer or transferFrom call explicitly returns true
.
Example, in buyOrder
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.