20,000 USDC
View results
Submission Details
Severity: high
Valid

accept zero as amountOutMinimum opening up the user to a catastrophic loss of funds via price slippage attack and MEV attacks

Summary

accept zero as amountOutMinimum opening up the user to a catastrophic loss of funds via MEV sandwich attack

Vulnerability Details

the minimum amount of tokens they want to be returned from a swap should not be zero because this will opening up the user to a huge loss of funds via price slippage attacks and MEV bot sandwich attacks.

ISwapRouter.ExactInputSingleParams memory params = ISwapRouter
.ExactInputSingleParams({
tokenIn: _profits,
tokenOut: WETH,
fee: 3000,
recipient: address(this),
deadline: block.timestamp,
amountIn: amount,
38: -> amountOutMinimum: 0,
sqrtPriceLimitX96: 0
});

This code tells the swap that the user will accept a minimum amount of 0 output tokens from the swap

Impact

amountOutMinimum = 0 will result in huge loss of fund of the user or the protocol that will do the swap
and this allow the returned amount from the swap to be zero

Tools Used

manual review

Recommendations

the protocol should specify a slippage parameter amountOutMinimum to provide the protection from price slippage attack .

Support

FAQs

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