Open c4-bot-9 opened 11 months ago
This seems valid and serious. Worth adding as user-controlled parameters.
0xleastwood marked the issue as primary issue
Agreed. Will add slippage protection when increase/decrease liquidity.
0xleastwood marked the issue as selected for report
Add label: sponsor confirmed
wukong-particle (sponsor) confirmed
Lines of code
https://github.com/code-423n4/2023-12-particle/blob/a3af40839b24aa13f5764d4f84933dbfa8bc8134/contracts/libraries/LiquidityPosition.sol#L195 https://github.com/code-423n4/2023-12-particle/blob/a3af40839b24aa13f5764d4f84933dbfa8bc8134/contracts/libraries/LiquidityPosition.sol#L258
Vulnerability details
Impact
AddLiquidity and decreaseLiquidity missing slippage protection
Proof of Concept
When user mint NFT add liquidity
user can specify two parameter, params.amount0Min and params.amount1Min
if the minted amount is too small, transaction revert in this check in Uniswap position manager when addling liquidity
However, when addling liquidity, the parameter amount0Min and amount1Min is set to 0
as Uniswap V3 docs highlight
https://docs.uniswap.org/contracts/v3/guides/providing-liquidity/mint-a-position#calling-mint
if the user transaction suffer from frontrunning, a much less amount of token can be minted
same issue happens when user decrease liquidity
the amonut0 and amount1Min are set to 0
when MEV bot frontruns the decrease liquidity, much less amount0 and amount1 are released
Tools Used
Manual Review
Recommended Mitigation Steps
recommend do not hardcode slippage protection parameter amount0Min and amount1Min to 0 when increase liquidity or decrease liquidity
Assessed type
Token-Transfer