The safeApprove
function in the OpenZeppelin SafeERC20
library is designed to safely approve a spender to transfer tokens on behalf of the owner. However, improper usage of safeApprove
can lead to vulnerabilities, particularly when dealing with ERC20 tokens that do not reset the allowance to zero before setting a new value. This can result in race conditions, front-running attacks, or unexpected behavior if the allowance is not managed correctly.
The swap
function in ParaSwapUtils
uses ERC20 safeApprove()
from OpenZeppelin's SafeERC20 library to give allowance to the paraswap:
However, the safeApprove
function prevents changing an allowance between non-zero values to mitigate a possible front-running attack. It reverts if that is the case. Comment from the OZ library for this function():
If the existing allowance is non-zero, then safeApprove()
will revert causing swap to fail and leading to denial-of-service.
The safeApprove()
may revert causing swap to fail and leading to denial-of-service. The impact is Medium, the likelihood is Low, so the severity is Low.
Manual Review
Consider using forceApprove instead().
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.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.