DeFiFoundry
50,000 USDC
View results
Submission Details
Severity: low
Invalid

Lack of Slippage Protection in `swap` Function Allows Severe Fund Loss

The swap function executes an external call to ParaSwap without verifying the amount of tokens received, allowing trades to complete even if the swap results in significant losses due to price manipulation or malicious routing.

(bool success, ) = to.call(callData);
require(success, "paraswap call reverted");

The function blindly trusts that the external swap execution is fair, without enforcing any minimum output amount. Since callData is fully controlled by the caller and can interact with different liquidity sources, an attacker can exploit this by front-running the swap to cause an unfavorable execution price or by routing trades through malicious pools that return near-zero value. For example, if an attacker sees a large swap pending, they could execute trades that drastically alter token prices before the transaction is finalized, resulting in an execution at an extremely poor rate. Alternatively, if ParaSwap or an integrated liquidity provider is compromised, the swap could be intentionally routed through an attacker-controlled liquidity pool that returns far fewer tokens than expected. Since there is no post-swap validation of received amounts, the contract finalizes the transaction regardless of the loss, leading to catastrophic fund depletion.

Impact

Users can lose nearly all swapped funds due to price manipulation, front-running attacks, or malicious routing, with no recourse since the contract blindly accepts the swap results.

Mitigation

Decode callData to extract the expected output amount and enforce slippage protection by requiring that the received amount meets or exceeds a minimum acceptable threshold before finalizing the swap.

Updates

Lead Judging Commences

n0kto Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

invalid_swap_slippage_and_deadline

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

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.