code-423n4 / 2021-07-sherlock-findings

0 stars 0 forks source link

Use `safeApprove` instead of `approve` #138

Closed code423n4 closed 3 years ago

code423n4 commented 3 years ago

Handle

shw

Vulnerability details

Impact

The Gov contract uses the SafeERC20 library to handle the transfer of tokens that are not compliant with the ERC20 specification. However, in line 300, the approve function is used instead of the safeApprove function. Tokens not compliant with the ERC20 specification could return false from the approve call to indicate the approval fails, while the calling contract would not notice the failure if the return value is not checked.

Proof of Concept

Referenced code: Gov.sol#L300

Recommended Mitigation Steps

Use safeApprove instead of approve, which reverts the transaction with a proper error message when the return value of approve is false. A better approach is to use safeIncreaseAllowance instead, which mitigates the multiple withdrawal attack on ERC20 tokens.

Evert0x commented 3 years ago

51