Skip to content

Latest commit

 

History

History
33 lines (26 loc) · 1.16 KB

Incorrect `safeApprove` usage.md

File metadata and controls

33 lines (26 loc) · 1.16 KB

The safeApprove function of the OpenZeppelin SafeERC20 library prevents changing an allowance between non-zero values to mitigate a possible front-running attack.

Instead, the safeIncreaseAllowance and safeDecreaseAllowance functions should be used.

However, the UniERC20 library simply bypasses this restriction by first setting the allowance to zero.

This reintroduces the front-running attack and undermines the value of the safeApprove function.

Consider introducing an increaseAllowance function to handle this case.

Recommendation:

safeIncreaseAllowance and safeDecreaseAllowance functions should be used


Slide Screenshot

085.png


Slide Text

  • OpenZeppelin Audit 1inch Finding M07
  • Timing
  • Medium Severity
  • Incorrect safeApprove()
  • No non-zero -> Non-zero
  • safeIncreaseAllowance()
  • safeDecreaseAllowance()

References


Tags