Skip to content
Access control Audit finding Intermediate

Blacklist can be completely bypassed on outHere endpoint in mTokenGateway

The outHere endpoint in mTokenGateway checks the blacklist against the caller and the receiver argument, but the receiver is overwritten with the sender address decoded from journal data, so a blacklisted user can still withdraw funds.

0xEkko Follow with 0xKann, 5am and 14 others

Originally disclosed on Sherlock

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

Found by

0xEkko, 0xKann, 5am, 8olidity, JeRRy0422, Kvar, PeterSR, TopStar, ZanyBonzy, Ziusz, blockace, bulgari, cergyk, dimulski, gh0xt, joicygiore, kelvinclassic11

Description

The mTokenGateway exposes the outHere endpoint to allow withdrawal on an extension chain. This endpoint is protected by two ifNotBlacklisted modifiers:

mTokenGateway.sol#L254-L262:

Solidity
    /**
     * @inheritdoc ImTokenGateway
     */
    function outHere(bytes calldata journalData, bytes calldata seal, uint256[] calldata amounts, address receiver)
        external
        notPaused(OperationType.AmountOutHere)
        ifNotBlacklisted(msg.sender)
        ifNotBlacklisted(receiver)
    {

Unfortunately both can be bypassed, because:

  1. msg.sender can be any address in allowedCallers for the _sender in the journal data

  2. receiver value passed to the endpoint is overwritten by _sender in _outHere:

    mTokenGateway.sol#L281-L286:

    Solidity
        function _outHere(bytes memory journalData, uint256 amount, address receiver) internal {
            (address _sender, address _market,, uint256 _accAmountOut, uint32 _chainId, uint32 _dstChainId,) =
                mTokenProofDecoderLib.decodeJournal(journalData);
    
            // temporary overwrite; will be removed in future implementations
            receiver = _sender;
    

So a blacklisted user can still use outHere to withdraw their funds.

Recommendation

Add an additional check for _sender to not be in blacklist:

mTokenGateway.sol#L281-L286:

Diff
    function _outHere(bytes memory journalData, uint256 amount, address receiver) internal {
        (address _sender, address _market,, uint256 _accAmountOut, uint32 _chainId, uint32 _dstChainId,) =
            mTokenProofDecoderLib.decodeJournal(journalData);


        // temporary overwrite; will be removed in future implementations
        receiver = _sender;
+       require (!blacklistOperator.isBlacklisted(_sender), mTokenGateway_UserBlacklisted());

Discussion

sherlock-admin2

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

CergyK

Fix looks good

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

The blacklist check on the receiver is ineffective because the receiver value is overwritten with the sender address from the journal data after the check.

Impact

A blacklisted user could bypass the blacklist and withdraw their funds through the outHere endpoint.

What the attacker needed

Blacklisted user; access to allowed caller address

The fix

The protocol team fixed this issue by adding a blacklist check on the sender address decoded from the journal data.

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.

A blacklist is meant to stop certain users from using a service. Here the contract checked the wrong address: it checked the person calling and the receiver they typed in, but then replaced the receiver with an address taken from signed data. That meant a blocked user could still take their money out.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by 0xEkko

View all

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

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.