_doDexSwap
Vulnerability ReportThe _doDexSwap
function in PerpetualVault lacks critical input validation and slippage protection, making it vulnerable to sandwich attacks and manipulation.
Key issues:
No minimum output amount validation
No slippage protection
No deadline for swap execution
No validation of to
address
Assumes successful swap without checking return value
High severity - The vulnerability could lead to:
MEV sandwich attacks
Significant value loss through price manipulation
Potential loss of user funds
Failed trades with unacceptable slippage
Manual code review
Static analysis
Control flow analysis
Implement circuit breakers for extreme price movements
Add price oracle checks for validation
Consider using aggregated DEX prices
Implement maximum slippage parameters
Add emergency pause functionality
Monitor for suspicious trading patterns
Slippage and deadline are handled externally. Paraswap implementation used by the current code (behind the proxy): https://etherscan.io/address/0xdffd706ee98953d3d25a3b8440e34e3a2c9beb2c GMX code: https://github.com/gmx-io/gmx-synthetics/blob/caf3dd8b51ad9ad27b0a399f668e3016fd2c14df/contracts/order/OrderUtils.sol#L150C15-L150C33
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.