# Cds amounts to reduce from each chain are incorrect and will lead to the inability to withdraw cds in one of the chains

Cross-chain CDS liquidation accounting uses deposit-share instead of liquidation-amount share, overcharging the largest chain and underflowing totalCdsDepositedAmount, blocking CDS withdrawals.

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

**Target:** CDSLib/BorrowLib cross-chain liquidation accounting
**Root cause:** CDSLib reduces totalCdsDepositedAmount by depositedAmount minus liquidationAmount, but BorrowLib computes per-chain shares from CDS deposit amounts rather than available liquidation amounts, so the two calculations disagree.
**Steps:**
1. Set chain A: 1000 CDS deposited, 1000 available liquidation; chain B: 19000 CDS deposited, 1000 available liquidation.
2. Liquidate borrower with 1 ETH at 1000 USD/ETH, 800 borrowed.
3. getLiquidationAmountProportions yields shares 0.05/0.95, _liqAmount 820, liqAmountToGet 41/779, cdsProfits 9/171, cdsAmounts 32/608.
4. Chain B users withdraw 18000 CDS; only liquidation-providing depositor remains: 19000-18000-608=392.
5. Loop applies 50% share: liquidationAmount = 1000 - 0.5*820 = 590.
6. totalCdsDepositedAmount -= (1000-590) => 392-410 = -18, underflow reverting withdrawals.
**How found:** Compared the share basis in BorrowLib::getLiquidationAmountProportions (CDS deposit amounts) against the reduction basis in CDSLib (depositedAmount - liquidationAmount), then constructed a two-chain numeric example to show the mismatch underflows.
**Exploitation:** Trigger liquidations across chains where CDS deposit amounts diverge from available liquidation amounts; the overcharged chain's totalCdsDepositedAmount underflows, permanently blocking CDS withdrawals on that chain.
**Insight:** When two functions split the same pool, verify both use the same denominator; here deposit-share vs liquidation-share divergence lets the larger depositor base absorb the charge and underflow the accounting.

