# `OptionTokenV4.exerciseLP`'s `addLiquidity` lack of slippage can be abused to make victims exercise for a lower liquidity than intended

OptionTokenV4.exerciseLP computes paymentAmountToAddLiquidity from spot reserves with no lpAmount slippage check, letting an attacker imbalance the pool so victims burn options for ~9% of intended LP.

- Payout: Audit contest
- Severity: high
- Program: Velocimeter
- Found by: 0xpiken
- Disclosed: 2024-06-27
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2024-06-velocimeter-judging/issues/199
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-06-velocimeter%3AH-5
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:evm tech:solidity technique:chained technique:source-review vuln:business-logic vuln:oracle-manipulation

**Target:** OptionTokenV4.exerciseLP / Pair.addLiquidity (Solidity AMM)
**Root cause:** exerciseLP derives paymentAmountToAddLiquidity from spot reserves and passes min amounts of 1 to addLiquidity, so the minted lpAmount is never bounded by user intent; an imbalanced pool yields far fewer LP tokens for the same fixed _amount of option tokens.
**Steps:**
1. Attacker front-runs by swapping underlyingToken into the Pair repeatedly (e.g. 1000x 1e18) to skew reserves, cheapening paymentToken reserve.
2. Victim calls exerciseLP; contract reads spot reserves via getReserves and computes `paymentAmountToAddLiquidity = (_amount * paymentReserve) / underlyingReserve`.
3. Router.addLiquidity is called with amountAMin=1, amountBMin=1, so no slippage revert occurs.
4. Pair.mint computes `liquidity = min(_amount0*totalSupply/reserve0, _amount1*totalSupply/reserve1)`, yielding far fewer LP tokens than a balanced pool would.
5. Attacker swaps back to restore pool and captures the difference; PoC shows ~9% of unmanipulated LP value.
**How found:** Reviewer noticed addLiquidity is called with min amounts of 1 and that paymentAmountToAddLiquidity is computed from spot reserves while _amount is fixed, then reasoned that pool imbalance directly reduces minted liquidity and wrote a Foundry PoC swapping 1000 times to quantify the loss.
**Exploitation:** Attacker sandwiches the victim's exerciseLP: front-run swaps skew the pool so the proportional paymentAmountToAddLiquidity shrinks, victim burns the same fixed option _amount for drastically fewer LP tokens, attacker back-runs to restore reserves and profit.
**Insight:** When a contract computes a proportional deposit from spot reserves and passes minAmount=1 to the router, the minted LP is a function of pool imbalance — check whether the caller's fixed input amount can be sandwiched to shrink output.

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

**addLiquidity call with min amounts 1**

```
(, , lpAmount) = IRouter(router).addLiquidity( /// @audit I need to do the math here to see the gain when
            underlyingToken,
            paymentToken,
            false,
            _amount,
            paymentAmountToAddLiquidity,
            1,
            1,
            address(this),
            block.timestamp
        );
```

