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

No slippage protection in sellProfits function

Summary

In Fees.sol there is no slippage protection for swapping _profits tokens to WETH

Vulnerability Details

The amountOutMinimum parameter used when swapping from _profits to WETH in the exactInputSingle function protects from a bad trade caused by price manipulation. In the sellProfits function the value is hardcoded to 0 which puts the protocol at risk of a malicious user performing a sandwich attack, reducing the amount of WETH the protocol is expected to receive in return for the _profits tokens.

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

Impact

In such a case, the contract would receive significantly less WETH for the swap, leading to a major loss of funds.

Tools Used

Manual review

Recommendations

Input a reasonable value for amountOutMinimum in order to protect from sandwich attacks.

Support

FAQs

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