Skip to content
Business logic Audit finding Intermediate

The liquidation validation logic is wrong

The cross-chain liquidation check on Chain A incorrectly treats the number of collateral tokens to seize as an additional borrow amount, so a healthy position can be marked liquidatable. An attacker could liquidate valid accounts that should not be eligible.

0xgee Follow with 4n0nx, Aenovir and 22 others

Originally disclosed on Sherlock

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

Found by

0xgee, 4n0nx, Aenovir, Falendar, HeckerTrieuTien, Kvar, Rorschach, Waydou, Ziusz, durov, dystopia, future, ggg_ttt_hhh, harry, hgrano, jokr, m3dython, newspacexyz, oxelmiguel, patitonar, rudhra1749, t.aksoy, wickie, xiaoming90, zraxx

Summary

On Chain A (the collateral chain), the liquidation check treats payload.amount as if it were an additional borrow amount, but payload.amount is the number of collateral tokens to seize.

Root Cause

On Chain B, during a cross‐chain liquidation, _executeLiquidationCore calculates how many collateral tokens to seize:

Solidity
(uint256 amountSeizeError, uint256 seizeTokens) = LendtrollerInterfaceV2(lendtroller)
    .liquidateCalculateSeizeTokens(borrowedlToken, params.lTokenToSeize, params.repayAmount);

Then sends seizeTokens (payload.amount) to Chain A:

Solidity
_send(
    params.srcEid,
    seizeTokens, // this becomes payload.amount
    params.storedBorrowIndex,
    0,
    params.borrower,
    lendStorage.crossChainLTokenMap(params.lTokenToSeize, params.srcEid),
    msg.sender,
    params.borrowedAsset,
    ContractType.CrossChainLiquidationExecute
);

The payload.amount represents the seize amount (collateral to take), not the borrow amount. But it is being passed as the borrowAmount parameter on Chain A:

Solidity
function _checkLiquidationValid(LZPayload memory payload) private view returns (bool) {
    (uint256 borrowed, uint256 collateral) = lendStorage.getHypotheticalAccountLiquidityCollateral(
>       payload.sender, LToken(payable(payload.destlToken)), 0, payload.amount
    );
    return borrowed > collateral;
}
Solidity
function getHypotheticalAccountLiquidityCollateral(
    address account,
    LToken lTokenModify,
    uint256 redeemTokens,
    uint256 borrowAmount
)

In other words, it asks “If this user were to borrow payload.amount more, would they be undercollateralized?” But payload.amount is not a proposed additional borrow, it is the number of tokens that will be seized. That means a healthy position could be marked liquidatable just because “borrowing that many more” would tip them over the edge, even if no actual borrow ever happens.

Internal Pre-conditions

N/A

External Pre-conditions

N/A

Attack Path

N/A

Impact

Healthy positions can be mistakenly flagged as liquidatable, allowing valid accounts to be liquidated.

PoC

No response

Mitigation

Fix _checkLiquidationValid to use the correct parameters:

Diff
    function _checkLiquidationValid(LZPayload memory payload) private view returns (bool) {
        (uint256 borrowed, uint256 collateral) = lendStorage.getHypotheticalAccountLiquidityCollateral(
-           payload.sender, LToken(payable(payload.destlToken)), 0, payload.amount
+           payload.sender, LToken(payable(payload.destlToken)), 0, 0
        );
        return borrowed > collateral;
    }

The original report as published on Sherlock, by 0xgee. 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 validation function passes the seize amount as the borrow amount parameter, causing the health check to simulate an additional borrow that never occurs.

What the attacker needed

Cross-chain liquidation feature enabled

The fix

The check should be fixed to pass zero as the borrow amount instead of the seize amount.

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, a liquidation happens when a borrower's debt is too high compared to their collateral. This report shows that a check on one blockchain mistakenly used the amount of collateral to be taken as if it were extra debt, making some safe borrowers look unsafe and allowing them to be wrongly liquidated.

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