monad-rpc: eth_createAccessList on private domain routes allows state_overrides bypass and leaks touched storage keys
Problem
On private domain RPC routes (/domain/{chain_id}), an unauthorized user must not be able to read other users' confidential contract storage (such as ERC-20 token balances) or inspect which private contracts and storage slots are touched inside another contract's execution.
On kai/domains-latest (monad-rpc/src/handlers/mod.rs and access.rs), eth_createAccessList is classified DomainPolicy::OwnDataOnly — and access.rs's module doc table explicitly states that eth_createAccessList rejects state_overrides — yet the handler exposes two privacy leaks:
- Full 256-bit private storage extraction via
state_overrides: Unlikeeth_callandeth_estimateGas(which callcaller.restrict_calland rejectstate_overrides),eth_createAccessListcallscaller.run_as_signerand forwards caller-suppliedstate_overridesstraight into EVM simulation. Any authenticated user can overrideDomainSpoke's code to disablecanCalland read any 256-bit secret out of any contract's storage via the returnedstorageKeys. - Internal call-graph and storage-slot leakage without overrides: Even when
state_overridesare rejected,eth_createAccessListrunsAccessListTracerand returns every(address, storageKeys)pair touched across all downstream contracts during an allowed call (including reverted subframes), exposing internal contract dependencies and secret-dependent storage keys.
Concrete Attack Example
Suppose Bob holds 7,450,000 (0x71ad90) tokens in a private BridgedERC20 / TestERC20 contract whose DomainAccessRules policy restricts balanceOf(Bob) (SubjectMatch on word 0) so only Bob can read his balance.
Mallory (an ordinary user with 0 tokens and no reader permissions) sends one off-chain eth_createAccessList request to an unused address 0xdEaD, attaching state_overrides:
state_overrides[spoke].code: minimal stateless policy returningtruefor everycanCall(...)(disabling contract access control during the simulation).state_overrides[0xdEaD].code: minimal probe contract that callstoken.balanceOf(Bob)to obtainbal = 7,450,000and executesassembly { touched := sload(bal) }on0xdEaD's own storage.
eth_createAccessList succeeds at zero cost (leaving no on-chain trace) and returns:
{
"address": "0x000000000000000000000000000000000000dead",
"storageKeys": [
"0x000000000000000000000000000000000000000000000000000000000071ad90"
]
}
handing Mallory Bob's exact 256-bit balance (0x71ad90 = 7,450,000).
Even if state_overrides are blocked, if Mallory invokes any router/contract method she is allowed to call via eth_createAccessList, the response still lists every downstream private contract address and storageKey touched internally along the call path.
Mechanism & What Is Wrong
On kai/domains-latest (930ea79af436):
monad-rpc/src/handlers/access.rs:28documents:| `eth_call`, `eth_estimateGas`, `eth_createAccessList`, `eth_fillTransaction` | `from` is replaced by the signer; state overrides are rejected |eth_call(monad-rpc/src/handlers/mod.rs:495–499) andeth_estimateGas(mod.rs:582–584) callcaller.restrict_call(&mut params.transaction, ¶ms.state_overrides)?(access.rs:172–183), which rejects non-emptystate_overrideswith-32007 Forbidden ("state overrides are not allowed on domain routes").eth_createAccessList(monad-rpc/src/handlers/mod.rs:638–647) mistakenly callscaller.run_as_signer(&mut params.transaction)instead, overlookingMonadCreateAccessListParams.state_overrides(monad-rpc/src/handlers/eth/call.rs:539–546) and forwarding caller-supplied code/storage overrides straight intoprepare_eth_call(call.rs:908–935).AccessListTracer::encode(category/execution/ethereum/trace/state_tracer.cpp:196–305incategory-labs/monad) retainstransaction.to(0xdEaD) wheneverstorage_keysis non-empty (and touching a single slot on a stateless probe account also bypasses MIP-8 page deduplication), and emits all touched(address, storageKeys)across accepted and rejected frames without checking whether the caller is authorized to inspect those contracts' storage.
Suggested Fix
- Immediate bug fix: Replace
caller.run_as_signer(&mut params.transaction)withcaller.restrict_call(&mut params.transaction, ¶ms.state_overrides)?ineth_createAccessList(monad-rpc/src/handlers/mod.rs:645). - Design hardening: Because
AccessListTracerinherently exposes internal cross-contract addresses and storage keys (and private domain transactions are gasless on the domain anyway), consider movingEnabledMethod::eth_createAccessListfromDomainPolicy::OwnDataOnlytoDomainPolicy::OperatorOnly(mod.rs:1240), matchingdebug_traceCall.
Created by Gemini Carbon on behalf of @aa755.