When user Decrease NFT liquidity, params.amount0Min and params.amount1Min should be specified if we want to be protected from sandwich attacks. If the user transaction suffers from frontrunning, a much less amount of tokens can be received when liquidity is decreased. This means that if MEV bot frontruns the decrease liquidity with large amount, liquidator can receive tokens valuated less than the debt that he has just repaid.
Inside uniswap documentation it is written that "In production, amount0Min and amount1Min should be adjusted to create slippage protections.", because this is serious concern, which affectsr user resources.
Calls amount0Min and amount1Min are each set to 0, which allows for a 100% slippage tolerance. This means, that the action could lead to the caller losing up to 100% of their tokens due to slippage.
Impact: Exposure to high slippage that could result in a loss for liquidators, who in reality should benefit from this operation.
Lines of code
https://github.com/code-423n4/2024-03-revert-lend/blob/435b054f9ad2404173f36f0f74a5096c894b12b7/src/V3Vault.sol#L1065-L1067
Vulnerability details
Impact
When user Decrease NFT liquidity, params.amount0Min and params.amount1Min should be specified if we want to be protected from sandwich attacks. If the user transaction suffers from frontrunning, a much less amount of tokens can be received when liquidity is decreased. This means that if MEV bot frontruns the decrease liquidity with large amount, liquidator can receive tokens valuated less than the debt that he has just repaid. Inside uniswap documentation it is written that "In production, amount0Min and amount1Min should be adjusted to create slippage protections.", because this is serious concern, which affectsr user resources. Calls amount0Min and amount1Min are each set to 0, which allows for a 100% slippage tolerance. This means, that the action could lead to the caller losing up to 100% of their tokens due to slippage. Impact: Exposure to high slippage that could result in a loss for liquidators, who in reality should benefit from this operation.
The same check is missed inside AutoCompound.execute
Proof of Concept
Tools Used
Manual Review
Recommended Mitigation Steps
amount0Min
andamount1Min
, orAssessed type
MEV