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.
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:
/**
* @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:
-
msg.sendercan be any address inallowedCallersfor the_senderin the journal data -
receiver value passed to the endpoint is overwritten by
_senderin_outHere: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:
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
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.