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

No slippage Protection while selling tokens for profit

Summary

No slippage Protection while selling tokens for profit.
Due to this, a bunch of times, the staking address will receive fewer tokens
than expected suffering a huge loss of funds in most cases.

Vulnerability Details

Inside the sellProfits function in Fees.sol, the contract sends a call to the Uniswap router which passes amountOutMin as 0.

It means that at minimum, the staking address will receive 0 tokens as output in the worst case.
Which might not be an intended behavior and happens a lot of time.

Code

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

-> Staking addresses will lose a lot of funds in WETH.

Tools Used

Remix, Manual Review

Recommendations

Try to let the user specify the minimum Output amount he can afford otherwise the Transaction should be reverted.

The protocol should implement slippage protection for sellProfits mechanism.

Support

FAQs

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