code-423n4 / 2024-06-vultisig-findings

2 stars 0 forks source link

0 slippage for pool launch could lead to DoS #201

Closed howlbot-integration[bot] closed 5 months ago

howlbot-integration[bot] commented 5 months ago

Lines of code

https://github.com/code-423n4/2024-06-vultisig/blob/cb72b1e9053c02a58d874ff376359a83dc3f0742/src/ILOPool.sol#L285-L303

Vulnerability details

Impact

The current implementation of adding liquidity to the Uniswap pool sets amount0Min equal to amount0 and amount1Min equal to amount1, resulting in zero slippage tolerance. This means that the transaction will only succeed if the exact desired amounts are met, which is highly unlikely due to market fluctuations, leading to a high risk of failed transactions.

Proof of Concept

if (token0Addr == RAISE_TOKEN) {
    amount0 = totalRaised;
    amount0Min = totalRaised;
    (amount1, liquidity) = _saleAmountNeeded(totalRaised);
} else {
    (amount0, liquidity) = _saleAmountNeeded(totalRaised);
    amount1 = totalRaised;
    amount1Min = totalRaised;
}

// actually deploy liquidity to uniswap pool
(amount0, amount1) = addLiquidity(AddLiquidityParams({
    pool: IUniswapV3Pool(uniV3PoolAddress),
    liquidity: liquidity,
    amount0Desired: amount0,
    amount1Desired: amount1,
    amount0Min: amount0Min,
    amount1Min: amount1Min
}));

Tools Used

Manual review.

Recommended Mitigation Steps

Add some slippage (0.5% for example) to addLiquidity function call.

Assessed type

DoS

c4-judge commented 4 months ago

alex-ppg changed the severity to QA (Quality Assurance)

c4-judge commented 4 months ago

alex-ppg marked the issue as grade-c