Cds depositors profit up to the strike price is not redeemable as the total cds deposited amount is not increased
Summary
Cds depositors get the profit on the eth price increase up to the strike price (5%), and any increase above this threshold goes to the borrowers. However, this amount is never added to the total cds deposited amount, which means that cds depositors can not actually withdraw it as it would underflow.
Root Cause
In borrowing.sol:667/667, the upside is not added to omniChainData.totalCdsDepositedAmount.
Internal pre-conditions
None.
External pre-conditions
None.
Attack Path
- Price increase of a borrower deposit, who withdraws.
- The upside is not added to the total cds deposited amount, so the cds depositors can not withdraw this profit or it underflows.
Impact
Cds depositors upside is not withdrawable and will underflow.
PoC
Here the upside is not added to the total cds deposited amount, which means that it will underflow when cds depositors withdraw the profit here. The profit is added here.
Mitigation
Add the upside to omniChainData.totalCdsDepositedAmount.