DeFiFoundry
50,000 USDC
View results
Submission Details
Severity: low
Invalid

Issue with safeApprove in GmxProxy::createOrder, Potential for Revert and Transaction Failure

Summary

In the createOrder function, the safeApprove method is used to approve token transfers for gmxRouter. However, using safeApprove in this context is risky because of the potential for the "SafeERC20: approve from non-zero to non-zero allowance" revert . This occurs if the external contract doesn't consume the entire approved allowance and the allowance is then adjusted again to a non-zero value. To avoid this issue, safeIncreaseAllowance should be used instead of safeApprove.

also safeApprove is depreciated

Vulnerability Details

SafeERC20.safeApprove reverts when a non-zero approval is changed to a non-zero approval.

Impact

  • Transaction Failure: The safeApprove method might lead to failed transactions, especially if the external contract doesn’t consume the full allowance or attempts to reset the allowance value in subsequent transactions.

Tools Used

Manual Review

Recommendations

Consider using safeIncreaseAllowance.

Updates

Lead Judging Commences

n0kto Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

invalid_safeApprove_no_reset

USDT or other unusual ERC20 tokens: out of scope. For the other reports: No proof that the allowance won't be consumed by the receiver.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!