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.

May 2025•Ethereum•logic•3 min read

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

evm-hack-analyzer

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.

Loading fork state…

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-registry mirror.


Vulnerability classes: vuln/logic/reward-calculation

Key info#

FieldValue
LossAlice, who borrowed 10000 on this chain, gets 0 LEND. Bob, who did not, is minted 10000 LEND
Vulnerable contractLendStorage.distributeBorrowerLend
Attacker EOA0x1111111111111111111111111111111111111111 (Bob)
Attack contractExploit
Attack txExploit.run()
Chain / block / dateEthereum model · block 0 · 2025-05
Compilersolc 0.8.27, cancun, via IR
Bug classReward 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#

SOLIDITY
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 crossChainBorrows row of 10000 with srcEid equal to this chain.
  • Alice has a crossChainCollaterals row of 10000 with destEid equal to this chain and a different srcEid.
  • The borrow-side LEND index moves from 1e36 to 2e36. Both notionals use borrow index 1e18.

Attack walkthrough#

  1. Record Bob's originated-here borrow and Alice's executed-here borrow.
  2. Distribute to Bob. borrowerAmount is 10000e18 and accrual is 10000e18.
  3. Distribute to Alice. borrowerAmount is 0.
  4. Bob claims 10000 LEND.

Diagrams#

flowchart TD A["Bob crossChainBorrows 10000"] --> C["distributeBorrowerLend"] B["Alice crossChainCollaterals 10000"] --> C C --> D["VULN borrowWithInterest reads only crossChainBorrows"] D --> E["Bob accrued 10000 LEND"] D --> F["Alice accrued 0"] E --> G["claim mints 10000 LEND to Bob"]

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#

BASH
cd 58381-h-12-incorrect-lend-reward-distribution-for-cross-chain-borr_exp
forge test -vv

Captured output is output.txt.

Sources#


Sources & further analysis#

Reproductions & code

Alerts & third-party analyses

  • Web3Sec X hacked database: search.
  • Rekt leaderboard: search.
  • Solodit incident search: search.

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.