code-423n4 / 2021-04-vader-findings

1 stars 0 forks source link

ERC20 return values not checked #231

Open code423n4 opened 3 years ago

code423n4 commented 3 years ago

Handle

@cmichelio

Vulnerability details

Vulnerability Details

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.

It's missing in many contracts, for instance, in Router.moveTokenToPools.

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.