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

Fees.sellProfits Uniswap V3 swap without slippage protection

Summary

Fees.sellProfits Uniswap V3 swap without slippage protection

Vulnerability Details

The function sellProfits(address _profits) in Fees contract executes UniswapV3 exactInputSingle swap without any slippage protection

function sellProfits(address _profits) public {
require(_profits != WETH, "not allowed");
uint256 amount = IERC20(_profits).balanceOf(address(this));
ISwapRouter.ExactInputSingleParams memory params = ISwapRouter
.ExactInputSingleParams({
tokenIn: _profits,
tokenOut: WETH,
fee: 3000,
recipient: address(this),
deadline: block.timestamp,
amountIn: amount,
amountOutMinimum: 0,
sqrtPriceLimitX96: 0
});
amount = swapRouter.exactInputSingle(params);
IERC20(WETH).transfer(staking, IERC20(WETH).balanceOf(address(this)));
}

Because amountOutMinimum has been hardcoded to 0, swaps are most likely to be sandwich attacked and protocol would lose funds.

Impact

Protocol is exposed to sandwich attacks, where the protocol would lose funds.

Tools Used

Manual Review

Recommendations

Add _amountOutMinimum parameter for the sellProfits function.

Support

FAQs

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

Give us feedback!