code-423n4 / 2021-05-yield-findings

0 stars 0 forks source link

`FlashBorrower` uses non-safe ERC20 functions #34

Closed code423n4 closed 3 years ago

code423n4 commented 3 years ago

Handle

cmichel

Vulnerability details

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.

alcueca commented 3 years ago

FlashBorrower and any other contracts in the Mocks directory are not in scope.