Research journal · Security research

Cross-Frame Memory Starvation

On Monad, a call shares one 8 MB memory pool with every frame above it. What happens to the call when those frames hold most of the pool?

research/cross-frame-memory-starvation figure / technical visual
Solidity excerpt from src/Repro.sol: attack(m) stores at memory offset m, then calls run(); run() calls Target.f() inside try/catch and returns 0 on success, 1 on failure. Trace for m = 0x77ffe0: Attacker holds 7.5 MiB, Target.f() needs 1 MiB and halts at the 8 MB cap, run() takes the catch branch and the transaction still succeeds.
One input changes between the two transactions: the memory the outer frame uses.

During the security review of a protocol building on Monad, ack3 found cross-frame memory starvation and reported it to the Monad Foundation on November 10, 2026. Cross-frame memory starvation is a forced failure of a call on Monad caused by memory that frames above it in the same transaction already hold: MIP-3 caps the memory held at once by a call and its parent frames at 8 MB, so frames above a call can pre-consume most of the pool and make the call halt when its own memory use reaches the cap, whatever gas it was given.

Memory on Monad

On Ethereum, each call frame pays for the memory it touches, and the quadratic expansion cost grows fast enough that gas, not a fixed limit, bounds the memory of a transaction. One frame’s memory does not count against another’s.

Monad replaced that model with MIP-3, live on mainnet since March 19, 2026 in the MONAD_NINE upgrade. Expansion costs half a gas per 32-byte word, so the full 8 MB costs 131,072 gas, and the 8 MB cap applies to the memory held at once by the active call stack, not to a running total for the transaction: memory held by a call and by every call above it is subtracted from what a new child call can use, and returns to the pool when the call returns. A call that exceeds what remains halts exceptionally and consumes all the gas it was given. The cap lets a node bound the memory of every transaction it executes; MIP-3’s motivation records that observed Ethereum transactions peak at about 2 MB.

The vulnerability class

Code that handles a failed call assumes the failure is decided by the call’s own code, its input, and the gas it receives. On Monad a fourth input decides it: the memory the frames above already hold. The called contract does not need to be malicious or under the attacker’s control: a call to a trusted contract can be made to fail from above.

Insufficient-gas griefing (SWC-126) is a denial of service that fails a call by forwarding it too little gas, and in many cases it reaches the same branch. Each has its own limit on what runs after the failure. Under the 63/64 rule a caller keeps 1/64 of its gas when the call it starved runs out, so the code after the failure must fit in that remainder. A memory-starved call fails at any gas, so the attacker can provide enough gas that the 1/64 remainder does not limit what runs after the failure. The limit moves to memory instead: the frames above have pre-consumed most of the pool, so the frame that handles the failure, and the rest of the transaction, must finish without reaching the cap themselves. This is usually a softer requirement than the 1/64 remainder, but it depends on the case. The condition also cannot be checked in advance: gasleft() reports the gas that remains, no opcode reports the memory left in the pool, and MSIZE measures only the current frame.

Any frame above the call can cause the failure: the direct caller, or an account several frames up that sets how much memory is in use when the call runs. The same bytecode on Ethereum is unaffected.

The MIP-3 discussion anticipated the mechanism in general terms. The forum thread noted in January 2026 that running out of memory is “not 100% up to the code in question (but also up to parent frames)”, and compared the impact to just-enough-gas targeting. MIP-3 activated on mainnet with the shared pool as specified. The reproduction below runs the mechanism on Monad testnet.

Reproduction

The reproduction repository contains three contracts:

contract Target {
    function f() external pure returns (uint256 r) {
        assembly {
            r := mload(0xfffe0)
        }
    }
}

contract TryCatch {
    Target immutable t;

    constructor(Target _t) {
        t = _t;
    }

    function run() external view returns (uint256) {
        try t.f() {
            return 0;
        } catch {
            return 1;
        }
    }
}

contract Attacker {
    TryCatch immutable tc;

    event Result(uint256 r);

    constructor(TryCatch _tc) {
        tc = _tc;
    }

    function attack(uint256 m) external returns (uint256 r) {
        assembly {
            mstore(m, 0)
        }
        r = tc.run();
        emit Result(r);
    }
}

Target.f() reads memory at offset 0xfffe0, which expands its memory to 1 MiB. TryCatch.run() calls it inside try/catch and returns 0 when the call succeeds and 1 when it fails. Attacker.attack(m) writes to its own memory at offset m before calling run(), so m sets how much of the pool is in use when Target.f() runs.

On Monad testnet, the two transactions below differ only in m:

mMemory held by AttackerBranch taken by run()ResultGas limitTransaction
032 bytestry01,000,0000x0d85…bade0
0x77ffe07.5 MiBcatch11,000,0000xa06e…fee7c

Both transactions carry the same gas limit and both succeed; only the branch differs. Gas is not what runs out. Under MIP-3 pricing, expanding Attacker’s memory to 7.5 MiB costs 122,880 gas and the 1 MiB read in Target costs 16,384. What runs out is the pool: 7.5 MiB held above plus 1 MiB needed below exceeds the 8 MB cap, so Target.f() halts and run() takes its catch branch inside a successful transaction.

Exposed call patterns

A contract is exposed when two conditions hold. It maps the failure of an inner call, through a catch block or a success == false branch, to a default such as zero or an empty result that later logic trusts. And an untrusted account can send a transaction that reaches the call: the sender chooses the first contract called, and that contract can pre-consume the pool before the call runs. The failing call can sit several contracts down. The attack also has to leave enough of the pool for the frame that handles the failure and for the rest of the transaction to finish without reaching the cap.

What removes the exposure

A contract is not exposed when a failed inner call reverts the operation instead of substituting a default that later logic trusts, or when only a trusted executor can send the transactions that reach the call.

Disclosure timeline

DateEvent
November 3, 2026First indication during a security review
November 10, 2026ack3 confirms the case and reproduces it on Monad testnet
November 10, 2026Reported to and acknowledged by the Monad Foundation

Contributor

About the author.

Vocabulary

Terms used in this article.