Use safeTransferFrom() instead of transferFrom()
The contract used ERC20 transfer and transferFrom without checking their boolean return values, so failed transfers could be treated as successful. Tokens that do not return a boolean, such as USDT, would cause transactions to revert, making them unusable in the protocol.
Source: https://github.com/sherlock-audit/2022-11-dodo-judging/issues/47
Found by
Nyx, 0x4non, yixxas, Tomo, sach1r0
Summary
The ERC20.transfer() and ERC20.transferFrom() functions return a boolean value indicating success. This parameter needs to be checked for success. Some tokens do not revert if the transfer failed but return false instead.
Vulnerability Detail
Some tokens (like USDT) don't correctly implement the EIP20 standard and their transfer/ transferFrom function return void instead of a success boolean. Calling these functions with the correct EIP20 function signatures will always revert.
Impact
Tokens that don't actually perform the transfer and return false are still counted as a correct transfer and tokens that don't correctly implement the latest EIP20 spec, like USDT, will be unusable in the protocol as they revert the transaction because of the missing return value.
Code Snippet
Tool used
Manual Review
Recommendation
Recommend using OpenZeppelin's SafeERC20 versions with the safeTransfer and safeTransferFrom functions that handle the return value check as well as non-standard-compliant tokens.
Discussion
Evert0x
We think a medium is still valid, although no direct loss of funds, a failed token transfer should be catched.
Attens1423
https://github.com/DODOEX/dodo-route-contract/pull/4
aktech297
Fixes are verified. Contract is using openzeppelin's safeTransfer.
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 called ERC20 transfer and transferFrom directly without checking their return values and without handling tokens that do not return a boolean.
Impact
A failed token transfer could be counted as successful, and tokens that do not return a boolean, such as USDT, could not be used in the protocol because transactions would revert; the team noted no direct loss of funds.
What the attacker needed
None
The fix
The contract was fixed to use OpenZeppelin's SafeERC20 safeTransfer and safeTransferFrom, which check the return value and support non-standard tokens.
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 report whether a transfer worked by returning true or false, but the contract ignored that answer. If a transfer quietly failed, the contract still acted as if it had succeeded. Also, some tokens like USDT do not return any answer at all, so the contract's attempt to read one made the whole transaction fail.
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.