Skip to content
Business logic Audit finding Intermediate

There is no endpoint for triggering `liquidateExternal` from extension chain to be executed by proof forwarder

The mTokenGateway contract lacks an endpoint to trigger liquidateExternal on the host chain from an extension chain, so liquidations using cross-chain liquidity cannot be initiated from Ethereum mainnet. This prevents permissionless liquidation calls when the extension chain is Ethereum mainnet.

ExtraCaterpillar Follow with PeterSR, cergyk and 1 other

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-07-malda-judging/issues/370

Found by

ExtraCaterpillar, PeterSR, cergyk, mussucal

Description

mErcHost has a liquidateExternal endpoint for using liquidity coming from other chains to perform a liquidation, but there's no equivalent endpoint in mTokenGateway to trigger the liquidation on host chain.

Please note that supplyOnHost can be used to increase accAmountIn, but there's no way to specify the borrower which should be liquidated.

mTokenGateway.sol#L224-L252:

Solidity
    function supplyOnHost(uint256 amount, address receiver, bytes4 lineaSelector)
        external
        payable
        override
        notPaused(OperationType.AmountIn)
        onlyAllowedUser(msg.sender)
        ifNotBlacklisted(msg.sender)
        ifNotBlacklisted(receiver)
    {
        // checks
        require(amount > 0, mTokenGateway_AmountNotValid());
        require(msg.value >= gasFee, mTokenGateway_NotEnoughGasFee());

        IERC20(underlying).safeTransferFrom(msg.sender, address(this), amount);

        // effects
        accAmountIn[receiver] += amount;


        emit mTokenGateway_Supplied(
            msg.sender,
            receiver,
            accAmountIn[receiver],
            accAmountOut[receiver],
            amount,
            uint32(block.chainid),
            LINEA_CHAIN_ID,
            //@audit can specify selector, but not borrower to liquidate on host chain
>>          lineaSelector
        );
    }

Impact

liquidateExternal cannot be called from extension chains to be executed by proof forwarder. Since as we have seen in some issues such as l1Inclusion issue, it is not possible to make some actions permissionlessly (when extension chain is Eth mainnet), this makes impossible to call liquidateExternal from Eth mainnet.

Recommendation

Either add a new endpoint liquidateOnHost, or some extra data for supplyOnHost to be able to specify a borrower to liquidate and pass liquidateExternal as lineaSelector.

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/malda-protocol/malda-lending/pull/106/files

CergyK

Fix looks good. The liquidate method has been added to mTokenGateway and the selector is now handled in BatchSubmitter

The original report as published on Sherlock, by ExtraCaterpillar. 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 mTokenGateway contract was not designed with a function to specify a borrower for liquidation, only for supplying funds.

Impact

Liquidations using cross-chain liquidity cannot be triggered from extension chains, particularly Ethereum mainnet, potentially leaving bad debt unaddressed.

What the attacker needed

Extension chain is Ethereum mainnet; borrower needs liquidation

The fix

The protocol team fixed this issue by adding a liquidate method to mTokenGateway and handling the selector in BatchSubmitter.

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.

This report is about a missing function in a smart contract system. The system allows users on one blockchain to supply funds that are used on another blockchain, but there is no way to tell the system to liquidate a specific borrower using those funds. So a key action cannot be performed from certain chains.

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 ExtraCaterpillar

View all

2 more disclosed reports, best first.

More from Malda

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.