# KolanHook: spot-price settlement drain via ungated accept()

KolanHook settled expired buy-windows at the same Uniswap v4 pool's spot price with no TWAP or bound, letting an attacker flash-loan, manipulate spot, and drain 2.31 ETH of escrowed funds.

- Payout: Real-world hack
- Severity: high
- Program: KolanHook
- Analysis by: DeFiHackLabs
- Disclosed: 2026-10-15
- Write-up quality: 8/10
- Original: https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/2026-10/KolanHook_exp.sol
- Library page: https://bugbountylibrary.com/r/dhl%3A20261015-kolanhook
- Tags: area:web3 domain:web3 impact:funds-loss kind:incident platform:defihacklabs sev:high tech:evm tech:solidity technique:chained technique:source-review vuln:access-control vuln:business-logic vuln:flash-loan vuln:oracle-manipulation

**Target:** Uniswap v4 hook (KolanHook) ETH/KLN pool settlement
**Root cause:** accept() is ungated after window expiry and _closeWindow() settles at the same pool's instantaneous spot price with no TWAP or slippage bound, re-injecting escrowed ETH as single-sided liquidity and running an unbounded buyback.
**Steps:**
1. Flash-borrow 6.7 WETH from Balancer Vault (fee 0) and unwrap to ETH.
2. Under PoolManager.unlock, swap 6.7 ETH -> KLN (zeroForOne, exact-in) to move pool spot.
3. Call `accept(10)` and `accept(42)` on two expired windows not owned by attacker; window 42 is no longer backInPlace so escrowed ETH is mispositioned as single-sided liquidity around manipulated price.
4. Under a second unlock, reverse-swap full KLN balance back to ETH through the freshly placed ETH liquidity, receiving 7.979914 ETH.
5. Re-wrap 6.7 WETH and repay Balancer loan; net ~1.279453 ETH profit.
**How found:** Reading verified source: noticed accept() only guards `msg.sender != w.owner && block.timestamp < w.expiry`, so any address can settle expired windows; and _closeWindow() reads live `getSlot0` spot with no TWAP and swaps with `sqrtPriceLimitX96 = MIN_SQRT_PRICE + 1` (no bound), making settlement manipulable.
**Exploitation:** Attacker EOA deployed a helper contract inside the attack tx, flash-borrowed 6.7 WETH from Balancer, unwrapped to ETH, moved the KLN spot via a v4 swap, called accept() on two expired windows it did not own to force _closeWindow() to misposition escrowed ETH as single-sided liquidity and run an unbounded buyback, then reverse-swapped KLN back through that liquidity for 7.979914 ETH, repaid the loan, and kept ~1.279453 ETH net.
**Escalation:** Chained flash loan + spot manipulation + permissionless settlement of others' expired windows to drain the full 2.309861 ETH of escrowed window funds.
**Insight:** In Uniswap v4 hook designs, check whether settlement/close paths read the same pool's live slot0 price and whether the settle function is permissionless after expiry — either alone enables flash-loan spot manipulation to misprice escrowed funds.

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

**Flash loan, swap, accept expired windows, reverse swap**

```
function attack() external {
        address[] memory tokens = new address[](1);
        tokens[0] = WETH_ADDR;
        uint256[] memory amounts = new uint256[](1);
        amounts[0] = FLASH_AMOUNT;
        VAULT.flashLoan(address(this), tokens, amounts, "");
    }
```

**Flash loan callback unwraps WETH**

```
function receiveFlashLoan(
        address[] memory, /*tokens*/
        uint256[] memory, /*amounts*/
        uint256[] memory, /*feeAmounts*/
        bytes memory /*userData*/
    ) external {
        require(msg.sender == BALANCER_VAULT, "only vault");

        // Unwrap the borrowed WETH so it can be settled as native ETH into the v4 pool.
        WETH9.withdraw(FLASH_AM
```

