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

Lack of slippage control / public function

Summary

There's no slippage control calling uniswapV3. This is a very easy target for MEV and bots to do a flash loan sandwich attack.

Vulnerability Details

Calling uniswap v3 router without setting up a value for slippage tolerance (amountOutMin) means that the protocol can be attacked by sandwich bots.
Also, this function is public, which means that anyone can call this function without setting amountOutMin and frontrunning your swap.

Impact

100% slippage tolerance (amountOutMin = 0) can be exploited in a way that the sellProfits function receive much less value than it should had.

Tools Used

Manual Review

Recommendations

if this feature continues to be public, the recommendation is to do some onchain checks. (take a look at getQuoteAtTick https://docs.uniswap.org/contracts/v3/reference/periphery/libraries/OracleLibrary from uniswap v3)
If this functionality is "closed" by some level of authorization, always check if amountOutMin > 0 (you can also check onchain the asset price and set a hardcoded slippage control value)

Support

FAQs

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