Skip to content
Business logic Audit finding Intermediate

wrong calculation of amount of Ltokens to seize in liquidateCrossChain function

The liquidateCrossChain function calculates the number of collateral tokens to seize using the exchange rate of the destination chain's LToken instead of the source chain's LToken. This can result in seizing an incorrect amount of collateral, potentially causing liquidation to fail or seizing too little or too much.

ggg_ttt_hhh Follow with jokr and rudhra1749

Originally disclosed on Sherlock

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

Found by

ggg_ttt_hhh, jokr, rudhra1749

Summary

If a borrower cross borrows tokens in chainB while giving collateral in chainA.Then if he was undercollateralized then a liquidator can call liquidateCrossChain function in chain B to liquidate that borrower. If we see inputs of liquidateCrossChain function, https://github.com/sherlock-audit/2025-05-lend-audit-contest/blob/main/Lend-V2/src/LayerZero/CrossChainRouter.sol#L172-L177

Solidity
    function liquidateCrossChain(
        address borrower,
        uint256 repayAmount,
        uint32 srcEid,
        address lTokenToSeize,
        address borrowedAsset

let's say the collateral token that borrower provided in chain A is LtokenChainA and ltokenDestchain that is Ltoken corresponding to LtokenChainA is chain B is LtokenChainB. here in input of liquidateCrossChain function lTokenToSeize = LtokenChainB. It was used in the calculation of amount of collateral tokens to seize in chain A . https://github.com/sherlock-audit/2025-05-lend-audit-contest/blob/main/Lend-V2/src/LayerZero/CrossChainRouter.sol#L268-L269

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

and here if we see implementation of Lendtroller.liquidateCalculateSeizeTokens function, https://github.com/sherlock-audit/2025-05-lend-audit-contest/blob/main/Lend-V2/src/Lendtroller.sol#L852-L888

Solidity
    function liquidateCalculateSeizeTokens(address lTokenBorrowed, address lTokenCollateral, uint256 actualRepayAmount)
        external
        view
        override
        returns (uint256, uint256)
    {
        /* Read oracle prices for borrowed and collateral markets */
        uint256 priceBorrowedMantissa = oracle.getUnderlyingPrice(LToken(lTokenBorrowed));


        uint256 priceCollateralMantissa = oracle.getUnderlyingPrice(LToken(lTokenCollateral));


        if (priceBorrowedMantissa == 0 || priceCollateralMantissa == 0) {
            return (uint256(Error.PRICE_ERROR), 0);
        }


        /*
         * Get the exchange rate and calculate the number of collateral tokens to seize:
         *  seizeAmount = actualRepayAmount * liquidationIncentive * priceBorrowed / priceCollateral
         *  seizeTokens = seizeAmount / exchangeRate
         *   = actualRepayAmount * (liquidationIncentive * priceBorrowed) / (priceCollateral * exchangeRate)
         */
        uint256 exchangeRateMantissa = LToken(lTokenCollateral).exchangeRateStored(); // Note: reverts on error


        uint256 seizeTokens;
        Exp memory numerator;
        Exp memory denominator;
        Exp memory ratio;


        numerator = mul_(Exp({mantissa: liquidationIncentiveMantissa}), Exp({mantissa: priceBorrowedMantissa}));


        denominator = mul_(Exp({mantissa: priceCollateralMantissa}), Exp({mantissa: exchangeRateMantissa}));


        ratio = div_(numerator, denominator);


        seizeTokens = mul_ScalarTruncate(ratio, actualRepayAmount);


        return (uint256(Error.NO_ERROR), seizeTokens);

here in the calculation of seizeTokens it uses exchangeRate between LtokenChainB and tokenChainB. But this calculation will give amount of LtokenChainB we should seize but not amount of tokens we should seize of LtokenChainA.we should calculate this amount in chain A not chain B. most probably exchangeRate in chain A and chain B will be different . so this seizeTokens value was not correctly representing amount of LtokenChainA to seize.

Root Cause

using https://github.com/sherlock-audit/2025-05-lend-audit-contest/blob/main/Lend-V2/src/LayerZero/CrossChainRouter.sol#L268-L269

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

this to calculate amount of LtokenChainA to seize instead of calculating that value in chainA.

Internal Pre-conditions

for this bug to make impact, the exchangeRate of these Ltokens should be differ in 2 chains.

External Pre-conditions

none

Attack Path

liquidator calls liquidateCrossChain function

Impact

amount of collateral tokens seized from borrower will be less or more than what it should be based on Differences in ExchangeRates. may be this could cause liquidation to fail, because of wrong no of collateral tokens to seize

PoC

No response

Mitigation

calculate the amount of collateral tokens to seize in chainA instead of chainB or use Ltoken of chainA in calculation instead of using Ltoken of chainB

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

Impact

The amount of collateral seized could be less or more than intended, and the liquidation may fail due to incorrect seize token count.

What the attacker needed

Borrower cross-borrows on chain B with collateral on chain A; borrower becomes undercollateralized; exchange rates differ between the two chains

The fix

The amount of collateral tokens to seize should be calculated on chain A using the source chain's LToken, not on chain B with the destination chain's LToken.

How it was found

  1. A borrower cross-borrows tokens on chain B using collateral on chain A.
  2. The borrower becomes undercollateralized.
  3. A liquidator calls liquidateCrossChain on chain B, specifying the destination chain's LToken as lTokenToSeize.
  4. The function calculates seizeTokens using the exchange rate of the destination chain's LToken.
  5. The calculated seizeTokens is used to seize collateral on chain A, but it does not match the correct amount due to different exchange rates.

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.

When a borrower provides collateral on one blockchain and borrows on another, a liquidator can repay the debt to seize the collateral. The bug is that the system uses the wrong exchange rate (from the borrowing chain) to decide how much collateral to take, instead of the rate from the chain where the collateral actually lives. This can lead to taking the wrong amount, which might make the liquidation fail or be unfair.

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.