Skip to content

CREATE2 Address Reuse After selfdestruct (Metamorphic)

SAFE-0236 Low-Level / Assembly Checked automatically by the scanner
1

What goes wrong

A contract deployed via CREATE2 can be selfdestructed and then re-deployed to the SAME address with different bytecode. Integrations that trust the code at a CREATE2 address can be rugged by a metamorphic swap.

2

The vulnerable pattern

proof of concept — how it is exploited
// 1. deploy 'benign' contract via CREATE2, get it whitelisted.
// 2. selfdestruct it. 3. CREATE2 again at same address with EVIL code.
// integrators still trust the address -> drained.
3

How to fix it

the pattern that is safe
// pin the expected codehash; disallow selfdestruct in deployed logic
require(addr.codehash == EXPECTED_CODEHASH, "unexpected code");
Tornado governance incident. Verify codehash, ban selfdestruct.
4

Where this has happened

Largest recorded losses in the same failure class — related, not the same bug:

Check your own contract for this

The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0236 among them. Paste an address or the source itself — a small per-scan fee, shown before you sign, or unlimited on any plan.

Run the scanner See how it is attacked Read the docs