# EIP-7702 Security: EOA Code Delegation & Phishing Defense

> Audit Pectra EIP-7702 (0xef0100 delegation designators): chainId=0 omnichain sweeper phishing, storage-residual collisions, and broken tx.origin guards.

Canonical: https://nftvenueledger.com/protocols/eip-7702-eoa-code-delegation-sweeper-phishing-mitigation
Last updated: 2026-11-14T19:42:17.328Z

**Publication:** NFTVenue Ledger
**Category:** Erc721 Erc1155 Eip712 Permit Security
**Published:** 2026-11-13T20:40:25.915Z
**Author:** Dr. Devon Kurosawa, PhD (PhD in Distributed Systems & Cryptographic Protocol Verification)
**Reviewer:** Not recorded

## Answer-first summary

Ethereum Pectra EIP-7702 lets any EOA attach a 0xef0100 smart-contract delegation pointer, unlocking 1-tx approve+swap batching while shattering legacy EOA security assumptions.

## Key takeaways

- EIP-7702 (Tx Type 0x04) writes a 23-byte 0xef0100||address delegation designator to an EOA, enabling atomic batch execution while breaking msg.sender == tx.origin and extcodesize == 0 assumptions.
- Wallets MUST NEVER allow arbitrary websites to request EIP-7702 signatures to dApp-supplied target contracts; dApps should call EIP-5792 wallet_sendCalls while wallets delegate only to wallet-curated implementations.
- Delegated smart-account implementations must authenticate initialize with an explicit signature from address(this), otherwise mempool bots can extract the authorization tuple and frontrun initialization.
- Because re-delegating or clearing 0xef0100 leaves prior storage slots intact inside the EOA trie, every EIP-7702 contract must isolate state via EIP-7201 namespaced storage.

## Related financial entities

- **Checks-Effects-Interactions (CEI) Security Pattern** (CEI-SEC) — product: Foundational programming design pattern in smart contract development preventing reentrancy attacks by executing internal state updates before external calls.
- **EIP-712 Typed Structured Data Standard** (EIP-712) — product: Standard for hashing and signing of typed structured data as opposed to just arbitrary byte strings, providing human-readable authorization.
- **Uniswap v4 Singleton & Hook Architecture** (UNI-V4) — product: Fourth-generation decentralized exchange protocol featuring a unified singleton contract and modular hooks that customize pool execution logic.

## Analysis

Activated in Ethereum's **Pectra** upgrade, **EIP-7702 (`Transaction Type 0x04`)** permanently alters two foundational EVM invariants that Solidity developers relied upon for a decade: **(1) an EOA address can now have non-empty bytecode (`0xef0100 || targetAddress`)**, and **(2) `msg.sender == tx.origin` no longer proves the caller is a non-reentrant human EOA**! While EIP-7702 delivers transformative UX—letting regular MetaMask/Rabby EOAs batch `approve + swap` atomically on the [Uniswap v4 singleton](/tokens/uniswap-v4-singleton-architecture) or sweep multi-NFT bundles without migrating addresses—it also creates **the single deadliest off-chain signature phishing primitive in EVM history**!

Anchored in our [EIP-712, Permit2 & proxy security master guide](/protocols/eip712-permit2-erc721-royalty-proxy-timelock-security-2026), both wallet vendors and protocol auditors must remediate three distinct EIP-7702 vulnerability classes immediately.

## How `chain_id = 0` EIP-7702 Delegation Signatures Surpass Permit2 Phishing!

Compare a phished `Permit2` signature against a phished **EIP-7702 Authorization Tuple `(chain_id, address, nonce, y_parity, r, s)`**:
- A phished `Permit2` signature sweeps *only* ERC-20 tokens previously approved to `Permit2` on **one specific `chainId`**.
- An EIP-7702 authorization sets the victim EOA's account code to `0xef0100 || MaliciousSweeperContract`—giving `MaliciousSweeperContract` **total `DELEGATECALL` control over the EOA's native ETH, every ERC-20, every ERC-721 NFT, every Safe signer role, and every DeFi LP position simultaneously**!
- Worse still: EIP-7702 explicitly allows **`chain_id == 0`** inside the authorization tuple so users can delegate their EOA across all EVM chains at once—meaning **one phished `chain_id = 0` signature compromises the EOA across Ethereum, Arbitrum, Base, Optimism, and Polygon simultaneously**!

![EIP-7702 0xef0100 delegation designator execution, wallet allowlist firewall, and re-delegation storage hazard](/api/figure?type=flow&title=EIP-7702%20SetCode%20%280x04%29%20Architecture%20%26%20Wallet%20Firewall&subtitle=Enforcing%20curated%20delegation%20allowlists%20and%20EIP-7201%20storage%20isolation%20on%20delegated%20EOAs&steps=1.%20Wallet%20Hard%20Gate%3A%3AWallet%20blocks%20external%20dApp%20eth_sign7702Auth%3B%20allows%20curated%20list%20only!%7C2.%20Type%200x04%20SetCode%3A%3ARelayer%20submits%20%28chain_id%2C%20implAddr%2C%20nonce%29%3B%20writes%200xef0100%20%20impl%7C3.%20Atomic%20Init%20%2B%20Batch%3A%3AInitialize%20owner%2Fpasskey%20in%20same%20tx%20%2B%20batch%20approve%28%29%20%26%20exact%20swap%28%29%7C4.%20Storage%20Hygiene%3A%3AUse%20EIP-7201%20namespaces%20so%20switching%20Wallet%20A%20-%3E%20B%20never%20collides!&metrics=DESIGNATOR%20BYTES%3A%3A23B%20%280xef0100..%29%3A%3A3-byte%20EIP-3540%20banned%20prefix%20%2B%2020B%20addr%7CCHAIN_ID%20%3D%3D%200%3A%3AOmnichain!%3A%3AValid%20on%20ALL%20EVM%20chains%20if%20nonce%20matches%7CBROKEN%20INVARIANT%3A%3Atx.origin%20%3D%3D%20msg.sender%3A%3ANO%20LONGER%20blocks%20reentrancy%20or%20flash%20calls!%7CREVOKE%20CODE%3A%3Adelegate%280x0%29%3A%3AClears%200xef0100%20back%20to%20pure%20EOA)

## Three Solidity Contract Assumptions Broken by EIP-7702!

Auditing lending markets, NFT mint contracts, and DEXs across our [marketplaces directory](/marketplaces) (from [Azuki](/marketplaces/azuki) and [Admit One](/marketplaces/admit-one) allowlist mints to [9mm Pro](/marketplaces/9mm-pro) routers) surfaces three legacy Solidity patterns that **break immediately under EIP-7702**:

1. **`require(msg.sender == tx.origin, "No bots/flashloans!")` Is Dead**: With EIP-7702, an attacker delegates their EOA to `AttackImpl.sol` and initiates a Type-0x04 (or standard Type-0x02) transaction from that EOA: `msg.sender == tx.origin` holds **`true`**, yet the EOA executes multi-step flash loans, reentrancy callbacks, and atomic mints! Replace every `tx.origin` anti-reentrancy hack with explicit [CEI](/tokens/cei-smart-contract-security-pattern) + `ReentrancyGuardTransient`!
2. **`msg.sender.code.length == 0` No Longer Identifies an EOA**: A regular user whose MetaMask/Coinbase wallet upgraded via EIP-7702 has `msg.sender.code.length == 23` (`0xef0100 + 20 bytes`)—so legacy NFT mints with `require(msg.sender.code.length == 0)` **permanently brick legitimate upgraded retail users**!
3. **Orphaned Storage Collisions Across Re-Delegation**: Unlike `SELFDESTRUCT`, revoking or switching an EIP-7702 delegation from `WalletImpl_A` to `WalletImpl_B` **does NOT wipe the EOA's storage trie**! If `WalletImpl_A` wrote `isInitialized = 1` or `nonce` at `slot 0`, `WalletImpl_B` inherits dirty `slot 0` unless every EIP-7702 target strictly uses [EIP-7201 namespaced storage](/protocols/eip-7201-namespaced-storage-layout-audit-upgrade-safety)!

## Pre-Pectra vs Post-EIP-7702 EVM Security Invariant Matrix

| Legacy Solidity Check / Pattern | Pre-Pectra Behavior | Post-EIP-7702 Behavior | Mandatory Remediation |
| :--- | :--- | :--- | :--- |
| `require(msg.sender == tx.origin)` | Guaranteed single-call EOA | **Bypassed!** Delegated EOA runs arbitrary batch/callbacks | Use `ReentrancyGuardTransient` (`EIP-1153`) |
| `require(account.code.length == 0)` | Accepted all EOAs | **Reverts** for EIP-7702 upgraded retail EOAs (`len == 23`) | Remove `extcodesize` gates; support [ERC-1271](/protocols/erc-1271-smart-contract-wallet-signature-replay-across-safes) |
| Frontrun Initialization on `SetCode` | N/A | Mempool bot frontruns separate `initialize` call! | Sign `initData` with EOA key inside `initialize`! |
| Switching Delegation `Impl_A -> Impl_B` | N/A | **Storage slots persist** inside EOA account state! | Mandate **EIP-7201** namespaced structs |

![Blast radius comparison of phished ERC-20 approve, Permit2 batch, and EIP-7702 chain_id=0 authorization](/api/figure?type=bars&title=Phished%20Signature%20Blast%20Radius%20Across%20EVM%20Primitives&subtitle=Scope%20of%20compromised%20assets%20and%20chains%20from%20a%20single%20malicious%20off-chain%20user%20signature&steps=Single%20EIP-2612%20permit%28%29%3A%3A1%20ERC-20%20token%20on%201%20chain%20%28bounded%20to%20token%20balance%29%7CPermit2%20PermitBatch%3A%3AAll%20Permit2-approved%20ERC-20s%20on%201%20chain%20%28ETH%20%26%20NFTs%20untouched%29%7CEIP-7702%20%28Single%20chain_id%29%3A%3A100%25%20of%20ETH%20%2B%20ERC-20%20%2B%20NFTs%20%2B%20Safe%20roles%20on%20target%20chain!%7CEIP-7702%20%28chain_id%20%3D%3D%200%29%3A%3ATOTAL%20OMNICHAIN%20COMPROMISE%20across%20every%20EVM%20chain%20at%20matching%20nonce!&metrics=WALLET%20POLICY%3A%3ANever%20dApp-Chosen%3A%3ANever%20let%20websites%20pick%207702%20target%20addr!%7CINIT%20GUARD%3A%3AECDSA%28this%2C%20init%29%3A%3ABlocks%20mempool%20frontrun%20initialization%7CAUTH%20GAS%20COST%3A%3A12%2C500%20-%2025%2C000g%3A%3APER_EMPTY_ACCOUNT_COST%20%2B%20refund%7CBATCH%20UX%20SPEC%3A%3AEIP-5792%3A%3Awallet_sendCalls%20safe%20dApp%20API)

## EIP-7702 RLP Digest Formula & Frontrun-Proof Initialization Invariant

How do MetaMask, Rabby, and institutional MPC custodians safely harness EIP-7702? By **never exposing raw `signAuthorization` to arbitrary web dApps**—instead exposing **EIP-5792 `wallet_sendCalls`**, while the wallet internally delegates **only to its own audited, immutable smart-account singleton**!

```formula
1) EIP-7702 Authorization Signing Preimage (MAGIC = 0x05):
 Auth_Digest = keccak256( concat( 0x05, rlp([ chain_id, delegation_target_address, account_nonce ]) ) )
 Account Bytecode Written = concat( 0xef0100, delegation_target_address ) [Exact 23 bytes]

2) Frontrun-Proof Initialization Requirement on Delegated Implementation:
 NEVER expose unauthenticated initialize(address newGuardian)!
 Attack Vector: A mempool bot can extract the user's signed Auth_Tuple from a pending Type-0x04 tx, submit Auth_Tuple in its OWN frontrun tx, and call initialize(attacker)!
 MANDATORY FIX: Require ECDSA.recover(keccak256(abi.encode(block.chainid, address(this), initNonce, initParams)), eoaInitSig) == address(this)!

Worked Mempool Frontrun Defense Audit:
 Bot intercepts Alice's pending Type-0x04 SetCode tuple and frontruns delegation activation on Alice's EOA (0xAA..11):
 Bot attempts 0xAA..11.initialize(guardian = 0xBot) -> Reverts InvalidInitSignature because Bot lacks 0xAA..11 private key!
```

## Pairing EIP-7702 With EIP-5792 `wallet_sendCalls` & Storage Namespaces

Because dApps call `wallet_sendCalls([approveCalldata, swapCalldata])` without ever choosing the delegation contract address, users gain 1-click Permit-free batching with zero sweeper risk. Inspect collision-free storage namespaces next in [EIP-7201 namespaced storage layouts](/protocols/eip-7201-namespaced-storage-layout-audit-upgrade-safety) and [MetaMask blind-signing simulation UX](/protocols/metamask-eth-sign-deprecation-blind-signing-simulation-ux) inside our [EIP-712, Permit2 & Proxy Security hub](/topics/erc721-erc1155-eip712-permit-security).

## Frequently asked questions

### Why is a phished EIP-7702 authorization far more dangerous than a phished Permit2 signature?

A Permit2 signature only accesses pre-approved ERC-20s on one chain, whereas an EIP-7702 delegation grants DELEGATECALL execution as the EOA itself—capable of sweeping native ETH, all ERC-20s, all NFTs, and all across every chain if chain_id == 0.

### Why does msg.sender == tx.origin no longer block flash loans or reentrancy after Pectra?

Under EIP-7702, the top-level transaction sender (tx.origin) can be a delegated EOA executing custom contract bytecode, allowing single-transaction flash swaps, callbacks, and loops while msg.sender == tx.origin remains true.

### How can an attacker frontrun an EIP-7702 smart-account setup transaction?

Authorization tuples inside Type-0x04 transactions are valid regardless of which relayer submits them; if initialize lacks a separate EOA signature check, a bot can copy the tuple into an earlier tx and initialize themselves as admin.

### How should dApps request atomic approve + swap batches from EIP-7702 wallets safely?

dApps should call the standardized EIP-5792 wallet_sendCalls RPC method, letting the user wallet internally execute the batch via its own audited delegation contract.


## Source URLs

- https://eips.ethereum.org/EIPS/eip-7702
- https://eips.ethereum.org/EIPS/eip-5792
- https://eips.ethereum.org/EIPS/eip-7201

## Citation

- APA: Dr. Devon Kurosawa, PhD. (2026). EIP-7702 EOA Code Delegation Security: SetCode Tx Type 0x04, Sweeper Phishing & tx.origin. NFTVenue Ledger. https://nftvenueledger.com/protocols/eip-7702-eoa-code-delegation-sweeper-phishing-mitigation
- Canonical article: [EIP-7702 EOA Code Delegation Security: SetCode Tx Type 0x04, Sweeper Phishing & tx.origin](https://nftvenueledger.com/protocols/eip-7702-eoa-code-delegation-sweeper-phishing-mitigation)
- Site research index: [NFTVenue Ledger](https://nftvenueledger.com/llms-full.txt)
