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

Autonomint liquidate() sends local noOfLiquidations instead of omniChainData.noOfLiquidations as index, overwriting cross-chain liquidation records and stranding collateral.

- Payout: Audit contest
- Severity: high
- Program: Autonomint
- Found by: 0x37
- Disclosed: 2024-11-26
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2024-11-autonomint-judging/issues/775
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-11-autonomint%3AH-20
- 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:** cross-chain borrowing/liquidation contract (borrowLiquidation.sol)
**Root cause:** liquidate() uses the local noOfLiquidations counter as the liquidation index sent to the destination chain, while liquidations are globally tracked in omniChainData.noOfLiquidations, so indices diverge across chains.
**Steps:**
1. On chain A, perform a liquidation: omniChainData.noOfLiquidations and local noOfLiquidations both become 1; info sent to chain B with index 1.
2. On chain B, perform a liquidation: it receives omniChainData from A, increments to index 2, but sends to chain A using local noOfLiquidations = 1.
3. Chain A receives index 1 and overwrites the existing liquidation record from step 1.
4. Collateral tied to the overwritten liquidation becomes stuck/unwithdrawable.
**How found:** Code reading of the cross-chain liquidation index handling: noticed liquidations are tracked in omniChainData.noOfLiquidations on both chains but the send path uses the local noOfLiquidations, causing divergence.
**Exploitation:** Any liquidation on the second chain after a prior liquidation on the other chain triggers the index collision; no special preconditions or capital required, just normal liquidation flow.
**Insight:** In omnichain protocols, audit every counter used as an identifier across chains: local counters and shared omniChainData counters must stay in sync, and any send path using the local copy will collide after the first remote event.

