Skip to content
NFTVenue Ledger
Directory

Erc721 Erc1155 Eip712 Permit Security

EIP-7702 EOA Code Delegation Security: SetCode Tx Type 0x04, Sweeper Phishing & tx.origin

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.

By Dr. Devon Kurosawa, PhDReview not recorded · Updated
EIP-7702 EOA Code Delegation Security: SetCode Tx Type 0x04, Sweeper Phishing & tx.origin — NFTVenue Ledger 2026 quantitative & supervisory data card
NFTVenue Ledger (EIP-712 Signatures, Permit2 Allowance Security, Royalties & Proxy Timelocks): 0xef0100 EOA designators, EIP-5792 wallet_sendCalls walls, and signed init guards.Source: NFTVenue Ledger Institutional Research DeskLicense: CC-BY-4.0

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 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, 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
EIP-7702 0xef0100 delegation designator execution, wallet allowlist firewall, and re-delegation storage hazardVerified Exhibit

Three Solidity Contract Assumptions Broken by EIP-7702!#

Auditing lending markets, NFT mint contracts, and DEXs across our marketplaces directory (from Azuki and Admit One allowlist mints to 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 + 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!

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

Legacy Solidity Check / PatternPre-Pectra BehaviorPost-EIP-7702 BehaviorMandatory Remediation
require(msg.sender == tx.origin)Guaranteed single-call EOABypassed! Delegated EOA runs arbitrary batch/callbacksUse ReentrancyGuardTransient (EIP-1153)
require(account.code.length == 0)Accepted all EOAsReverts for EIP-7702 upgraded retail EOAs (len == 23)Remove extcodesize gates; support ERC-1271
Frontrun Initialization on SetCodeN/AMempool bot frontruns separate initialize call!Sign initData with EOA key inside initialize!
Switching Delegation Impl_A -> Impl_BN/AStorage 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
Blast radius comparison of phished ERC-20 approve, Permit2 batch, and EIP-7702 chain_id=0 authorizationVerified Exhibit

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 or model from the articleNot independently verified
1) EIP-7702 Authorization Signing Preimage (MAGIC = 0x05):
  • AuthDigest = keccak256( concat( 0x05, rlp([ chainid, delegationtargetaddress, account_nonce ]) ) )
  • Account Bytecode Written = concat( 0xef0100, delegationtargetaddress ) [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 AuthTuple from a pending Type-0x04 tx, submit AuthTuple 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 and MetaMask blind-signing simulation UX inside our EIP-712, Permit2 & Proxy Security hub.

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.

Publication record

Published
November 13, 2026
Updated
November 14, 2026
Author
Dr. Devon Kurosawa, PhD
Review
Review not recorded
Automated fact check
Passed in the stored pipeline record
Source URLs
3 recorded

AI assistance recorded: anthropic/claude-opus-4.6. This field does not establish human review or source verification.

Academic & Institutional Attribution

Cite This Research & Embed Live Data Card

Open Attribution License (CC BY 4.0)

Standard academic & institutional research paper citation format.

Dr. Devon Kurosawa, PhD. (2026, November 14). 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
Explore Erc721 Erc1155 Eip712 Permit Security Hub (20) →

NFTVenue Ledger Data, Benchmarks & Contributor Records

EIP-7702 Security: EOA Code Delegation & Phishing Defense | NFTVenue Ledger