Secrypta Crypto security lab
RU / EN
Medium Vector: deterministic address·CREATE2 / codehash 14 November 2026·6 min read

CREATE2: why a fresh contract address does not mean a safe one

Abstract

CREATE2 lets an attacker compute a contract address in advance: it is derived from (deployer, salt, initcode) and does not depend on the nonce - so it is predictable before the contract is even deployed. Two drainer techniques ride on this: swapping code at an already-approved address ("metamorphic" - mostly closed today) and the live one - a fresh address per victim that has no history, to slip past wallet blocklists. The key point is simple: "no history" does not mean "safe".

What CREATE2 and a deterministic address are

An ordinary deploy gives an address that depends on the sender's nonce. CREATE2 derives the address from (deployer, salt, initcode) - it is deterministic and pre-computable: knowing those three things, the future contract's address can be known before deployment. The feature itself is useful (wallet factories, L2s and others use it), but it gives an attacker control over which address code will appear at.

Technique 1: swapping code at the same address (metamorphic)

The attacker deploys benign-looking code at a CREATE2 address A; you approve or trust A. Then they destroy the contract (SELFDESTRUCT) and deploy malicious code at the same address A (same salt, new initcode). Your standing approval now points at hostile logic, and it moves your tokens. When this worked, the technique was critical in impact: an approved address suddenly changed behavior.

An honest caveat. EIP-6780 (the Cancun upgrade, 2024) restricted SELFDESTRUCT: the classic "swap at the same address" no longer works, except within the same transaction as creation. So the metamorphic swap is better treated today as history, not a current threat.

Technique 2 (live): a fresh address per victim

This variant is untouched by EIP-6780. Drainers pre-compute a fresh CREATE2 address per victim (or per malicious signature). Such an address has no history and no reputation - so it is not on wallet blocklists and no warning fires. The attack itself is the same (an approve / signature to a malicious contract), but the "clean" fresh address helps it slip past defenses.

The key point

"No history" is not a sign of trust. A new contract with no reputation that you grant full-balance authority to is exactly what this technique counts on. Treat an unfamiliar fresh address as neutral, not as safe.

How to stay safe

  • Codehash pinning (on the wallet side). A policy records the approved contract's EXTCODEHASH at approve time and re-checks it before a spend - swapped or emptied code is rejected. This is the direct answer to a swap.
  • A fresh address is a reason for caution. Granting broad authority to a contract with no history should be a deliberate choice; the absence of "black marks" does not equal safety.
  • This is a delivery layer - basic hygiene applies. The drain itself runs through an approve or a signature, so the same rules hold: an exact limit, read the address, revoke unneeded approvals.

It has already happened

On 12 November 2023, Scam Sniffer described a campaign of CREATE2 drainers: a fresh address per signature so wallets have no history to warn on - about $60M from roughly 99,000 victims over six months. In one documented case a victim lost about $927K (GMX, on Arbitrum). This is incident-level for the fresh-address variant; the corpus marks the metamorphic code swap as a class (after EIP-6780).

Want to practice the skill? In our testnet trainer you break down who you grant access to, and you learn not to confuse a "fresh / unfamiliar address" with a "safe" one.

Sources Scam Sniffer · CoinDesk · MixBytes.