# 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?

- Canonical: https://ack3.ai/research/cross-frame-memory-starvation/
- Published: November 10, 2026
- Authors: Michal Převrátil
- Category: Security research
- Topics: monad, evm, security, solidity

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](https://mips.monad.xyz/MIPs/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](https://mips.monad.xyz/MIPs/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](https://swcregistry.io/docs/SWC-126)) is a [denial of service](/research/glossary/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](https://forum.monad.xyz/t/mip-3-linear-evm-memory-cost/362) 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](https://github.com/ack3-ai/cross-frame-memory-starvation) contains three contracts:

```solidity
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`:

| `m` | Memory held by `Attacker` | Branch taken by `run()` | `Result` | Gas limit | Transaction |
|---|---|---|---|---|---|
| `0` | 32 bytes | try | 0 | 1,000,000 | [0x0d85…bade0](https://testnet.monadvision.com/tx/0x0d85c040944543ac24f06631f0c264636f7a07a7c3bd950a3289edeb704bade0) |
| `0x77ffe0` | 7.5 MiB | catch | 1 | 1,000,000 | [0xa06e…fee7c](https://testnet.monadvision.com/tx/0xa06e8232ed8aab4dc80fa10257a7f621f15781e62823c4cf6ec6f7dd295fee7c) |

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

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