Liquidation profit is never given to cds depositors who will take these losses
Liquidation profits are calculated and stored but never distributed to CDS depositors when they withdraw, so depositors bear losses instead of receiving profits.
0x73696d616f Follow with volodya
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2024-11-autonomint-judging/issues/750
Found by
0x73696d616f, volodya
Summary
Liquidation profit is calculated in borrowingLiquidation::liquidationType1(), but is actually never handled and given to cds depositors. It is stored and added to totalCdsDepositedAmount, but it is missing the functionality to send the profits to cds depositors in CDSLib::withdrawUser().
Root Cause
In CDSLib::withdrawUser(), the cds profits stored in omniChainCDSLiqIndexToInfo are not given to the cds depositors.
Internal pre-conditions
None.
External pre-conditions
None.
Attack Path
- Borrower is liquidated, cds profits are calculated but when the cds depositors withdraw, they do not receive these profits.
Impact
Cds depositors take losses on liquidation instead of profiting.
PoC
See the links above.
Mitigation
Calculate the share of the profits and send to the cds depositors.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the withdrawal function for CDS depositors does not include the stored liquidation profits in the amount returned.
Impact
CDS depositors take losses on liquidation instead of profiting.
What the attacker needed
None
The fix
The share of the profits should be calculated and sent to the CDS depositors.
How it was found
- A borrower is liquidated, and CDS profits are calculated.
- CDS depositors withdraw but do not receive these profits.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When a borrower is liquidated, the system makes a profit that should go to people who deposited into a pool called CDS. The code calculates this profit and saves it, but when those depositors withdraw their money, the profit is not added. So they lose out.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.