Reproduced Exploit
LEND: cross-chain liquidation cap ignores destination-chain debt
getMaxLiquidationRepayAmount sizes a cross-chain liquidation with borrowWithInterest. That helper sums borrows that originated on the current chain. A borrow whose destination is the current chain, and whose source is another chain, is stored and then skipped. The cap is 0. The router's require(rep…
Loss
A 500 repay of a real 1000 destination-chain debt is rejected. Collateral is not seized
Chain
Ethereum
Category
logic
Date
May 2025
Source
AuditVault
EVM Playground
Source-level debugger — step opcodes and Solidity in sync
The attack is replayed in an in-browser EVM preloaded with the exact dumped fork state. The execution tree shows every call; step by Solidity line or by opcode across all depths — source, Stack, Memory, Storage, Balances (native / ERC-20 / NFT), Transient storage and Return value stay in sync. Click a tree node, opcode, or source line to jump. Query opens a search over the trace: previous and next writes, balance changes and calls, breakpoints, and a diff of everything that changed between two steps. No backend, no live RPC.
Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 58377-h-8-cross-chain-liquidations-will-be-blocked-due-to-incorrec. Standalone Foundry PoC and full write-up: 58377-h-8-cross-chain-liquidations-will-be-blocked-due-to-incorrec_exp in the
evm-hack-registrymirror.
Vulnerability classes:
vuln/logic/liquidation-logic·vuln/bridge/missing-validation
Key info#
| Field | Value |
|---|---|
| Loss | A 500 repay of a real 1000 destination-chain debt is rejected. Collateral is not seized |
| Vulnerable contract | LendStorage.getMaxLiquidationRepayAmount |
| Attacker EOA | 0x1111111111111111111111111111111111111111 |
| Attack contract | Exploit |
| Attack tx | Exploit.run() |
| Chain / block / date | Ethereum model · block 0 · 2025-05 |
| Compiler | solc 0.8.27, cancun, via IR |
| Bug class | Liquidation cap reads only same-chain-origin borrows |
TL;DR#
getMaxLiquidationRepayAmount sizes a cross-chain liquidation with borrowWithInterest. That helper sums borrows that originated on the current chain. A borrow whose destination is the current chain, and whose source is another chain, is stored and then skipped. The cap is 0. The router's require(repayAmount <= maxLiquidationAmount) reverts a 500 repay of a 1000 debt, so the position cannot be liquidated.
The vulnerable code#
currentBorrow += isSameChain
? borrowWithInterestSame(borrower, lToken)
: borrowWithInterest(borrower, lToken); // @> VULN: destination-chain borrows are absent from borrowWithInterest, so the cap is 0
uint256 maxRepay = (currentBorrow * closeFactorMantissa) / 1e18;
borrowWithInterest keeps a collateral row only when destEid == currentEid && srcEid == currentEid. An inbound cross-chain borrow has a different srcEid, so it adds nothing.
The fix counts borrows whose destination is this chain:
- if (collaterals[i].destEid == currentEid && collaterals[i].srcEid == currentEid)
+ if (collaterals[i].destEid == currentEid)
Preconditions#
- Close factor is 50 percent.
- The borrower owes 1000 on this chain from a borrow that originated on another chain.
- No same-chain borrow of that token is open, so the other mapping is empty.
- A liquidator repays 500, the close-factor maximum of the real debt.
Attack walkthrough#
- The destination ledger records principal 1000, source chain 1, destination chain 2.
getMaxLiquidationRepayAmountcallsborrowWithInterestbecause this is not a same-chain liquidation.- The collateral row fails the
srcEid == currentEidfilter.currentBorrowstays 0. maxRepayis 0 times the close factor.- The router reverts
Exceeds max liquidationon a 500 repay. - The control that counts destination borrows returns a cap of 500.
Diagrams#
Impact#
Liquidators cannot close an underwater cross-chain debt on the chain where the collateral sits. In this run the real debt is 1000, the fair close-factor repay is 500, and the computed cap is 0. The collateral that should have been seized stays where it is. Lenders are left with debt that the liquidation path will not reduce.
How to reproduce#
cd 58377-h-8-cross-chain-liquidations-will-be-blocked-due-to-incorrec_exp
forge test -vv
test_exploit_cross_chain_liquidation_cap_is_zero asserts the cap is 0 and the 500 repay reverts. test_control_destination_borrows_allow_half_repay asserts the destination-aware cap is 500.
Sources#
- AuditVault finding: https://github.com/Auditware/AuditVault/blob/main/findings/58377-h-8-cross-chain-liquidations-will-be-blocked-due-to-incorrec.md
- Sherlock judging issue 578: https://github.com/sherlock-audit/2025-05-lend-audit-contest-judging/issues/578
- Blamed function: https://github.com/sherlock-audit/2025-05-lend-audit-contest/blob/main/Lend-V2/src/LayerZero/LendStorage.sol#L573-L591
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 58377-h-8-cross-chain-liquidations-will-be-blocked-due-to-incorrec_exp (evm-hack-registry mirror).
- AuditVault finding: 58377-h-8-cross-chain-liquidations-will-be-blocked-due-to-incorrec.
Alerts & third-party analyses
These dashboards index community alerts tweets, post-mortems, and independent write-ups. Reach them through the protocol name above to cross-check this reproduction against other analyses.