Skip to content
Business logic Audit finding Advanced

Cross chain debt accrues incorrectly

The cross-chain borrow interest calculation uses the same-chain LToken's borrow index instead of the correct cross-chain index, causing inaccurate debt accrual. This can lead to incorrect interest amounts and break cross-chain functionality.

0xc0ffEE Follow with JeRRy0422, future and 3 others

Originally disclosed on Sherlock

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

Found by

0xc0ffEE, JeRRy0422, future, jokr, newspacexyz, t.aksoy

Summary

Using the borrow index of LToken on the same chain for cross chain borrow can cause the cross chain borrow to be incorrectly accrued interest

Root Cause

The function LendStorage::borrowWithInterest() is used to calculate cross borrow with interest. However, the parameters _lToken actually the LToken on the same chain. The function is accruing cross chain borrow interest with same-chain LToken borrow index. This can cause debt calculation of cross chain borrows to be imprecise, hence impacting cross chain functionality.

Solidity
    function borrowWithInterest(address borrower, address _lToken) public view returns (uint256) {
        address _token = lTokenToUnderlying[_lToken];
        uint256 borrowedAmount;

        Borrow[] memory borrows = crossChainBorrows[borrower][_token];
        Borrow[] memory collaterals = crossChainCollaterals[borrower][_token];

        require(borrows.length == 0 || collaterals.length == 0, "Invariant violated: both mappings populated");
        // Only one mapping should be populated:
        if (borrows.length > 0) {
            for (uint256 i = 0; i < borrows.length; i++) {
                if (borrows[i].srcEid == currentEid) {
                    borrowedAmount +=
@>                        (borrows[i].principle * LTokenInterface(_lToken).borrowIndex()) / borrows[i].borrowIndex;
                }
            }
        } else {
            for (uint256 i = 0; i < collaterals.length; i++) {
                // Only include a cross-chain collateral borrow if it originated locally.
                if (collaterals[i].destEid == currentEid && collaterals[i].srcEid == currentEid) {
                    borrowedAmount +=
@>                        (collaterals[i].principle * LTokenInterface(_lToken).borrowIndex()) / collaterals[i].borrowIndex;
                }
            }
        }
        return borrowedAmount;
    }

Internal Pre-conditions

NA

External Pre-conditions

NA

Attack Path

NA

Impact

  • Cross chain borrow accrues interest incorrectly
  • Cross chain functionalities does not work properly

PoC

No response

Mitigation

Consider changing the mechanism to accrue cross chain borrow index

The original report as published on Sherlock, by 0xc0ffEE. 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

Likely the function borrowWithInterest uses the same-chain LToken's borrowIndex for cross-chain borrows, rather than the borrow index from the chain where the borrow originated.

Impact

Cross-chain borrows may accrue interest incorrectly, causing cross-chain functionality to not work properly.

What the attacker needed

None

The fix

The mechanism should be changed to accrue cross-chain borrow interest using the correct borrow index.

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.

In a lending system, interest is tracked using a 'borrow index' that increases over time. This report says that when someone borrows across different blockchains, the code mistakenly uses the interest rate from the local chain instead of the remote chain, so the calculated debt is wrong.

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 0xc0ffEE

View all

27 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.