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

Fee.sol is Vulnerable to Slippage Attacks

Summary

Lack of slippage parameter makes Fees.sol vulnerable to sandwich attacks which cause loss of funds.

Vulnerability Details

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

Swap that executed in order to change fee tokens with WETH in order to send staking contract lacks slippage parameter as shown above. In swaps if amountOutMinimum is 0, that tells Uniswap to return minimum 0 tokens. Because of this parameter, MEV bots can sandwich attack this swap call and by changing price of the token before and after swap; can steal funds from contract.

Impact

Important amount of fees collected will be stolen via sandwich attacks, hence protocol will lose funds, hence I consider this as high.

Tools Used

Manual Review

Recommendations

It is important to specify reasonble amountOutMinimum parameter. In order to do that, protocol can use price oracle to fetch price data; then use that data while calculating minimum amount of expected token.

Support

FAQs

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