# Maliciously specifying a very large intent.price will result in a large gain at settlement, stealing funds

Perennial V2 lacked a bound on Intent.price, letting a trader settle an order at an inflated price and mint huge PnL collateral from a tiny deposit.

- Payout: Audit contest
- Severity: high
- Program: Perennial
- Found by: bin2chen
- Disclosed: 2024-08-17
- Write-up quality: 8/10
- Original: https://github.com/sherlock-audit/2024-08-perennial-v2-update-3-judging/issues/42
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-08-perennial-v2-update-3%3AH-4
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** Perennial V2 Market.sol order settlement / CheckpointLib
**Root cause:** CheckpointLib computes override pnl as (toVersion.price - Intent.price) * taker() and credits it to collateral, but order creation never bounds Intent.price relative to lastVersion.price nor requires collateral for the price deviation.
**Steps:**
1. Deposit small collateral on Alice and a fake counterparty account, each just above position * lastVersion.price.
2. Call `market.update(account, Intent{account: fakeUser, position: 5, price: 1250000000000})` with lastVersion.price=123; order accepted since collateral check only uses position*lastVersion.price.
3. Call `settle(alice)`; pnl = (Intent.price - lastVersion.price) * position = (1250000000000-123)*5 credited to Alice's collateral.
4. Withdraw inflated collateral; fake counterparty eats the loss but only forfeits its tiny deposit.
**How found:** Code reading of CheckpointLib settlement pnl formula versus the order-creation collateral check, noticing Intent.price is unbounded while collateral only depends on position*lastVersion.price.
**Exploitation:** Attacker controls both sides of an intent order, sets an absurd Intent.price, posts minimal collateral on each account, settles to realize the inflated PnL as withdrawable collateral, abandoning the losing fake account's small deposit.
**Insight:** When a settlement/PnL formula uses a user-supplied price field, check whether the collateral requirement at order creation references that same price; if it only references the oracle/last price, the delta is free money.

