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.
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.
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).
crossChainBorrowsshould 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
- Alice borrows 10,000 USDC on Chain A using funds on Chain B as collateral (cross-chain borrow).
- This creates an entry in
crossChainCollaterals[Alice][USDC]on Chain A. - The protocol later calls
distributeBorrowerLend()on Chain A to distribute LEND rewards. - Internally,
borrowWithInterest()is called, which only reads fromcrossChainBorrows(i.e., borrows originated from Chain A). - Since Alice's borrow was executed on Chain A (not originated), her borrow is ignored.
- 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
- Bob initiates a cross-chain borrow of 10,000 USDC on Chain B using his Chain A funds as collateral.
- This creates an entry in
crossChainBorrows[Bob][USDC]on Chain A. - Bob has no borrow activity on Chain A; he only has
crossChainBorrowshere, nocrossChainCollaterals. - The protocol calls
distributeBorrowerLend()on Chain A. - As
borrowWithInterest()includes Bob’scrossChainBorrows, rewards will be calculated with that amount. - 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():
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 fromcrossChainCollateralsfor 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.
- Only borrows executed on this chain (i.e.,
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
- Alice borrows on Chain A using collateral on Chain B, creating an entry in crossChainCollaterals on Chain A.
- The protocol calls distributeBorrowerLend() on Chain A.
- borrowWithInterest() reads only crossChainBorrows, so Alice's borrow is ignored and she gets zero LEND.
- Bob borrows on Chain B using collateral on Chain A, creating an entry in crossChainBorrows on Chain A.
- 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.