Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: high
Invalid

Incorrect Slippage Control in Dex Adapters Leading to Slippage Attacks

Summary:
The Dex adapters (CurveAdapter, UniswapV2Adapter, UniswapV3Adapter) lack proper validation of the minimum output amount received from swaps, making them vulnerable to slippage attacks and potential fund loss.

Vulnerability Details:
In the CurveAdapter.sol, UniswapV2Adapter.sol, and UniswapV3Adapter.sol files, the swap functions accept a minAmountOut parameter but fail to enforce it after executing the swap. For example, in UniswapV2Adapter.sol, the code performs the swap via uniswapRouter.swapExactTokensForTokens but does not verify if the received amountOut meets the minAmountOut requirement. This allows malicious keepers or users to front-run swaps, manipulate prices, and execute trades with excessive slippage, resulting in significant losses for users.

Code Refrence:

function swap(...) external override returns (uint256 amountOut) {
IERC20(path[0]).transferFrom(msg.sender, address(this), amountIn);
IERC20(path[0]).approve(address(uniswapRouter), amountIn);
amountOut = uniswapRouter.swapExactTokensForTokens(
amountIn,
minAmountOut, // Not validated post-swap
path,
to,
deadline
);
}
  • Similar issues exist in CurveAdapter.sol and UniswapV3Adapter.sol.

Impact:
Attackers can exploit this to drain funds from users or the protocol by forcing swaps with minimal output. This vulnerability directly compromises the integrity of market-making operations and user trust.

Recommendations:
Add explicit checks after the swap to ensure amountOut >= minAmountOut. For example:

require(amountOut >= minAmountOut, "Insufficient output amount");
Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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