Join our Newsletter — 33% off our NHI Course

Storage Collision

Storage collision is a smart contract bug where two variables or contracts try to use the same storage slot. In proxy patterns, it can corrupt state when the proxy and implementation layouts overlap, so upgrades must preserve slot ordering and reserved gaps.

What Storage Collision Means in Upgradeable Contracts

Storage collision is a smart contract layout bug, not a logic bug in isolation. It appears when two components, commonly a proxy and its implementation, map different variables to the same storage slot and accidentally overwrite each other’s state.

In practice, the danger comes from silent corruption. A contract may appear to work after deployment or even after an upgrade, while balances, ownership flags, initialization markers, or configuration values are being read from the wrong slot.

Why Storage Collisions Break Proxy Safety

Proxy patterns depend on strict separation between the proxy’s own bookkeeping and the implementation’s variable layout. If that separation is not preserved, an upgrade can change the meaning of existing storage without changing the external interface, which makes the failure hard to notice until state is already damaged.

That is why reserved gaps, stable slot ordering, and explicit upgrade standards matter. A safe upgrade is not just a code replacement, it is a commitment to preserve the storage map that existing data already depends on.

Collision risk is especially high when developers add, remove, or reorder state variables in an implementation contract without accounting for how the proxy already uses storage. The bug can also emerge when inherited contracts change layout assumptions across versions.

How Teams Spot Storage Layout Exposure

Exposure review starts with the contract inventory, because you cannot verify layout safety if you do not know which contracts are upgradeable. Teams then compare the current storage layout against prior versions and inspect whether the proxy standard in use has reserved implementation slots and upgrade-safe conventions.

Audit review should also look at initialization paths, because bad layout handling often combines with uninitialized proxy states or confused ownership variables. Static analysis, compiler metadata, and layout diffing are useful here because the issue is structural, not behavioural.

For broader upgradeable-contract guidance, Smart Contract Upgradeability and Proxy Security Guide covers the layout, slot, and upgrade controls that prevent this class of failure.

What Safe Remediation Looks Like

The most reliable remediation is to preserve layout compatibility, not to “patch around” corruption after the fact. That usually means keeping storage ordering stable, using well-known proxy patterns, and reserving unused slots so future variables do not collide with existing ones.

When a collision has already occurred, remediation may require migration to a new contract instance with carefully reconstructed state. In many cases, the practical response also includes pausing upgrades, reviewing the last deployment path, and checking whether any corrupted values need manual correction or reconstruction from trusted history.

After the fix, teams should treat the upgrade boundary as a change-control event. The main control objective is to ensure the new implementation reads and writes exactly the slots it is supposed to read and write, and nothing else.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP ASVS, SLSA and OWASP SAMM set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
OWASP ASVS V15 — Secure Coding and Architecture Storage collision is a contract architecture defect that arises from unsafe state layout changes.
Recommendation — Preserve storage layout compatibility across upgrades and review state-variable changes before deployment.
SLSA Supply-chain integrity Upgradeable deployments depend on build and release integrity for the implementation artifact.
Recommendation — Verify artifact provenance before promoting a new implementation into an upgrade path.
OWASP SAMM Software Assurance Maturity Model Upgrade-safe storage handling is a secure development practice that benefits from design-time review.
Recommendation — Bake storage-layout review into design and release assurance for upgradeable contracts.