# Multiple Cross-Chain borrows using same collateral

CrossChainRouter.borrowCrossChain doesn't lock collateral before sending LayerZero requests, letting a user borrow against the same collateral on multiple chains and default profitably.

- Payout: Audit contest
- Severity: high
- Program: Lend Audit Contest
- Found by: 0xDgiin
- Disclosed: 2025-05-22
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2025-05-lend-audit-contest-judging/issues/851
- Library page: https://bugbountylibrary.com/r/sherlock%3A2025-05-lend-audit-contest%3AH-20
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:solidity technique:chained vuln:accounting-error vuln:business-logic vuln:race-condition

**Target:** CrossChainRouter.sol borrowCrossChain (LayerZero V2 cross-chain lending)
**Root cause:** borrowCrossChain computes collateral via getHypotheticalAccountLiquidityCollateral but never records/locks the pending borrow in lendStorage before _lzSend; collateral is only registered in _handleValidBorrowRequest after the destination chain confirms, so concurrent requests see full unused collateral.
**Steps:**
1. Supply 1000 USDC collateral on Chain A (75% collateral factor).
2. In one block call `borrowCrossChain` twice: request 1 borrow 750 USDC on Chain B, request 2 borrow 750 USDC on Chain C.
3. Both calls run `getHypotheticalAccountLiquidityCollateral` and see 1000 USDC collateral since no borrow is registered yet.
4. Chain B receives payload, checks `payload.collateral` (1000) >= 750, runs `borrowForCrossChain`, sends 750 USDC to user.
5. Chain C does the same, sends another 750 USDC.
6. Both chains return `ValidBorrowRequest`; Chain A `_handleValidBorrowRequest` registers 1500 USDC total debt.
7. User abandons debt, forfeits 1000 USDC collateral, leaves with $500 in profit.
**How found:** Code review of borrowCrossChain: noticed collateral is only registered in _handleValidBorrowRequest after the async LayerZero round-trip, so the pre-send liquidity check reads stale state — an async-state/TOCTOU gap across chains.
**Exploitation:** Attacker with collateral on Chain A fires multiple borrowCrossChain requests to distinct destination chains in the same block before any ValidBorrowRequest returns. Each destination independently validates against the stale full collateral and disburses funds. Attacker keeps borrowed funds and sacrifices the smaller collateral, netting the difference; scales linearly with number of destination chains.
**Escalation:** Repeat across N destination chains to multiply loss (e.g. ~7500 USDC loss on 10 chains against 10000 USDC collateral).
**Insight:** In async cross-chain lending, any accounting written only on the return message leaves a window where the source chain's liquidity check sees pre-borrow state; look for collateral/debt that is validated before _lzSend but persisted only in the handler callback, and test same-block multi-destination requests.

