Verification Checklist: EIP-7702 Delegation Security Boundaries
- ✓ Code Pointer & Residual Storage Audit: Query
eth_getCodefor the 23-byte0xef0100prefix. After revoking or re-delegating, inspect low-index slots witheth_getStorageAt—clearing code never erases persistent state. - ✓ ERC-7201 Namespaced Storage: Confirm target wallet implementations forbid linear Slot 0 layouts and isolate all state via ERC-7201 hashed namespaces to prevent cross-wallet
owner/noncecollisions. - ✓ Non-Zero
chain_id& Init Guards: Reject any authorization signingchain_id == 0; verifyinitialize()enforcesmsg.sender == address(this)or an explicit EOA signature to block same-block front-running. - ✓ Retirement of
tx.originInvariants: Audit integrated DeFi contracts fortx.origin == msg.senderorextcodesize == 0checks, which no longer guarantee non-contract single-call execution under EIP-7702.
1. EIP-7702 State Machine: The 23-Byte 0xef0100 Pointer & Storage Ownership
Understanding EIP-7702's attack surface starts with how it differs structurally from ERC-4337 smart accounts. Rather than deploying a separate proxy contract and migrating funds, EIP-7702 introduces transaction type 0x04 (SetCode Transaction), carrying an authorization_list of tuples signed by an EOA private key:
// EIP-7702 authorization digest (MAGIC = 0x05)
authHash = keccak256(0x05 || rlp([chain_id, address, nonce]))
Once included on-chain and verified via ecrecover, the EVM writes a fixed 23-byte delegation designator into the EOA's code field: the 3-byte prefix 0xef0100 (reserved under EIP-3541 so standard contracts can never deploy 0xef-prefixed bytecode) concatenated with the 20-byte target implementation address.
The critical execution consequence: any subsequent call to the EOA resolves the target address and executes its bytecode inside the EOA's own storage context, mirroring DELEGATECALL semantics. Every SSTORE executed by the delegated logic writes persistently into the EOA's own Storage Trie—not into the implementation contract.
2. Trap #1: Storage Slot Collisions After Switching or Revoking Delegations
A pervasive misconception among wallet teams and users is that revoking an EIP-7702 delegation (by authorizing 0x0000000000000000000000000000000000000000) or switching from Wallet A to Wallet B resets the account to a clean slate. EVM state rules do the exact opposite.
Revocation clears only the 23-byte code pointer (returning codeHash to the empty hash) while leaving every persistent storage slot untouched. Consider this concrete exploit sequence:
- An EOA delegates to
WalletImplA, which uses standard linear Solidity storage and writes a non-zerosessionNonceor relayer address toSlot 0; - The user later revokes
WalletImplAor re-delegates toWalletImplB, where linearSlot 0maps toaddress public adminorbool public initialized; - Immediately upon re-delegation,
WalletImplBmisinterprets the residual dirty bytes inSlot 0as an active admin address or initialized flag—either permanently bricking wallet initialization or handing full execution authority to a stale address without requiring the EOA's private key.
Production EIP-7702 delegates must abandon linear slot layouts entirely and enforce ERC-7201 (Namespaced Storage Layout) so each implementation hashes its state root to a collision-resistant slot:
// ERC-7201 namespaced storage root (isolates state across wallet implementations)
// keccak256(abi.encode(uint256(keccak256("mywallet.v1.storage")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant STORAGE_LOCATION =
0x4a8f12c9b3d07e1f8c2a6b4d9e0f1a2b3c4d5e6f708192a3b4c5d6e7f8091000;
struct WalletStorage {
address guardian;
uint256 nonce;
mapping(address => uint48) sessionExpiries;
}
function _getStorage() private pure returns (WalletStorage storage $) {
assembly {
$.slot := STORAGE_LOCATION
}
}
3. Trap #2: chain_id = 0 Cross-Chain Replay & initialize() Front-Running
Beyond storage persistence, EIP-7702's authorization mechanics open two high-severity signature vectors:
1) Wildcard chain_id = 0 Replay & Non-Deterministic Address Hijacking
EIP-7702 permits setting chain_id = 0 so a single authorization can activate across multiple networks. Once broadcast on any chain, however, that signature becomes public calldata. Any third party can replay it on every EVM L2 where the EOA shares the same nonce. Worse, if the target implementation was deployed on mainnet via standard CREATE rather than deterministic CREATE2, an attacker can pre-deploy malicious bytecode at the exact same address on an uninitialized L2, replay the victim's chain_id = 0 tuple, and drain the EOA on that chain.
2) Unguarded initialize() Front-Running
Because anyone—such as a gas sponsor or MEV searcher—can submit a user's signed authorization_list, delegates ported from UUPS/Transparent proxies with an open initialize(address owner) function are immediately vulnerable. A searcher monitoring the mempool can extract the authorization tuple, bundle it into a higher-priority transaction, and call eoa.initialize(attacker) in the same block before the user's setup call lands. Safe EIP-7702 delegates must gate initialization behind require(msg.sender == address(this)) or verify a fresh ECDSA signature from the EOA itself over the initialization payload.
4. Trap #3: Collapse of tx.origin == msg.sender Defenses
For years, DeFi protocols, NFT mints, and on-chain raffles relied on two canonical lines to block smart contracts and atomic flash-loan bots:
// Both legacy "EOA-only / anti-flashloan" checks fail under EIP-7702
require(msg.sender == tx.origin, "Only EOA allowed");
require(msg.sender.code.length == 0, "Contract caller forbidden");
Under EIP-7702, both assumptions break simultaneously. When a delegated EOA initiates a transaction, tx.origin and msg.sender are identical inside downstream protocol calls—passing msg.sender == tx.origin—even though the EOA is executing an arbitrary multi-step contract batch (flash loan, multi-pool arbitrage, and repayment) in a single atomic transaction. Conversely, legacy protocols enforcing code.length == 0 inadvertently lock out legitimate EIP-7702 wallet users because extcodesize now returns 23 bytes. Security researchers must treat tx.origin checks as obsolete and evaluate protocols on true economic invariants or multi-block commit-reveal windows.
5. Executable On-Chain Verification: RPC Probes & Audit Checklist
Researchers and auditors can verify live EOA delegation status, residual storage, and cross-chain bytecode parity directly using Foundry cast or standard JSON-RPC calls:
# 1. Inspect EOA code for the 23-byte EIP-7702 delegation prefix (0xef0100 + 20-byte impl)
cast code 0xYourEOAAddress --rpc-url $RPC_URL
# Output 0xef0100<impl> confirms active delegation; 0x confirms standard EOA
# 2. Audit low-index storage slots after revocation to detect lingering dirty state
cast storage 0xYourEOAAddress 0 --rpc-url $RPC_URL
cast storage 0xYourEOAAddress 1 --rpc-url $RPC_URL
# 3. Verify identical implementation codehash across chains before any multi-chain delegation
cast codehash 0xTargetImplAddress --rpc-url $ETH_MAINNET_RPC
cast codehash 0xTargetImplAddress --rpc-url $ARB_ONE_RPC
Before signing or integrating any EIP-7702 wallet implementation, enforce three hard gates:
- Never Blind-Sign
chain_id = 0: Require wallet UIs to display the explicit target chain ID and reject wildcard cross-chain authorization tuples; - Verify ERC-7201 &
onlySelfin Verified Source: Confirm the contract referenced after0xef0100uses zero linear storage variables and restricts initialization/upgrades tomsg.sender == address(this)or signed EOA payloads; - Zero Critical Slots Before Switching Delegates: When migrating away from legacy non-namespaced implementations, invoke cleanup routines prior to revocation and archive
eth_getStorageAtsnapshots as audit evidence.
References & Standards
- Ethereum Improvement Proposals: EIP-7702: Set EOA account code (Pectra)
- Namespaced Storage Standard: ERC-7201: Namespaced Storage Layout
- Reserved Bytecode Prefix: EIP-3541: Reject new contract code starting with the 0xEF byte
- OpenZeppelin Security Documentation: OpenZeppelin Contracts: Account Abstraction & EIP-7702 Security