The FlashBorrower uses non-save ERC20 functions like .transfer(From) and approve.
The ERC20.transfer() and ERC20.transferFrom() functions return a boolean value indicating success. This parameter needs to be checked for success.
Furthermore, some tokens (like USDT) don't correctly implement the ERC20 standard and don't return a boolean.
Impact
Tokens that don't actually perform the transfer and return false are still counted as a correct transfer.
Tokens that don't correctly implement the spec, like USDT, will be unusable in the protocol as they revert the transaction because of the missing return value.
Recommended Mitigation Steps
Use OpenZeppelin's SafeERC20 library or the custom implementation already present in Utils/transferHelper.sol.
Handle
cmichel
Vulnerability details
The
FlashBorrower
uses non-save ERC20 functions like.transfer(From)
andapprove
.The
ERC20.transfer()
andERC20.transferFrom()
functions return a boolean value indicating success. This parameter needs to be checked for success. Furthermore, some tokens (like USDT) don't correctly implement the ERC20 standard and don't return a boolean.Impact
Tokens that don't actually perform the transfer and return
false
are still counted as a correct transfer. Tokens that don't correctly implement the spec, like USDT, will be unusable in the protocol as they revert the transaction because of the missing return value.Recommended Mitigation Steps
Use OpenZeppelin's SafeERC20 library or the custom implementation already present in
Utils/transferHelper.sol
.