# Incorrect LEND reward distribution for cross-chain borrows

distributeBorrowerLend() reads crossChainBorrows instead of crossChainCollaterals, so cross-chain borrowers on this chain get zero LEND while off-chain borrowers get rewarded.

- Payout: Audit contest
- Severity: high
- Program: Lend Audit Contest
- Found by: jokr
- Disclosed: 2025-05-22
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2025-05-lend-audit-contest-judging/issues/669
- Library page: https://bugbountylibrary.com/r/sherlock%3A2025-05-lend-audit-contest%3AH-12
- Tags: area:web3 domain:web3 impact:integrity kind:contest platform:sherlock sev:high tech:solidity technique:source-review vuln:accounting-error vuln:reward-distribution

**Target:** LendStorage.distributeBorrowerLend() reward accounting
**Root cause:** distributeBorrowerLend() uses borrowWithInterest(), which aggregates crossChainBorrows (debt originated on this chain) instead of crossChainCollaterals (debt executed on this chain), inverting the reward basis.
**Steps:**
1. Alice borrows 10,000 USDC on Chain A using Chain B collateral -> entry in `crossChainCollaterals[Alice][USDC]` on Chain A.
2. Protocol calls `distributeBorrowerLend()` on Chain A; it computes borrowerAmount via `borrowWithInterest(borrower, lToken)` + `borrowWithInterestSame`.
3. `borrowWithInterest()` reads only `crossChainBorrows`, so Alice's executed-here borrow is ignored -> 0 LEND.
4. Bob borrows on Chain B using Chain A collateral -> entry in `crossChainBorrows[Bob][USDC]` on Chain A; he receives LEND on Chain A despite borrowing elsewhere.
**How found:** Code reading of distributeBorrowerLend() revealed it reused borrowWithInterest(), whose semantics (crossChainBorrows = originated here) mismatch the reward intent (borrows executed here = crossChainCollaterals).
**Exploitation:** No capital or attack needed; the accounting bug misallocates LEND emissions on every distribution cycle, silently under-rewarding local borrowers and over-rewarding remote borrowers.
**Insight:** When a reward/accounting function reuses a debt-view helper, verify the helper's directional semantics (originated-here vs executed-here) match the reward intent; cross-chain protocols commonly store these in two separate mappings.

## Proof of concept (copied exactly from the original report)

**distributeBorrowerLend borrow amount calculation snippet**

```
uint256 borrowerAmount = div_(
    add_(
        borrowWithInterest(borrower, lToken),
        borrowWithInterestSame(borrower, lToken)
    ),
    Exp({ mantissa: LTokenInterface(lToken).borrowIndex() })
);
```

