Reproduced Exploit
LEND: cross-chain borrows pay the wrong user 10000 LEND
distributeBorrowerLend sets borrowerAmount from borrowWithInterest. That helper sums crossChainBorrows (debt originated on this chain, executed elsewhere) and skips real crossChainCollaterals (debt executed here). Bob is paid 10000 LEND. Alice is paid 0.
Loss
Alice, who borrowed 10000 on this chain, gets 0 LEND. Bob, who did not, is minted 10000 LEND
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: 58381-h-12-incorrect-lend-reward-distribution-for-cross-chain-borr. Standalone Foundry PoC and full write-up: 58381-h-12-incorrect-lend-reward-distribution-for-cross-chain-borr_exp in the
evm-hack-registrymirror.
Vulnerability classes:
vuln/logic/reward-calculation
Key info#
| Field | Value |
|---|---|
| Loss | Alice, who borrowed 10000 on this chain, gets 0 LEND. Bob, who did not, is minted 10000 LEND |
| Vulnerable contract | LendStorage.distributeBorrowerLend |
| Attacker EOA | 0x1111111111111111111111111111111111111111 (Bob) |
| 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 | Reward base reads the wrong cross-chain mapping |
TL;DR#
distributeBorrowerLend sets borrowerAmount from borrowWithInterest. That helper sums crossChainBorrows (debt originated on this chain, executed elsewhere) and skips real crossChainCollaterals (debt executed here). Bob is paid 10000 LEND. Alice is paid 0.
The vulnerable code#
uint256 borrowerAmount = div_(add_(borrowWithInterest(borrower, lToken_), borrowWithInterestSame(borrower, lToken_)), Exp({mantissa: LToken(lToken_).borrowIndex()})); // @> VULN: borrowWithInterest counts crossChainBorrows and ignores borrows executed on this chain
borrowWithInterest enters the borrows.length > 0 branch and never looks at collaterals. The collateral branch itself also requires srcEid == destEid == currentEid, which a real cross-chain collateral row does not satisfy.
Root cause#
The reward base is "where the borrow record was created" rather than "where the cash was borrowed".
Preconditions#
- Bob has a
crossChainBorrowsrow of 10000 withsrcEidequal to this chain. - Alice has a
crossChainCollateralsrow of 10000 withdestEidequal to this chain and a differentsrcEid. - The borrow-side LEND index moves from
1e36to2e36. Both notionals use borrow index1e18.
Attack walkthrough#
- Record Bob's originated-here borrow and Alice's executed-here borrow.
- Distribute to Bob.
borrowerAmountis 10000e18 and accrual is 10000e18. - Distribute to Alice.
borrowerAmountis 0. - Bob claims 10000 LEND.
Diagrams#
Impact#
LEND emissions on this chain are paid to users whose debt was executed elsewhere, and withheld from users whose debt was executed here. In this distribution that is a 10000 LEND misallocation.
Remediation#
Size borrowerAmount from borrows executed on this chain (crossChainCollaterals plus same-chain debt) and exclude crossChainBorrows.
How to reproduce#
cd 58381-h-12-incorrect-lend-reward-distribution-for-cross-chain-borr_exp
forge test -vv
Captured output is output.txt.
Sources#
- AuditVault finding: https://github.com/Auditware/AuditVault/blob/main/findings/58381-h-12-incorrect-lend-reward-distribution-for-cross-chain-borr.md
- Sherlock issue 669: https://github.com/sherlock-audit/2025-05-lend-audit-contest-judging/issues/669
- Blamed function: https://github.com/sherlock-audit/2025-05-lend-audit-contest/blob/main/Lend-V2/src/LayerZero/LendStorage.sol#L365
- Taxonomy: genome reward-accounting, reward-calculation, variant, math-is-safe, fix-arithmetic. Tags severity/high, sector/lending, sector/bridge, sector/stable, platform/sherlock.
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 58381-h-12-incorrect-lend-reward-distribution-for-cross-chain-borr_exp (evm-hack-registry mirror).
- AuditVault finding: 58381-h-12-incorrect-lend-reward-distribution-for-cross-chain-borr.
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.