Skip to content

GHSA-7j52-6fjp-58gr

Inconsistent storage layout for ERC2771ContextUpgradeable

Low npm
Severity
Low
The publisher's own rating, not a CVSS score
Exploit chance (EPSS)
—
No score published
Known exploited
No
Not in CISA's catalog
Weakness
—
Not classified
Fix
4.3.0
Upgrade @openzeppelin/contracts-upgradeable to this version or later

Description

Impact

The storage layout of the ERC2771ContextUpgradeable is not constant between versions.

  • versions 4.0.0, 4.1.0 and 4.2.0, the contract has a length of 51 slots.
  • since 4.3.0, the contract has a length of 50 slots
  • future versions will continue using 50 slots.

This difference in layout could result in breaking upgrades if someone upgrades from an affected version to a non-affected version. It is thus recommended to be extremely careful when upgrading from a contract that uses ERC2771ContextUpgradeable <4.3.0 to a newer version that uses >=4.3.0.

We've assessed the instances of this contract found on chain (with publicly verified source code) and notified the corresponding teams of the risk that an upgrade could cause.

Workarounds

Potentially breaking upgrades would be caught by the OpenZeppelin Upgrades Plugins for Hardhat and Truffle. It is recommended to use this tooling for all your upgrades.

If you need to upgrade to a newer version of the Upgradeable Contracts library, we recommend copying the previous implementation ERC2771ContextUpgradeable (available in the release-4.2 branch) and packaging it with your code.

Reference

https://github.com/OpenZeppelin/openzeppelin-transpiler/pull/86

For more information

If you have any questions, comments, or need assistance regarding this advisory, email us at security@openzeppelin.com.

To submit security reports please use our bug bounty on Immunefi.

Affected versions

npm

PackageVulnerableFixed in
@openzeppelin/contracts-upgradeable
>= 4.0.0, < 4.3.0
4.3.0

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

@openzeppelin/contracts-upgradeable npm → 4.3.0

npm
npm install @openzeppelin/contracts-upgradeable@4.3.0
yarn
yarn add @openzeppelin/contracts-upgradeable@4.3.0
pnpm
pnpm add @openzeppelin/contracts-upgradeable@4.3.0

References

Timeline

  1. Published
AdvisorySeverityWhy it's related
GHSA-9rcw-c2f9-2j55
OpenZeppelin Contracts Bytes's lastIndexOf function with position argument performs out-of-bound memory access on empty buffers
Medium Also affects @openzeppelin/contracts-upgradeable
GHSA-9vx6-7xxf-x967
OpenZeppelin Contracts base64 encoding may read from potentially dirty memory
High Also affects @openzeppelin/contracts-upgradeable
GHSA-699g-q6qh-q4v8
OpenZeppelin Contracts and Contracts Upgradeable duplicated execution of subcalls in v4.9.4
High Also affects @openzeppelin/contracts-upgradeable
GHSA-g4vp-m682-qqmp
OpenZeppelin Contracts vulnerable to Improper Escaping of Output
Medium Also affects @openzeppelin/contracts-upgradeable
GHSA-wprv-93r4-jj2p
OpenZeppelin Contracts using MerkleProof multiproofs may allow proving arbitrary leaves for specific trees
Medium Also affects @openzeppelin/contracts-upgradeable
GHSA-5h3x-9wvq-w4m2
OpenZeppelin Contracts's governor proposal creation may be blocked by frontrunning
Medium Also affects @openzeppelin/contracts-upgradeable
GHSA-mx2q-35m2-x2rh
OpenZeppelin Contracts TransparentUpgradeableProxy clashing selector calls may not be delegated
Medium Also affects @openzeppelin/contracts-upgradeable
GHSA-93hq-5wgc-jc82
GovernorCompatibilityBravo may trim proposal calldata
High Also affects @openzeppelin/contracts-upgradeable
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor