# Missing Update to `omnichain.totalAvailableLiquidationAmount` in `withdrawUser`

Autonomint's withdrawUser fails to decrement omnichain.totalAvailableLiquidationAmount, inflating the CDS pool and locking undistributed liquidation gains.

- Payout: Audit contest
- Severity: high
- Program: Autonomint
- Found by: 0x37
- Disclosed: 2024-11-26
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-11-autonomint-judging/issues/930
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-11-autonomint%3AH-28
- Tags: area:web3 domain:web3 impact:funds-loss impact:integrity kind:contest platform:sherlock sev:high tech:solidity vuln:accounting-error vuln:business-logic

**Target:** CDSLib.sol withdrawUser / omnichain accounting state
**Root cause:** withdrawUser reduces the CDS pool but never subtracts the withdrawn amount from omnichain.totalAvailableLiquidationAmount, unlike deposit which keeps it in sync.
**Steps:**
1. Set omnichain.totalAvailableLiquidationAmount = 1,000,000 USDa.
2. Call withdrawUser for 200,000 USDa; observe totalAvailableLiquidationAmount stays 1,000,000 instead of 800,000.
3. Trigger liquidation generating 500,000 USDa gains; share math uses inflated 1,000,000 denominator.
4. Observe ~100,000 USDa of gains remain undistributed/locked.
**How found:** Compared the deposit path (which updates totalAvailableLiquidationAmount) against the withdraw path and noticed the asymmetric accounting update.
**Exploitation:** Any CDS depositor withdraws funds; the stale inflated totalAvailableLiquidationAmount is then used as the denominator in liquidation share calculations, so a portion of liquidation gains is never distributed and stays locked in the pool.
**Insight:** When auditing accounting invariants, diff every state variable written in a deposit/mint path against its symmetric withdraw/burn path; missing decrements in the reverse path inflate share denominators.

