DeFi Security AllianceRequest an audit
Menu

EVM patterns

CREATE2: Verify Initialized Ownership Before Funding

A deterministic address does not establish the initialized owner. In 72 local CREATE2 tests, an unchecked registry produced unexpected owners in 16 of its 24 cases despite matching address predictions and runtime hashes. Accept the deployed authority separately before funding.

Three matching address frames above contract modules with different owner keys and a blocked acceptance gate.

Key facts

Local test population
72 complete counterfactual EVM cases. 0 excluded
Unchecked registry
24 of 24 succeeded. 16 had an unexpected owner
Checked registry
8 of 24 succeeded. 16 ownership mismatches reverted
Version pin
OpenZeppelin Contracts v5.4.0 Create2 helper
Inference limit
Local restored worlds. no live deployment frequency or redeployment test

What a predicted CREATE2 address commits to

Accept a deterministic deployment only after its initialized authority matches the release requirement. A predicted address establishes a destination under specified inputs. It does not establish who will control the contract when its constructor finishes. That distinction matters before a team parks funds at an undeployed address or asks an integration to trust an expected owner.

CREATE2 is the EVM contract-creation opcode that derives the destination from the deploying address, a salt and the initialization-code hash. EIP-1014 specifies an 85-byte hash preimage: the 0xff prefix, the 20-byte deployer, the 32-byte salt and the 32-byte initialization-code hash. The resulting address takes the last 20 bytes of the hash.

Identify the actual deployer.

If a factory executes CREATE2, its address supplies that field. The externally submitting account does not automatically replace it. A factory can nevertheless derive its salt from the caller. Review the factory's transformation before comparing a calculator with an observed deployment. An otherwise correct formula applied to the wrong deploying contract gives the wrong acceptance target.

Initialization code
The executable creation payload. In the Solidity pattern used here, it includes creation bytecode followed by ABI-encoded constructor arguments.
Runtime bytecode
The code left at the address after successful initialization. Hashing this instead of the complete creation payload predicts a different destination.
Initialized storage
Persistent values written during construction, such as an owner. These values require their own acceptance checks even when the runtime code matches.
CREATE versus CREATE2
Ordinary CREATE address derivation uses the creator and nonce. CREATE2 uses its specified deployer, salt and initialization-code hash instead of that creator nonce.

The Solidity salted-creation documentation explicitly warns that constructors can query external state. Initcode can therefore commit to instructions that read a registry without committing to the value that registry will return at execution. The address calculation remains correct. Release approval can still be wrong. Consider a release that approves a registry address but leaves its current contents unspecified. Encoding that address binds which registry the constructor will ask. It does not bind the answer. A reviewer needs to identify every construction-time dependency whose response changes an acceptance condition, then decide whether to commit the value, check it during execution or accept its variability explicitly.

A code hash closes a different question. Ordinary storage is not part of the runtime bytecode. Our fixture below uses an ordinary owner variable rather than an immutable value embedded in code, allowing the same code to expose different initialized owners in alternative starting states.

What 72 local deployment tests revealed

Method

We executed a complete constructed grid on . The factory calls the actual OpenZeppelin Contracts v5.4.0 Create2.deploy helper and predicts with Create2.computeAddress. Retained vendor files and hashes identify the implementation tested. This is a version pin, not a claim about the latest library release.

Population
72 cases: 3 constructor policies, 3 registry owners, 2 salts, 2 pre-existing target balances and 2 external factory callers. No rows were excluded.
Constructor policies
Fixed constructor-argument owner. Externally read registry owner. Externally read owner checked against an expected constructor argument.
Inputs
Registry owner is zero, expected or other. Salts are 0 and 1. The predicted address starts with 0 or 7 wei. Callers are the expected or other account. Creation endowment is always 0.
Execution
Solidity 0.8.36, optimizer enabled, via IR compilation and a Cancun local EVM. Factory and registry addresses remain fixed across snapshot-restored worlds.
Acceptance
A successful deployment with the expected owner. A successful CREATE2 return alone does not meet that condition.
Reproduction
seo/research/create2-deployment-security-2026-11-23/measurement.py, DeploymentMatrix.t.sol and measurement.json are repository artifacts, not public downloads. Run the script with its verify option to compare the full retained ledger.

Each row restores a snapshot before changing inputs and deploying. Repeated predicted addresses describe alternative starting worlds. We did not repeatedly deploy into an occupied address on one chain. An independent check recomputed every address from the Ethereum Keccak preimage and reconciled success, owner, balance and code presence against the declared branches. A second execution reproduced every row.

Results

Complete local constructor-policy grid, measured . Each policy has 24 cases
PolicySucceededRevertedExpected ownerUnexpected owner
Fixed argument240240
External registry240816
Checked registry81680

The unchecked registry policy succeeded in every case but met the ownership condition in only 8 of 24. In each salt group, the predicted address and deployed runtime hash stayed identical while the owner took the zero, expected or other value across worlds. Changing the pre-existing balance or external caller did not repair that mismatch.

Take the unchecked policy with salt 0, the other account as caller and a prefunded destination. Setting the registry to the expected owner or the other owner leaves the creation payload unchanged. Both deployments succeed in their respective restored worlds. Each retains 7 wei, but only the first meets the authority condition. The balance is a control variable, not an ownership signal.

The checked policy turned those ownership mismatches into constructor reverts. Its 16 rejected cases are the intended negative controls. Comparing success counts without the acceptance condition would make this policy look worse, although it declined the states the release requirement prohibited. A deployment dashboard needs both outcomes.

Deployment acceptance requires separate evidenceThe creation payload and deployer feed address prediction. Executing the constructor also reads registry state. Final acceptance compares the resulting owner with the release requirement as well as checking address and code.Deployer, salt, initcodePredict destinationRegistry at executionSupplies owner valueConstructor runsCode and storageRelease acceptanceCompare authority
The extra input belongs to execution, so an address-only acceptance rule omits it.
  1. Prediction binds the specified creation payload and deploying context to an address.
  2. Execution resolves external reads and writes the initial storage.
  3. Acceptance compares the actual authority with the approved release requirement before funding proceeds.

There are 6 distinct predicted addresses across the grid because each of the constructor payloads is paired with each salt. An address reappears across the caller, registry and prefunding controls. That repetition makes the counterexample testable without searching for a hash collision. Nothing in the experiment changes the payload while asking the formula to return the same destination.

Limits

  • These constructed cases do not estimate the frequency of unsafe deployed factories or financial losses.
  • The public factory ignores its external caller when deriving the salt. Caller-bound factories need different expectations.
  • We did not execute collisions, SELFDESTRUCT, proxy initialization, gas measurements or public-chain forks. Snapshot restoration cannot prove those behaviors.
  • The registry is a simple fixture. A correct owner check does not establish callback safety, later permission safety or the correctness of an arbitrary external dependency.

Choose an ownership initialization policy

Write the authority requirement before selecting the deployment pattern.

If the owner is known when the release is prepared, passing it explicitly makes that value part of the initcode commitment. If construction must consult an external registry, include the expected value and reject disagreement. That preserves the dependency while making its accepted output explicit.

The choice has an operational cost. A checked registry can block deployment when configuration changes before inclusion. Assign someone to resolve that disagreement rather than removing the check to make a transaction succeed. The alternative is accepting an authority the release did not approve.

Initialization decisions and their acceptance evidence
SituationPolicyTrade-offEvidence required
Owner already approvedExplicit constructor argumentOwner change changes creation payloadEncoded argument and final owner agree
Owner comes from registryRead and check expected ownerChanged registry can block creationMismatch reverts in negative control
Separate initializer requiredReview creation and initialization togetherAddress may omit initializer valuesAuthorized initialization completes atomically
constructor(RegistryFixture registry, address expected) {
    address observed = registry.owner();
    require(observed == expected, "unexpected registry owner");
    owner = observed;
}
Executed checked-registry fixture excerpt. The expected owner is encoded in constructor arguments. This is a laboratory guard, not a complete production contract.

Decide what happens when the intended owner is zero. Our fixed policy deliberately does not add a nonzero-owner restriction, and the checked policy tests equality only. A production application may prohibit a zero authority, require a particular multisignature configuration or intentionally renounce control. Those are additional requirements. Encode them in the acceptance contract and add corresponding controls rather than assuming the example implements them.

Keep address binding and authorization separate. Merely including an owner in a salt or argument is useful only if the executed logic respects that commitment. A different constructor could accept the expected argument but ignore it. Review the assignment and its failure path, then read the deployed result.

A regular initializer introduces another boundary. OpenZeppelin's CREATE2 guide explains why moving values out of construction can remove them from the address calculation and why initialization should occur immediately in the same transaction. Atomicity closes an inter-transaction race. It still requires the initializer's authorization and parameters to be correct. Do not infer those properties from an unchanged initcode hash.

For proxies, extend the review to implementation selection, initialization and upgrade authority. Our upgradeable contract audit guide covers those checks. A counterfactual wallet also needs a signature-verification policy. The ERC6492 verification guide separates that job from predicting its future address. Neither neighboring problem was executed in this grid.

Diagnose a failed CREATE2 deployment

Use the deployed factory's ABI and implementation when interpreting an error. The pinned OpenZeppelin helper rejects empty bytecode, checks available factory balance against endowment and invokes CREATE2. It bubbles nonempty constructor revert data. If creation instead returns zero without such data, the helper raises FailedDeployment. That error is not a diagnosis of one unique cause.

  1. Recompute the full initcode hash from the retained creation bytecode and encoded constructor arguments. Compare actual bytes, not source filenames.
  2. Resolve the factory's effective salt. Include caller-derived transformations before asking whether the address prediction matches.
  3. Inspect the execution trace and revert data at the creation boundary. In our checked-registry rows, the constructor deliberately rejects an unexpected owner.
  4. Check destination nonce and code, then factory funding and constructor payment requirements. A zero endowment does not require a payable constructor merely because the destination already holds ether.
  5. Repeat the failed case against the relevant block state with the same inputs. Preserve the original failure before changing configuration.

The library's computeAddress function computes an address. It does not run the constructor or inspect the registry. Its default overload uses the calling contract as deployer, while another overload accepts a deployer explicitly. Off-chain tools must use the same context. An implementation that invokes the helper through a different execution context needs a trace-based check of which address actually executes CREATE2.

Keep the destination's prefunding separate from the factory's ability to send deployment value. Our target balances were established before creation and the factory supplied no endowment. They therefore do not test a nonzero-value deployment. If a real constructor expects payment, retain the actual value, factory balance and payable-constructor condition in the reproduction inputs. Changing that amount can change execution even though it is absent from the address formula.

Do not turn retries into evidence.

If a simulation succeeds after the registry changes, it explains a different world. Record which state and inputs produced each result. Funding approval should follow the accepted deployment state, not whichever simulation was last green. For a build mismatch, the dependency and version review helps identify which helper and compiler inputs actually shipped.

Check address availability and lifecycle rules

A calculator can produce an address that is unavailable for creation. EIP-684 requires creation to fail when the destination has a nonzero nonce or nonempty code. Checking code alone is therefore incomplete. A balance by itself is a different condition: all prefunded successful cases in our grid retained the target's existing wei after zero-endowment creation.

Destination checks and the source of each conclusion
Observed conditionAcceptance consequenceEvidence boundary
Balance without code or nonceNot by itself a collision barLocal prefunding controls plus creation rules
Nonzero nonceCreation collision must failEIP-684. Not executed here
Nonempty codeCreation collision must failEIP-684. Not executed here
Prior SELFDESTRUCTDo not assume address became reusableCheck applicable EIP-6780 behavior

Older explanations of metamorphic contracts need a fork-specific reading. Under EIP-6780, SELFDESTRUCT outside the contract's creation transaction does not delete its code or storage. The same-creation-transaction exception has different behavior, but it is not a general permission to overwrite a live address. EIP-1014 also explains why a second creation within a transaction collides after the nonce changes.

Our experiment makes no redeployment claim. The snapshots deliberately erase earlier test worlds so each row begins without a previous deployment. Treating those resets as a production lifecycle would invalidate the conclusion. On another chain, establish its execution rules and activation state before applying Ethereum lifecycle assumptions.

Assign deployment acceptance before funding

The release owner should sign off on an evidence bundle that distinguishes the destination from the deployed authority. The developer prepares it, an independent reviewer reproduces the critical checks and the person controlling funds waits for the agreed acceptance result. These are proposed responsibilities, not roles measured by our experiment.

Deployment handoff responsibilities
Responsible roleDeliverableAcceptance condition
DeveloperCreation manifestFactory, effective salt and initcode reproduce address
ReviewerState verification recordRuntime and initialized authority match requirement
Release ownerNegative-control resultWrong authority cannot pass funding approval
Funding operatorBlock-bound release decisionObserved deployment meets approved conditions

Retain compiler version, optimizer and IR settings, source hashes, constructor encoding and metadata configuration. Solidity metadata can affect bytecode identity, so visually identical source excerpts are insufficient for byte-for-byte reproduction. Save the actual initcode and runtime hash alongside the chain, block identity and final authority reads.

State the residual risk. An initial owner match cannot prove future permissions, dependency behavior or upgrade safety. If the deployment can change authority later, define the monitoring and change approval separately. Reviewers can compare documented providers through the Pharos Production member profile and scope verification tools through the security tools hub. Neither directory listing certifies a deployment.

An acceptance record also needs an update rule. If the registry, deployment payload or approved authority changes before execution, stop and review the affected condition. After inclusion, record the state at the block used for approval. A later read can explain subsequent changes but cannot silently replace the original observation. This is especially useful when an explorer, simulator and deployment script disagree.

Make the funding condition executable where practical. Require the expected owner and other necessary state after deployment, and retain a failing control for a mismatched dependency. Release approval becomes reviewable when someone can identify the exact observation that would stop it.

Frequently asked questions

Does the CREATE2 formula include chain ID?

EIP1014 does not include chain ID in its address preimage. Matching deployer, salt and initcode can therefore produce matching predictions where the same rules apply. That does not establish equal registry state, code at dependencies or initialized authority across chains. Chain-specific execution implementations need their own verification. The local grid did not test other networks.

Can explorer source verification or a factory event replace an owner read?

Source verification helps identify code, while an event records what the emitting contract reported. Neither by itself establishes the accepted storage at the block used for release approval. Check the actual deployed authority against its requirement and keep the block identity with the record. The experiment did not assess any explorer or indexer.

What if a relayer submits a caller-bound factory deployment?

Inspect whether the factory derives its effective salt from msg.sender and whether its authorized relayer path uses a different identity. Changing the submitting account can change the destination under that policy. Recompute using the actual effective salt and keep the intended beneficiary distinct from the submitter. Our unrestricted laboratory factory did not implement relayer authorization.

Comments

0

    Leave a comment

    Share a question or observation about this article.

    10 to 3,000 characters.