# Liquidation will reduce total cds deposited amount, leading to incorrect option fees

Liquidation reduces totalCdsDepositedAmount but not normalized deposits, so option fee rate is computed on a shrunken base, overpaying CDS depositors.

- Payout: Audit contest
- Severity: high
- Program: Autonomint
- Found by: 0x73696d616f
- Disclosed: 2024-11-26
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-11-autonomint-judging/issues/993
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-11-autonomint%3AH-29
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high technique:source-review vuln:accounting-error vuln:liquidation vuln:reward-distribution

**Target:** borrowLiquidation.liquidationType1 / CDS cumulative rate accounting
**Root cause:** liquidationType1 reduces omniChainData.totalCdsDepositedAmount without adjusting the normalized deposits used to compute the cumulative option-fee rate, so percentageChange is divided by a too-small base.
**Steps:**
1. ETH=1000; CDS depositor deposits 1000 USDa (normalized 1000).
2. Borrower deposits 1 ETH, borrows 800 USDa.
3. Price drops to 800; borrower liquidated, totalCdsDepositedAmount becomes 360 (1000-(800+20-180)).
4. New borrower pays 50 USD option fee; CDSLib.calculateCumulativeRate computes percentageChange = 50/360, rate = 1.1389.
5. Borrower withdraws; CDS depositor withdraws and receives 1000*1.1389-1000 = 138.9 in fees instead of correct amount.
**How found:** Code reading of liquidationType1 noting totalCdsDepositedAmount is decremented while normalized deposits remain unchanged, then tracing calculateCumulativeRate's percentageChange division.
**Exploitation:** Attacker (CDS depositor) waits for a liquidation to shrink totalCdsDepositedAmount, then a new borrower's option fee is divided by the reduced base, inflating the cumulative rate; depositor withdraws to harvest excess fees.
**Insight:** When a protocol tracks a global total for rate/fee math, check every path that mutates that total (liquidations, bad-debt writeoffs) against the per-user normalized shares that feed the same rate calculation.

