# Market coordinator can liquidate all users in the market

Malicious market coordinator sets margin/maintenance ratios and fees to extreme values, liquidating all users and harvesting fees.

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

**Target:** Perennial V2 market coordinator risk parameters (RiskParameter.sol)
**Root cause:** Margin/maintenance ratios and min amounts have only downside limits, no upside cap or timelock, so a coordinator can set them to extreme values making all positions unhealthy.
**Steps:**
1. Coordinator sets max margin ratio, maintenance ratio, liquidation fee and all other fees via market parameter update
2. Coordinator liquidates all maker positions
3. Coordinator opens a small maker position to become sole maker
4. Coordinator liquidates all takers; closure fees (e.g. 1%) accrue to coordinator's maker
5. Coordinator closes maker position and withdraws all collateral
**How found:** Read README's stated acceptable-risk boundary (coordinator operating within reasonable protocol parameters), then reviewed RiskParameter.sol and noticed only downside limits exist on margin/maintenance with no timelock or upside cap.
**Exploitation:** Coordinator abuses broad parameter control: inflate margin/maintenance to make every position liquidatable, set max fees, liquidate makers then takers, capture percentage-based closure fees as sole maker, then withdraw.
**Escalation:** Chained parameter manipulation with liquidation to convert fee capture into theft from all market users.
**Insight:** When a privileged role controls risk parameters, check whether limits are one-sided; missing upside caps plus no timelock let a trusted actor force mass liquidations and harvest fees.

