A critical vulnerability exists in ParaSwapUtils.sol where unsafe token approval handling leads to permanent failure of swap operations with certain ERC20 tokens. The issue can cause funds to become stuck and disrupt core vault operations due to improper approval management.
The vulnerability exists in ParaSwapUtils.sol's swap function where token approvals are handled incorrectly:
The issue arises because:
Direct safeApprove calls are made without first resetting existing approvals
Several major ERC20 tokens (e.g., USDT, BNB) revert when modifying non-zero approvals
No approval reset mechanism exists in the codebase
Failed approvals permanently block swap functionality
No recovery mechanism is implemented
Permanent Operation Failure
Once a token has a non-zero approval, subsequent operations fail
No built-in recovery mechanism exists
Requires contract upgrade to fix
Core Functionality Disruption
Vault operations requiring swaps become blocked
Position management can fail
User deposits/withdrawals may be affected
Fund Lock Risk
Users may be unable to execute planned operations
Positions could become temporarily immovable
Emergency withdrawals could be impacted
The following Proof of Concept demonstrates the vulnerability:
The PoC demonstrates:
Initial swap operation succeeds
Subsequent swaps fail due to approval mechanics
Vault operations become blocked
No recovery mechanism exists
System-wide impact of the issue
Manual code review
Foundry testing framework
Static analysis (Aderyn)
Implement proper approval management:
Alternative options:
Use OpenZeppelin's newer forceApprove
Implement approval increase/decrease pattern
Add recovery mechanism for stuck approvals
The vulnerability is considered High severity because:
Impacts core vault functionality
Can lead to stuck funds
Affects common tokens like USDT
No existing workaround
Requires contract upgrade to fix
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.