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.

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
Permit2signature sweeps only ERC-20 tokens previously approved toPermit2on one specificchainId. - An EIP-7702 authorization sets the victim EOA's account code to
0xef0100 || MaliciousSweeperContract—givingMaliciousSweeperContracttotalDELEGATECALLcontrol 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 == 0inside the authorization tuple so users can delegate their EOA across all EVM chains at once—meaning one phishedchain_id = 0signature compromises the EOA across Ethereum, Arbitrum, Base, Optimism, and Polygon simultaneously!
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:
require(msg.sender == tx.origin, "No bots/flashloans!")Is Dead: With EIP-7702, an attacker delegates their EOA toAttackImpl.soland initiates a Type-0x04 (or standard Type-0x02) transaction from that EOA:msg.sender == tx.originholdstrue, yet the EOA executes multi-step flash loans, reentrancy callbacks, and atomic mints! Replace everytx.originanti-reentrancy hack with explicit CEI +ReentrancyGuardTransient!msg.sender.code.length == 0No Longer Identifies an EOA: A regular user whose MetaMask/Coinbase wallet upgraded via EIP-7702 hasmsg.sender.code.length == 23(0xef0100 + 20 bytes)—so legacy NFT mints withrequire(msg.sender.code.length == 0)permanently brick legitimate upgraded retail users!- Orphaned Storage Collisions Across Re-Delegation: Unlike
SELFDESTRUCT, revoking or switching an EIP-7702 delegation fromWalletImpl_AtoWalletImpl_Bdoes NOT wipe the EOA's storage trie! IfWalletImpl_AwroteisInitialized = 1ornonceatslot 0,WalletImpl_Binherits dirtyslot 0unless every EIP-7702 target strictly uses EIP-7201 namespaced storage!
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 |
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 |
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!
- 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
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-mitigationRelated Erc721 Erc1155 Eip712 Permit Security & Institutional Briefings
Explore Erc721 Erc1155 Eip712 Permit Security Hub (20) →Erc721 Erc1155 Eip712 Permit Security
EIP-712 Typed Signatures, Permit2 Allowances, NFT Royalties & Proxy Timelocks: 2026 Security GuideErc721 Erc1155 Eip712 Permit Security
ERC-5192 Minimal Soulbound NFTs: Non-Transferable KYC Badges, Wrapper Traps & RevocationErc721 Erc1155 Eip712 Permit Security
ERC-6551 Token-Bound Accounts (TBAs): State Nonce Frontrunning & Circular Ownership LocksErc721 Erc1155 Eip712 Permit Security
ERC-721 safeTransferFrom & onERC721Received Reentrancy: Max-Supply Bypass & Escrow DrainsErc721 Erc1155 Eip712 Permit Security
Blind-Signing Deprecation (eth_sign), Pre-Sign Transaction Simulation & EIP-7730 Clear SigningErc721 Erc1155 Eip712 Permit Security
ERC-1155 Batch Transfer Security: Mandatory Receiver Hooks, Array Mismatches & Gas-Bomb DoSErc721 Erc1155 Eip712 Permit Security
CREATE2 Metamorphic Contracts, Cancun EIP-6780 SELFDESTRUCT & Bytecode Provenance AuditsErc721 Erc1155 Eip712 Permit Security
EIP-7201 Namespaced Storage Layouts: Eliminating __gap Fragility in Upgradeable ProxiesCross Chain Bridge Validator Exploits
L2 Sequencer Downtime Oracles: Chainlink Uptime Feeds, Grace Periods & L1 Force-InclusionCross Chain Bridge Validator Exploits
Foundry Stateful Invariant Fuzzing, Handler Ghost Variables & Halmos Symbolic Bytecode ProvingCross Chain Bridge Validator Exploits
Cross-Contract Flash-Swap Oracle Manipulation: Spot-Reserve Valuation & Thin-Pool Collateral DrainsCross Chain Bridge Validator Exploits
Solidity Fixed-Point Precision Audits: WAD/RAY Scaling, mulDiv Overflow & Rounding Exploits
NFTVenue Ledger Data, Benchmarks & Contributor Records
CC BY 4.0 Open Data
Open Institutional Datasets (CSV / JSON) →
Download desk-compiled quantitative series & schemas.
2026 Reference Matrix
2026 Institutional Benchmarks & Thresholds →
Statutory capital, clearing, margin & rate conventions.
Editorial Records
Authors & Review Records →
View named contributors where those records are available.
Complete Index
Master Research & Dossier Archive →
Browse all published briefings by topic pillar & date.
