Erc721 Erc1155 Eip712 Permit Security
CREATE2 Metamorphic Contracts, Cancun EIP-6780 SELFDESTRUCT & Bytecode Provenance Audits
Before Dencun EIP-6780, attackers disguised upgradeable rug-pull contracts as immutable non-proxy code using CREATE2 + CREATE + SELFDESTRUCT metamorphic factories.

In May 2023, an attacker submitted a benign-looking DAO governance proposal (Tornado Cash DAO takeover) whose verified proposal contract on Etherscan contained zero DELEGATECALL proxy opcodes—convincing token holders the proposal bytecode was 100% immutable! Seconds before execution, the attacker triggered an emergency SELFDESTRUCT, wiped the verified proposal contract, and redeployed completely different malicious bytecode at the exact same Ethereum address to seize complete DAO governance!
Anchored in our EIP-712, Permit2 & proxy security master guide, understanding CREATE2 Metamorphic Redeployment Chains and Cancun EIP-6780 SELFDESTRUCT Semantics is critical when auditing Seaport Zones, Uniswap v4 Hooks, and cross-chain deployments across EVM L1s and L2s in our marketplaces directory (from 9mm Pro to Baryonswap Viction where older EVM hard-fork parity must be verified!).
How the CREATE2 -> CREATE -> SELFDESTRUCT Metamorphic Trick Worked!#
At first glance, CREATE2 hashes init_code (keccak256(0xff ++ deployer ++ salt ++ keccak256(init_code))), so changing bytecode appears to change the deployed address. Watch the two-stage trick that bypassed human source-code review:
- Non-Deterministic Initcode Loader:
CREATE2hashes the initialization code (init_code), NOT the runtime code returned byinit_code! A 30-byte loaderinit_codesimply callsfactory.getImplementationduring construction andEXTCODECOPYs whatever runtime bytecode the factory points to today! - Or the
CREATE2 -> CREATENonce Reset Chain: FactoryF(deployed viaCREATE2withSELFDESTRUCT) deploys TargetTvia regularCREATEatnonce = 1(Address(T) = keccak256(rlp([F, 1])))—soT'sinit_codeisn't hashed at all! When bothTandFcalledSELFDESTRUCT,F's nonce reset to0; redeployingFat the identicalCREATE2address resetF's nonce to1, deploying arbitrary new bytecodeT'at the exact same addressT!
What Cancun EIP-6780 Changed—And What Residual Edge Cases Remain!#
Activated in the March 2024 Dencun hard fork on Ethereum Mainnet (and Cancun-aligned L2s like Arbitrum, Optimism, and Base), EIP-6780 radically neutered 0xff (SELFDESTRUCT):
- In Any Transaction After Deployment: Executing
SELFDESTRUCT(beneficiary)transfers the contract's ETH balance tobeneficiaryONLY—it does NOT delete contract bytecode, does NOT wipe storage, and does NOT reset account nonce! Consequently, post-deployment metamorphicCREATE2rugs are 100% impossible on EIP-6780 chains! - Three Residual Traps Auditors STILL Catch in 2026:
- Lagging Alt-L1s / Legacy EVM Sidechains: Several older EVM-compatible sidechains and enterprise forks have not activated EIP-6780—where classic metamorphic rugs still work!
- Broken
address(this).balanceAccounting viaSELFDESTRUCT: Even under EIP-6780, an attacker can deploy an ephemeral contract andSELFDESTRUCT(victimVault)inside the same transaction, force-feeding ETH intovictimVaultwithout triggeringreceiveand breaking naiverequire(address(this).balance == totalAccounting)invariants! - Counterfactual Pre-Deployment Hijacking (
CREATE2Parameter Frontrunning): If a factory derivessalt = userSuppliedSaltwithout hashingmsg.senderor initialization parameters intosalt, a mempool bot can frontrunCREATE2deployment with tampered admin arguments!
Bytecode Mutability & Provenance Verification Matrix#
| Mutability Vector | Etherscan Shows "Proxy"? | Works on Cancun (EIP-6780) Ethereum? | Works on Pre-Cancun EVM? | Deterministic On-Chain Defense |
|---|---|---|---|---|
| ERC-1967 / UUPS / Diamond Proxy | Yes (0xf4 DELEGATECALL) | Yes (Intended upgradeability) | Yes | Require 7d Timelock |
Classic CREATE2 + SELFDESTRUCT | No! (Looks immutable!) | NO (0xff keeps code intact!) | YES (Critical Rug!) | Pin target.codehash == EXPECTED_HASH |
| External Config / Router Pointer | No! (Uses CALL to mutable addr) | YES! (Most common hidden rug!) | YES! | Audit all storage address setters! |
Same-Tx Ephemeral CREATE2 + 0xff | N/A (0-byte persistent code) | YES! (Same-tx 0xff still wipes!) | Yes | Never trust extcodesize == 0! |
Safe CREATE2 Salt Derivation & Proposal extcodehash Pinning Formula#
Both Uniswap v4 Hook deployers (who mine CREATE2 salts so leading address bits match hook permission flags) and DAO Governor executors enforce two mathematical guarantees:
- Safe_Salt = keccak256(abi.encode(msg.sender, chainSpecificConfigHash, userVanityNonce))
- DeployAddr = address(uint160(uint256(keccak256(concat(0xff, address(factory), SafeSalt, keccak256(init_code))))))
- // Because msg.sender & configHash sit inside SafeSalt, no mempool bot can deploy at DeployAddr with altered admin args!
- 2) DAO Governor Proposal Bytecode Pinning (Blocks Tornado-DAO Style Code Swaps on ANY Chain):
- At Proposal Snapshot Time t_propose:
- Recorded_CodeHash[proposalId] = targetContract.codehash [EIP-1052 EXTCODEHASH opcode]
- At Timelock Execution Time texec = tpropose + 7 days:
- require(targetContract.codehash == RecordedCodeHash[proposalId] && RecordedCodeHash != 0x0, "BytecodeMutated!")
Completing Proxy Upgrade Safety With EIP-7201 Namespaces#
When protocols legitimately do need upgradeability rather than immutable CREATE2 ossification, how do OpenZeppelin v5 contracts guarantee zero storage-slot collisions across multi-inheritance upgrade trees without fragile __gap arrays? Conclude Silo 3 next in EIP-7201 namespaced storage layouts and ERC-1967 vs UUPS proxies inside our EIP-712, Permit2 & Proxy Security hub.
Frequently asked questions
How did the Tornado Cash DAO attacker change a verified contract that had no proxy?
The proposal contract and its parent deployer contained SELFDESTRUCT behind an emergency function; destroying both reset the intermediate CREATE deployer nonce so the attacker redeployed malicious code at the exact approved address.
Are CREATE2 metamorphic rug pulls still possible on Ethereum Mainnet after Dencun (EIP-6780)?
No for already-deployed contracts: EIP-6780 changed SELFDESTRUCT so calling it in a later block only sweeps ETH without deleting bytecode or resetting nonces—though auditors must still check EIP-6780 activation on non-Ethereum alt-EVMs!
Can EIP-6780 SELFDESTRUCT still bypass extcodesize == 0 checks?
Yes! EIP-6780 preserves legacy deletion behavior when a contract is created AND self-destructed within the exact same transaction, during which its constructor also has extcodesize == 0.
Why do Uniswap v4 Hooks rely heavily on CREATE2 salt mining?
Uniswap v4 PoolManager encodes which hook callbacks are active (beforeSwap, afterSwap, etc.) directly inside the top 14 bits of the hook contract 20-byte address, requiring CREATE2 salt mining.
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). CREATE2 Metamorphic Contracts, Cancun EIP-6780 SELFDESTRUCT & Bytecode Provenance Audits. NFTVenue Ledger. https://nftvenueledger.com/protocols/create2-metamorphic-contract-redeployment-rug-detectionRelated 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
EIP-7201 Namespaced Storage Layouts: Eliminating __gap Fragility in Upgradeable ProxiesErc721 Erc1155 Eip712 Permit Security
EIP-712 Domain Separator Engineering: Dynamic chainId Caching & Cross-Fork Replay DefenseErc721 Erc1155 Eip712 Permit Security
Uniswap Permit2 Security Audit: AllowanceTransfer vs SignatureTransfer & Witness PhishingErc721 Erc1155 Eip712 Permit Security
EIP-2612 ERC-20 Permit Audits: ecrecover Zero-Address, s-Malleability & Griefing FrontrunsErc721 Erc1155 Eip712 Permit Security
ERC-721 & ERC-1155 setApprovalForAll Security: Operator Blast Radius & Conduit IsolationErc721 Erc1155 Eip712 Permit Security
Seaport v1.6 Protocol Architecture: Conduits, Hook Zones & Bulk Order Merkle TreesErc721 Erc1155 Eip712 Permit Security
ERC-2981 NFT Royalty Signaling vs ERC-721C Programmable Transfer-Validator EnforcementCross Chain Bridge Validator Exploits
Restaked Bridge & Oracle AVSs (EigenLayer / Symbiotic): Slashing Math & Corruptible-Majority BoundsOnchain Wash Trading Market Abuse
Tarjan Strongly Connected Components (SCC) & Johnson Cycle Graphs for NFT Wash-Trade FilteringOnchain Wash Trading Market Abuse
Zero-Fee Token-Rebate Mining & Points Farming: NFT Marketplace Volume Distortion MechanicsOnchain Wash Trading Market Abuse
MiCA Article 92 PPAET Compliance: Automated Market-Abuse Surveillance & RTS 2025/885 Architecture
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.
