Skip to content
Business logic Audit finding Intermediate

Incorrect LEND reward distribution for cross-chain borrows

The reward distribution function uses the wrong borrow records, so users who borrowed on this chain via cross-chain requests get no LEND rewards, while users who borrowed elsewhere but originated the request here receive rewards they should not get.

jokr Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-05-lend-audit-contest-judging/issues/669

Found by

jokr

Summary

The distributeBorrowerLend() function incorrectly uses borrowWithInterest() to determine the borrow amount for distributing LEND rewards. However, borrowWithInterest() returns the sum of all cross-chain borrows of a token that originated from the current chain (stored in crossChainBorrows).

What the function should actually consider are the user's borrows on this chain, regardless of where the borrow was initiated from. In particular, it must include cross-chain collateral records (stored in crossChainCollaterals), which represent borrows executed on this chain using collateral from another chain.

https://github.com/sherlock-audit/2025-05-lend-audit-contest/blob/main/Lend-V2/src/LayerZero/LendStorage.sol#L365-L368

https://github.com/sherlock-audit/2025-05-lend-audit-contest/blob/main/Lend-V2/src/LayerZero/LendStorage.sol#L478-L504

As a result:

  • Users who borrowed on this chain via cross-chain requests from other chains will not receive any LEND rewards.
  • LEND rewards will be distributed based on incorrect borrow values (crossChainBorrows).
  • crossChainBorrows should not be considered for LEND rewards because those borrows were executed elsewhere.

Root Cause

  • The function uses borrowWithInterest(), which returns borrows originated on this chain (crossChainBorrows) instead of borrows executed on this chain (crossChainCollaterals).

Internal Pre-conditions

None

External Pre-conditions

None

Attack Path

Attack Path 1: User gets no rewards despite borrowing on this chain

  1. Alice borrows 10,000 USDC on Chain A using funds on Chain B as collateral (cross-chain borrow).
  2. This creates an entry in crossChainCollaterals[Alice][USDC] on Chain A.
  3. The protocol later calls distributeBorrowerLend() on Chain A to distribute LEND rewards.
  4. Internally, borrowWithInterest() is called, which only reads from crossChainBorrows (i.e., borrows originated from Chain A).
  5. Since Alice's borrow was executed on Chain A (not originated), her borrow is ignored.
  6. Result: Alice receives 0 LEND despite having an active borrow on this chain.

Attack Path 2: User receives rewards despite not borrowing on this chain

  1. Bob initiates a cross-chain borrow of 10,000 USDC on Chain B using his Chain A funds as collateral.
  2. This creates an entry in crossChainBorrows[Bob][USDC] on Chain A.
  3. Bob has no borrow activity on Chain A; he only has crossChainBorrows here, no crossChainCollaterals.
  4. The protocol calls distributeBorrowerLend() on Chain A.
  5. As borrowWithInterest() includes Bob’s crossChainBorrows , rewards will be calculated with that amount.
  6. Result: Bob receives LEND rewards on Chain A for a borrow he actually executed on Chain B .

Impact

  • Users who took cross-chain borrows executed on this chain are excluded from LEND reward distribution.
  • User who actually didn't borrowed funds from this chain will get LEND rewards.

PoC

In distributeBorrowerLend():

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

This calculation:

  • Ignores borrows in crossChainCollaterals, leading to under-rewarding real borrowers on this chain.
  • Includes borrows in crossChainBorrows, which shouldn’t be rewarded here, leading to over-rewarding.

Mitigation

  • Introduce a new function (e.g., borrowWithInterestExecutedHere()) that aggregates borrows from crossChainCollaterals for this chain.
  • In distributeBorrowerLend(), use:
    • Only borrows executed on this chain (i.e., crossChainCollaterals)
    • Exclude crossChainBorrows, as those represent debt executed on other chains and shouldn't be rewarded here.

The original report as published on Sherlock, by jokr. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The function uses borrowWithInterest(), which returns borrows originated on this chain (crossChainBorrows) instead of borrows executed on this chain (crossChainCollaterals).

Impact

Users who borrowed on this chain via cross-chain requests receive no LEND rewards, while users who borrowed on another chain but originated the request here receive rewards they should not get.

What the attacker needed

Cross-chain borrow functionality; reward distribution enabled

The fix

The function should aggregate borrows from crossChainCollaterals (borrows executed on this chain) and exclude crossChainBorrows.

How it was found

  1. Alice borrows on Chain A using collateral on Chain B, creating an entry in crossChainCollaterals on Chain A.
  2. The protocol calls distributeBorrowerLend() on Chain A.
  3. borrowWithInterest() reads only crossChainBorrows, so Alice's borrow is ignored and she gets zero LEND.
  4. Bob borrows on Chain B using collateral on Chain A, creating an entry in crossChainBorrows on Chain A.
  5. distributeBorrowerLend() on Chain A counts Bob's crossChainBorrows and rewards him despite no borrow executed on Chain A.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

This is a cross-chain lending protocol where you can borrow on one blockchain using collateral on another. The reward function mistakenly looks at the wrong list of borrows: it counts borrows that started on this chain but were actually executed elsewhere, and it ignores borrows that were executed here but started elsewhere. So some people get rewards they did not earn, and real borrowers get nothing.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by jokr

View all

5 more disclosed reports, best first.

More from LEND

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.