# Cross-chain liquidations will be blocked due to incorrect maxLiquidatable amount calculation.

getMaxLiquidationRepayAmount uses borrowWithInterest which omits destination-chain cross-chain borrows, returning 0 and blocking valid cross-chain liquidations.

- Payout: Audit contest
- Severity: high
- Program: Lend Audit Contest
- Found by: 0xc0ffEE
- Disclosed: 2025-05-22
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2025-05-lend-audit-contest-judging/issues/578
- Library page: https://bugbountylibrary.com/r/sherlock%3A2025-05-lend-audit-contest%3AH-8
- Tags: area:web3 domain:web3 impact:dos kind:contest platform:sherlock sev:high tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:business-logic vuln:liquidation

**Target:** LendStorage cross-chain liquidation validation (Solidity/LayerZero)
**Root cause:** getMaxLiquidationRepayAmount calls borrowWithInterest(), which only sums borrows originating on the current chain, ignoring borrows whose destination is the current chain, so maxRepay is 0 for destination-chain positions.
**Steps:**
1. Alice borrows $1000 on Chain B originating from Chain A (cross-chain borrow).
2. Position becomes undercollateralized.
3. Liquidator calls cross-chain liquidation on Chain B for $500.
4. _validateAndPrepareLiquidation computes maxLiquidationAmount via getMaxLiquidationRepayAmount(borrower, lToken, false).
5. borrowWithInterest returns 0 since no borrows originated on Chain B.
6. maxRepay = 0, require(repayAmount <= maxLiquidationAmount) reverts 'Exceeds max liquidation'.
**How found:** Code reading of getMaxLiquidationRepayAmount and borrowWithInterest revealed the function only aggregates borrows originating from the current chain, not destination-chain cross-chain borrows, causing the cap to be zero.
**Insight:** When auditing cross-chain lending, verify that borrow/collateral aggregation functions distinguish origin vs destination chain; a helper named for 'borrows' may silently exclude inbound cross-chain debt, zeroing liquidation caps.

