# Cds depositors profit up to the strike price is not redeemable as the total cds deposited amount is not increased

Autonomint borrowing.sol fails to add CDS depositor upside profit to totalCdsDepositedAmount, causing underflow when CDS depositors withdraw their earned profit.

- 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/743
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-11-autonomint%3AH-13
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** borrowing.sol / CDS.sol accounting
**Root cause:** In borrowing.sol the CDS depositors' upside (profit up to strike price) is credited to CDS but never added to omniChainData.totalCdsDepositedAmount, so the aggregate accounting understates the redeemable balance.
**Steps:**
1. Borrower deposit experiences ETH price increase and withdraws.
2. Upside profit is credited to CDS via CDS.sol:343 but omniChainData.totalCdsDepositedAmount is not incremented at borrowing.sol:665.
3. CDS depositor attempts withdrawal of profit at CDSLib.sol:713; subtraction underflows, reverting the withdrawal.
**How found:** Code review of the borrowing withdrawal path comparing where profit is credited (CDS.sol) versus where the aggregate totalCdsDepositedAmount is updated (borrowing.sol), spotting the missing increment.
**Exploitation:** No attacker action; the accounting bug blocks legitimate CDS depositors from withdrawing earned upside profit because the withdrawal math underflows.
**Insight:** When profit is credited to one accounting bucket, trace every aggregate counter that must mirror it; a credit without a matching total increment causes underflow on later withdrawal math.

