Skip to content
Business logic Audit finding Intermediate

Cross-chain liquidations will be blocked due to incorrect maxLiquidatable amount calculation

The max liquidation amount calculation for cross-chain liquidations incorrectly uses a function that only counts borrows originating from the current chain, ignoring borrows where the current chain is the destination. This causes valid cross-chain liquidations to be rejected because the computed cap is zero or too low.

0xc0ffEE Follow with coin2own, future and 3 others

Originally disclosed on Sherlock

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

Found by

0xc0ffEE, coin2own, future, h2134, jokr, wickie

Summary

During cross-chain liquidations, the _validateAndPrepareLiquidation function verifies that repayAmount <= maxLiquidationAmount. However, the computed maxLiquidationAmount from the getMaxLiquidationRepayAmount() function is incorrect if we want to calculate cross-chain collaterals.

Solidity
function getMaxLiquidationRepayAmount(address borrower, address lToken, bool isSameChain)
    external
    view
    returns (uint256)
{
    uint256 currentBorrow = 0;

    currentBorrow += isSameChain
        ? borrowWithInterestSame(borrower, lToken)
        : borrowWithInterest(borrower, lToken);

    uint256 closeFactorMantissa = LendtrollerInterfaceV2(lendtroller).closeFactorMantissa();
    uint256 maxRepay = (currentBorrow * closeFactorMantissa) / 1e18;

    return maxRepay;
}

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

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

The issue lies in the use of borrowWithInterest(), which returns the sum of cross-chain borrows originating from the current chain. It does not include borrow amounts where the current chain is the destination chain.

As a result, if a user has a cross-chain borrow ( originated from another chain), it will not be considered in the liquidation cap calculation. Consequently, valid cross-chain liquidations can be incorrectly rejected.

Root Cause

The borrowWithInterest() function only returns borrows initiated from the current chain, not borrows whose destination chain is current chain (cross-chain collaterals)

Using it to calculate liquidation cap of cross-chain borrows on destination chain leads wrong maxLiquidationAmount reverting valid liquidations.

Internal Pre-conditions

  1. User has cross-chain collateral on this chain.
  2. No (or less) cross-chain borrows of that token initiated from this chain.

External Pre-conditions

Attack Path

  1. Alice has a $1,000 borrow position on Chain B (destination chain), which originated from Chain A.
  2. The borrow is undercollateralized and should be liquidated.
  3. A liquidator tries to initiate cross-chain liquidation for $500 of Alice’s borrow on Chain B.
  4. Since Alice has no borrows of that token initiated from Chain B, both borrowWithInterest() returns 0.
  5. As a result, maxLiquidationAmount is calculated as 0.
  6. The liquidation fails due to this incorrect cap check:
Solidity
require(params.repayAmount <= maxLiquidationAmount, "Exceeds max liquidation");

Impact

Valid cross-chain liquidations will be blocked

PoC

No response

Mitigation

Introduce a new function that accurately aggregates all cross-chain collaterals of a given token for a user whose destination chain is current chain. Use this function instead of borrowWithInterest() when calculating maxLiquidationAmount during cross-chain liquidations.

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 liquidation cap calculation uses a function that only aggregates borrows originating from the current chain, omitting cross-chain borrows where the current chain is the destination.

Impact

Valid cross-chain liquidations will be blocked, potentially leaving undercollateralized positions unliquidated.

What the attacker needed

User has cross-chain collateral on the chain; No or few cross-chain borrows of that token from this chain

The fix

A new function should be introduced to accurately aggregate all cross-chain collaterals of a given token for a user whose destination chain is the current chain, and used instead of `borrowWithInterest()` when calculating `maxLiquidationAmount`.

How it was found

  1. Alice has a borrow position on Chain B that originated from Chain A.
  2. The borrow becomes undercollateralized and should be liquidated.
  3. A liquidator attempts a cross-chain liquidation on Chain B.
  4. The max liquidation amount is computed as zero because no borrows of that token originated from Chain B.
  5. The liquidation fails the cap check.

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 cross-chain lending system, a user can borrow on one blockchain using collateral on another. When a position becomes unsafe, a liquidator should be able to repay part of the debt to earn a reward. Here, the code that calculates the maximum repayable amount looks at the wrong set of borrows, so it thinks there is nothing to liquidate and blocks the liquidation.

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.