Unchecked ERC20 transfer calls
The DutchAuctionLiquidator contract calls ERC20 transfer without checking the return value, so a token that returns false on failure would be treated as a successful transfer. This could allow a failed transfer to be considered valid, and with USDT the transfer would always revert.
Submitted by loop, also found by cmichel, defsec, gzeon, leastwood, nikitastupin, pants, and WatchPug
ERC20 transfer and transferFrom calls normally return true on a succesful transfer. In DutchAuctionLiquidator the call asset.transfer(msg.sender, _collateral); is made. asset refers to whichever ERC20 asset is used for the vault of that auction. If asset is an ERC20 token which does not comply with the EIP-20 standard it might return false on a failed transaction rather than revert. In this case it would count as a valid transaction even though it is not. If a vault would be making use of USDT the transfer call would always revert as USDT returns void on transfers.
There are a few more transfer(From) calls which are unchecked, these are however all on a predetermined asset (mochi, usdM and crv) and unlikely to cause problems.
Proof of Concept
See issue page for referenced code.
Tools Used
Slither
Recommended Mitigation Steps
In other contracts the functions cheapTransfer and cheapTransferFrom are used which are part of the mochifi cheapERC20 library. These functions do check for a return value and could be used rather than transfer and transferFrom.
Comments:
transferFromandtransferfunctions are used for mochi and usdm tokens which are standard EIP-20 tokens.
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
The contract does not check the boolean return value of ERC20 transfer calls, so a false return is ignored.
Impact
A failed transfer could be treated as successful, potentially causing incorrect state; with USDT the transfer would always revert.
What the attacker needed
Vault uses a non-standard ERC20 token
The fix
Use the library's cheapTransfer and cheapTransferFrom functions, which check the return value, instead of transfer and transferFrom.
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 do not follow the usual rule of stopping with an error when a transfer fails; instead they just return false. If the contract does not check that returned value, it may think the transfer worked when it did not. This can lead to incorrect accounting or lost funds.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.