Skip to content

Proxy Storage Collision

Description

A proxy contract declares a state variable that may override a storage slot of the implementation contract, potentially leading to unintended behavior or security vulnerabilities.

Examples

Insecure Code

solidity
contract MyContract is UpgradeabilityProxy { uint256 public myVar; }

Secure Code

solidity
contract MyContract is UpgradeabilityProxy { uint256 public immutable myVar; }

Remediation

Use the `immutable` or `constant` keyword for state variables that should not be overridden, or ensure that the state variable names do not collide with those in the implementation contract.

Rule Details

FieldValue
IDCODE-0096
CategoryInsecureConfig
SeverityHIGH
CWECWE-787
ConfidenceHIGH
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityMODERATE
Tagssmart contract, proxy contract, storage collision
OWASPN/A

References