Skip to content
Business logic Audit finding Intermediate

when the liquidate function(function liquidationType1) is called vaultvalue(liquidated collateral value) is not decreased from omniChainData.vaultValue. As a result, the cds/borrow ratio will always be less than the real cds/borrow ratio

The liquidation function does not reduce the recorded vault value when collateral is allocated to CDS depositors, so the stored CDS/borrow ratio stays lower than the real one. This can wrongly keep the ratio below the 0.2 threshold, preventing users from minting new stablecoins and CDS users from withdrawing.

almurhasan Follow with volodya

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-11-autonomint-judging/issues/351

Found by

almurhasan, volodya

Summary

when the function withdraw(borrowlib.sol) is called, vaultvalue is decreased from omniChainData.vaultValue but when the liquidate function(function liquidationType1) is called vaultvalue(liquidated collateral value) is not decreased from omniChainData.vaultValue. As a result, the cds/borrow ratio will always be less than the actual/real cds/borrow ratio.in some cases, new stable coins should be minted. But as vaultvalue is not decreased from omniChainData.vaultValue, so ratio(which is incorrect) is below 0.2(),now users can’t mint new stablecoin and cds users can’t withdraw.

Root Cause

when the liquidate function(function liquidationType1) is called vaultvalue is not decreased from omniChainData.vaultValue.

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

  1. Let’s assume, currently omniChainData.cdsPoolValue = 350, omniChainData.vaultValue = 2000, so cds/borrow ratio = 350/2000 = 0.175(which is below 0.2, so new stablecoin can’t be minted).

  2. now the liquidate function(function liquidationType1) is called where 400(this is just for example) vaultvalue worth of collateral are allocated for cds depositor but 400 vaultvalue is not decreased from omniChainData.vaultValue. See the function withdraw(borrowlib.sol) where vaultvalue is decreased from omniChainData.vaultValue when users withdraw.

  3. let’s assume, liquidate amount is 20(this is just for example),so 20 is deducted from omniChainData.cdsPoolValue in liquidateType1 function, so current cds/borrow ratio is 350-20/2000 = 330/2000 = 0.16. But the actual cds/borrow ratio is 330/1600 = 0.206(as currently real omniChainData.vaultValue is = 2000-400 = 1600).

  4. In the above example, as the cds/borrow ratio becomes 0.206 from 0.175, so new stable coin should be minted. But as vaultvalue is not decreased from omniChainData.vaultValue, so ratio is below 0.2(0.16),now users can’t mint new stablecoin and cds users can’t withdraw.

https://github.com/sherlock-audit/2024-11-autonomint/blob/main/Blockchain/Blockchian/contracts/Core_logic/borrowLiquidation.sol#L174

Impact

the cds/borrow ratio will always be less than the actual/real cds/borrow ratio.in some cases, new stable coin should be minted. But as vaultvalue is not decreased from omniChainData.vaultValue, so ratio(which is incorrect) is below 0.2(),now users can’t mint new stablecoin and cds users can’t withdraw.

PoC

No response

Mitigation

when the liquidate function(function liquidationType1) is called vaultvalue should be decreased from omniChainData.vaultValue

The original report as published on Sherlock, by almurhasan. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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 liquidation function fails to subtract the liquidated collateral value from the global vault value, unlike the withdraw function which does update it.

Impact

The incorrect ratio can remain below 0.2 even when the real ratio is above it, preventing users from minting new stablecoins and CDS users from withdrawing.

What the attacker needed

A liquidation event occurs

The fix

The liquidation function should decrease the vault value by the liquidated collateral amount, as the withdraw function does.

How it was found

  1. Assume the CDS pool value is 350 and the vault value is 2000, giving a ratio of 0.175, below the 0.2 threshold.
  2. Call the liquidation function (liquidationType1) where 400 worth of collateral is allocated to CDS depositors, but the vault value is not reduced.
  3. Assume the liquidation amount is 20, so the CDS pool value becomes 330, but the vault value stays 2000, giving a ratio of 0.16 instead of the real 0.206.
  4. Because the stored ratio remains below 0.2, users cannot mint new stablecoins and CDS users cannot withdraw.

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.

A smart contract tracks two pools of money: one for borrowers and one for savers (CDS). It uses the ratio between them to decide if new stablecoins can be created or savers can take their money out. When a borrower is liquidated, some collateral is moved to the savers' pool, but the contract forgets to update the total value of the borrowers' pool, so the ratio it calculates is wrong and too low.

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.

More by almurhasan

View all

2 more disclosed reports, best first.

More from Autonomint Colored Dollar V1

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.