Skip to content
NFTVenue Ledger
Directory

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.

By Dr. Devon Kurosawa, PhDReview not recorded · Updated
CREATE2 Metamorphic Contracts, Cancun EIP-6780 SELFDESTRUCT & Bytecode Provenance Audits — NFTVenue Ledger 2026 quantitative & supervisory data card
NFTVenue Ledger (EIP-712 Signatures, Permit2 Allowance Security, Royalties & Proxy Timelocks): Metamorphic factory lineage scans, Cancun EIP-6780 rules, and DAO extcodehash pinning.Source: NFTVenue Ledger Institutional Research DeskLicense: CC-BY-4.0

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:

  1. Non-Deterministic Initcode Loader: CREATE2 hashes the initialization code (init_code), NOT the runtime code returned by init_code! A 30-byte loader init_code simply calls factory.getImplementation during construction and EXTCODECOPYs whatever runtime bytecode the factory points to today!
  2. Or the CREATE2 -> CREATE Nonce Reset Chain: Factory F (deployed via CREATE2 with SELFDESTRUCT) deploys Target T via regular CREATE at nonce = 1 (Address(T) = keccak256(rlp([F, 1])))—so T's init_code isn't hashed at all! When both T and F called SELFDESTRUCT, F's nonce reset to 0; redeploying F at the identical CREATE2 address reset F's nonce to 1, deploying arbitrary new bytecode T' at the exact same address T!
Pre-Cancun CREATE2 metamorphic contract swap vs Post-Cancun EIP-6780 SELFDESTRUCT opcode neutralization
Pre-Cancun CREATE2 metamorphic contract swap vs Post-Cancun EIP-6780 SELFDESTRUCT opcode neutralizationVerified Exhibit

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 to beneficiary ONLY—it does NOT delete contract bytecode, does NOT wipe storage, and does NOT reset account nonce! Consequently, post-deployment metamorphic CREATE2 rugs are 100% impossible on EIP-6780 chains!
  • Three Residual Traps Auditors STILL Catch in 2026:
  1. 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!
  2. Broken address(this).balance Accounting via SELFDESTRUCT: Even under EIP-6780, an attacker can deploy an ephemeral contract and SELFDESTRUCT(victimVault) inside the same transaction, force-feeding ETH into victimVault without triggering receive and breaking naive require(address(this).balance == totalAccounting) invariants!
  3. Counterfactual Pre-Deployment Hijacking (CREATE2 Parameter Frontrunning): If a factory derives salt = userSuppliedSalt without hashing msg.sender or initialization parameters into salt, a mempool bot can frontrun CREATE2 deployment with tampered admin arguments!

Bytecode Mutability & Provenance Verification Matrix#

Quantitative Distribution · Deterministic On-Chain Defense
Deterministic On-Chain Defense
01ERC-1967 / UUPS / Diamond P…Require 7d Time…02Same-Tx Ephemeral CREATE2 +…Never trust ext…
Mutability VectorEtherscan Shows "Proxy"?Works on Cancun (EIP-6780) Ethereum?Works on Pre-Cancun EVM?Deterministic On-Chain Defense
ERC-1967 / UUPS / Diamond ProxyYes (0xf4 DELEGATECALL)Yes (Intended upgradeability)YesRequire 7d Timelock
Classic CREATE2 + SELFDESTRUCTNo! (Looks immutable!)NO (0xff keeps code intact!)YES (Critical Rug!)Pin target.codehash == EXPECTED_HASH
External Config / Router PointerNo! (Uses CALL to mutable addr)YES! (Most common hidden rug!)YES!Audit all storage address setters!
Same-Tx Ephemeral CREATE2 + 0xffN/A (0-byte persistent code)YES! (Same-tx 0xff still wipes!)YesNever trust extcodesize == 0!
Effectiveness of static opcode scanning, EIP-6780 fork rules, and extcodehash pinning against hidden mutability
Effectiveness of static opcode scanning, EIP-6780 fork rules, and extcodehash pinning against hidden mutabilityVerified Exhibit

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:

Formula or model from the articleNot independently verified
1) Frontrun-Proof CREATE2 Salt Derivation (Binds Caller & Initialization State):
  • 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

Open Attribution License (CC BY 4.0)

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-detection
Explore Erc721 Erc1155 Eip712 Permit Security Hub (20) →

NFTVenue Ledger Data, Benchmarks & Contributor Records

CREATE2 Metamorphic Contracts & EIP-6780 SELFDESTRUCT Audit | NFTVenue Ledger