Reinitialization Explained in Detail
Upgradeable contracts use initializers instead of constructors. Reinitializers let a new version set new state during an upgrade.
This is useful, but dangerous if an attacker can run setup logic or reuse an initializer version.
Smart contract example
function initializeV2() external reinitializer(2) {
newFeatureEnabled = true;
}
The version number should prevent the same initializer from running twice.
Reinitialization in Auditing
Reinitialization bugs can reset ownership, change roles, overwrite configuration, or activate unsafe modules. They are a common upgradeable-contract takeover path.
Auditors check who can call each initializer and whether the versioning is correct.
Red flags in code
-
initialize()remains callable after deployment. -
Implementation contract is not disabled.
-
Reinitializer version is reused.
-
Upgrade function accepts arbitrary initialization calldata without controls.
-
New variables are not initialized or are initialized by the wrong caller.
How to test or review it
-
Try calling every initializer twice.
-
Try initializing the implementation contract directly.
-
Upgrade with expected and malicious init calldata.
-
Verify owner, roles, and config after upgrade.
-
Check initializer version state across versions.
Keep learning this topic
Initializer Function
An initializer is a one-time setup function used instead of a constructor when a smart contract is deployed behind an upgradeable proxy.
Proxy Initialization
Proxy initialization is the setup step that assigns initial state for an upgradeable proxy, usually through an initializer function instead of a constructor.
Upgradeable Proxy
An upgradeable proxy is a smart contract pattern where users call a stable proxy address while execution is delegated to replaceable implementation logic.
Practice this in real audit scenarios
Definitions help, but auditors need reps. SCH turns concepts like Reinitialization into exploit labs, code review habits, and report-writing practice.
Start the free trial or see the full smart contract auditing course.