The PerpetualVault contract performs token swaps using Paraswap DEX without implementing any slippage protection. The contract blindly executes swaps and never validates the output amounts, leaving users vulnerable to sandwich attacks, price manipulation, and significant value loss due to unfavorable trade execution.
The _doDexSwap function fails to implement any form of minimum output validation:
No minimum output validation
No comparison against expected rates
Accepts any output amount, even if extremely unfavorable
No reversion mechanism for bad trades
No validation that output amount is greater than zero
The issue is particularly concerning because:
The contract handles valuable tokens (USDC, WETH, WBTC, LINK, USDT)
These tokens trade in highly liquid markets where MEV bots are active
Paraswap is an aggregator routing through multiple DEXes, increasing attack surface
Users have no opt-out or control over slippage parameters
The lack of slippage protection in DEX swaps creates serious risks:
Direct Loss of Funds: Users receive significantly fewer tokens than would be fair market value
MEV Exploitation: Sandwich attacks can extract value from every swap
Liquidation Risk: Unfavorable swaps may lead to insufficient collateral for positions
Trust Erosion: Users experiencing losses from bad trades will lose trust in the protocol
This vulnerability could be exploited on every DEX swap transaction, making it especially dangerous as it affects core functionality used throughout the protocol.
The attack flow:
Vault prepares to swap 100,000 USDC for ETH
Attacker front-runs by buying ETH, pushing price up 3%
Vault executes swap at inflated price, receiving 3% less ETH
Attacker back-runs by selling ETH, returning price to normal
Attacker profits ~3%, vault users lose ~3%
No minimum output check means transaction succeeds despite the loss
This pattern can be repeated for every DEX swap the vault performs.
Manual review
1.Add minimum output validation which is dynamically adjusted to prices passed by an oracle to all DEX swaps:
2.Add configuration options for slippage tolerance:
Add a default maximum slippage parameter (e.g., 100 basis points / 1%)
Allow the keeper to customize slippage tolerance for different market conditions
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.