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.
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.
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;
}
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
- User has cross-chain collateral on this chain.
- No (or less) cross-chain borrows of that token initiated from this chain.
External Pre-conditions
Attack Path
- Alice has a $1,000 borrow position on Chain B (destination chain), which originated from Chain A.
- The borrow is undercollateralized and should be liquidated.
- A liquidator tries to initiate cross-chain liquidation for $500 of Alice’s borrow on Chain B.
- Since Alice has no borrows of that token initiated from Chain B, both
borrowWithInterest()returns 0. - As a result,
maxLiquidationAmountis calculated as 0. - The liquidation fails due to this incorrect cap check:
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.
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
- Alice has a borrow position on Chain B that originated from Chain A.
- The borrow becomes undercollateralized and should be liquidated.
- A liquidator attempts a cross-chain liquidation on Chain B.
- The max liquidation amount is computed as zero because no borrows of that token originated from Chain B.
- 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.