Skip to content
Business logic Audit finding Advanced

`borrowing::liquidate()` sends the wrong liquidation index to the destination chain, overwritting liquidation information and getting collateral stuck

The liquidate function sends a local liquidation counter as the index to the destination chain instead of the shared omnichain counter. When liquidations occur on two chains, the second one overwrites the first one's record on the destination chain, leaving collateral stuck.

0x37 Follow with 0x73696d616f and santiellena

Originally disclosed on Sherlock

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

Found by

0x37, 0x73696d616f, santiellena

Summary

borrowing::liquidate() sends the noOfLiquidations variable as liquidation index to the other chain. However, liquidations are tracked in omniChainData.noOfLiquidations, on both chains. For example, if a liquidation happens on chain A, it increases to 1 and sends this information to chain B. If a liquidation happens on chain B, it will have index 2, not 1.

Root Cause

In borrowing:402, the wrong variable is sent as liquidation index to the other chain.

Internal pre-conditions

None.

External pre-conditions

None.

Attack Path

  1. Liquidation happens on chain A, incrementing omniChainData.noOfLiquidations to 1 and noOfLiquidations to 1 also.
  2. Liquidation happens on chain B, with index 2 (it received the omnichain data from chain A and then incremented it). In chain B, it sends the liquidation info to chain A, but sends with index 1, not 2, as it uses the local noOfLiquidations to send the index.
  3. Chain A will have liquidation info with index 1 overiwritten by the liquidation of chain B, leading to stuck collateral of the first liquidation in chain A (as long as depositors have not withdraw, but if they have, they can't withdraw the second liquidation anyway).

Impact

Stuck collateral.

PoC

See above.

Mitigation

Pass in the correct index, given by omnichainData.noOfLiquidations.

The original report as published on Sherlock, by 0x37. 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 code passed the local noOfLiquidations counter as the liquidation index to the destination chain instead of the shared omniChainData.noOfLiquidations value.

Impact

Collateral from the overwritten liquidation could become stuck, though the report notes depositors may still withdraw if they have not already done so.

What the attacker needed

Liquidations on two different chains

The fix

The correct index should be passed using the shared omnichain liquidation counter.

How it was found

  1. A liquidation on chain A increments both the shared and local liquidation counters to 1.
  2. A liquidation on chain B uses index 2 locally because it received the shared data from chain A and incremented it.
  3. Chain B sends the liquidation information to chain A using its local counter value of 1 instead of 2.
  4. Chain A overwrites the record stored under index 1 with chain B's liquidation, so the first liquidation's collateral becomes stuck.

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.

This is a cross-chain lending protocol where liquidations happen on more than one blockchain. Each liquidation is stored under a number (an index), and the code used a per-chain counter instead of the shared counter, so two different liquidations got the same number and one replaced the other. As a result, the collateral from the first liquidation could no longer be found or withdrawn.

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 0x37

View all

79 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.