_doDexSwap()
function under PerpetualVault.sol
swaps the input tokens with output tokens but it doesn't have proper slippage control which can put the protocol on risk in future. While the sequencer does not permit arbitrage opportunities to be arbitrarily captured, the code will continue to result in uncontrollable outputs that might ultimately not result in the output that the protocol expects
Although frontrunning is not an issue on L2s, which helps mitigate certain MEV attacks, the absence of defined slippage and potential network congestion could lead to swaps being executed under unfavorable conditions, resulting in losses for users.
As the minimum output is not set, the loss for users that use this function can be of 100% of their funds. It will make sure that the swap will always be paraswap is executed no matter the market condions.
Manual Review
We recommend setting desired slippage params.
Add a new paramter minimumOutputAmount and if we dont receive this amount from paraswap then revert
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.