Skip to content
Business logic Audit finding Intermediate

Subsequent Cross‐Chain Borrows don’t Accrue interest on existing principal when borrowing the same Asset

When a user borrows the same asset cross-chain more than once, the contract on the source chain adds the new amount to the existing principal without first applying the accumulated interest. This under-records the user's debt, allowing them to borrow more than their collateral should permit.

0xc0ffEE Follow with 37H3RN17Y2, Brene and 21 others

Originally disclosed on Sherlock

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

Found by

0xc0ffEE, 37H3RN17Y2, Brene, Etherking, HeckerTrieuTien, Kvar, Tigerfrake, Z3R0, algiz, coin2own, dmdg321, francoHacker, future, ggg_ttt_hhh, gkrastenov, hgrano, jokr, kom, newspacexyz, oxelmiguel, rudhra1749, t.aksoy, theweb3mechanic, zraxx

Summary

Borrowing the same asset more than once on Chain B, results in crossChainBorrow[user][token] entry's principle not updated with the latest borrowIndex, recording less debt on ChainA than the actual saved on Chain B.

This results in incorrect calculation of the account liquidity state via the getHypotheticalAccountLiquidityCollateral(..), which can allow the user to borrow more than he should be allowed to.

Root Cause

In CrossChainRouter._handleValidBorrowRequest, if the user previously borrowed the same asset on ChainB, we need to update the existing userBorrows[index].principle on ChainA with the new borrow amount.

To do that, it is correct to first update the userBorrows[index].principle according to the latest borrowIndex, before adding the new borrow amount. (the way it is done on ChainB).

However, the code currently just adds the new borrow amount and updates the state:

Solidity
            userBorrows[index].principle =
                userBorrows[index].principle +
                payload.amount; //@audit - not accounting for interest?

The interest accumulated between the previous cross chain borrow and the new one is lost and the user will not have to pay it.

Internal Pre-conditions

  1. User on ChainA has already initiated a cross-chain borrow on ChainB.
  2. User triggers a second cross-chain borrow on the same asset.

External Pre-conditions

None

Attack Path

  1. User initiates cross-chain borrow from Chain A to Chain B.
  2. User waits for enough time to pass
  3. User performs a second cross-chain borrow from Chain A to Chain B on the same asset.
  4. User's debt calculated on ChainA is less than the real one(recorded on ChainB) by a factor of the borrowIndex accumulated between first borrow and second borrow.
  5. User can proceed to borrow more than his collateral is worth(due to the wrong total debt calculated by getHypotheticalAccountLiquidityCollateral on Chain A

Impact

The user can perform subsequent cross chain borrows between the same chains(ChainA and ChainB) on the same asset with enough time between them. This will cause his outstanding debt saved on ChainA to be less than it should be(by a factor of the borrowIndex accumulated between first borrow and second borrow). This will allow the user to borrow additional funds, that he should not be able to and potentially driving the market to an illiquid state.

PoC

Can be provided upon request.

Mitigation

Inside the CrossChainRouter._handleValidBorrowRequest, modify the update on existing principle, so that it accounts for the borrowIndex accumulated:

Diff
 if (found) {
            // Update existing borrow
            LendStorage.Borrow[] memory userBorrows = lendStorage.getCrossChainBorrows(payload.sender, payload.srcToken);
-            userBorrows[index].principle = userBorrows[index].principle + payload.amount;
+           userBorrows[index].principle = (userBorrows[index].principle * currentBorrowIndex) / userBorrows[index].borrowIndex + payload.amount
            userBorrows[index].borrowIndex = payload.borrowIndex;

            // Update in storage
            lendStorage.updateCrossChainBorrow(payload.sender, payload.srcToken, index, userBorrows[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 code updates the stored principal by simply adding the new borrow amount without first accruing interest using the latest borrow index.

Impact

The user's outstanding debt on Chain A is understated, allowing them to borrow additional funds they should not be able to, potentially driving the market to an illiquid state.

What the attacker needed

User has an existing cross-chain borrow on Chain B; User initiates a second cross-chain borrow on the same asset; Enough time passes for interest to accrue

The fix

The code should be fixed by updating the existing principal with the latest borrow index before adding the new borrow amount.

How it was found

  1. User initiates a cross-chain borrow from Chain A to Chain B.
  2. User waits for enough time to pass.
  3. User performs a second cross-chain borrow from Chain A to Chain B on the same asset.
  4. User's debt calculated on Chain A is less than the real one recorded on Chain B.
  5. User can proceed to borrow more than their collateral is worth.

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.

Imagine you borrow money and interest builds up over time. If you borrow more of the same currency later, the system should add the new loan to the old loan plus its interest. Here, it just adds the new loan to the old loan amount, forgetting the interest. So the system thinks you owe less than you really do, and you can borrow extra money you shouldn't be allowed to.

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.