Vulnerabilities in pkg:npm/@openzeppelin/contracts
PACKAGECVE-2024-27094 is a MODERATE (CVSS 6.5) openzeppelin contracts base64 encoding may vulnerability (CWE-125: Out-of-bounds Read) affecting @openzeppelin/contracts libraries in the npm ecosystem. The issue involves openzeppelin contracts base64 encoding may read from potentially dirty memory. Remediation is available by upgrading affected packages to version 4.9.6, 5.0.2.
pkg:npm/@openzeppelin/contracts
Vulnerability advisories affecting package pkg:npm/@openzeppelin/contracts. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-9vx6-7xxf-x967 | CVE-2024-27094 | MODERATE | OpenZeppelin Contracts base64 encoding may read from potentially dirty memory |
| GHSA-9rcw-c2f9-2j55 | CVE-2025-54070 | MODERATE | OpenZeppelin Contracts Bytes's lastIndexOf function with position argument performs out-of-bound memory access on empty buffers |
| GHSA-699g-q6qh-q4v8 | CVE-2023-49798 | MODERATE | OpenZeppelin Contracts and Contracts Upgradeable duplicated execution of subcalls in v4.9.4 |
| GHSA-g4vp-m682-qqmp | CVE-2023-40014 | MODERATE | OpenZeppelin Contracts vulnerable to Improper Escaping of Output |
| GHSA-wprv-93r4-jj2p | CVE-2023-34459 | MODERATE | OpenZeppelin Contracts using MerkleProof multiproofs may allow proving arbitrary leaves for specific trees |
| GHSA-5h3x-9wvq-w4m2 | CVE-2023-34234 | MODERATE | OpenZeppelin Contracts's governor proposal creation may be blocked by frontrunning |
| GHSA-93hq-5wgc-jc82 | CVE-2023-30542 | HIGH | GovernorCompatibilityBravo may trim proposal calldata |
| GHSA-mx2q-35m2-x2rh | CVE-2023-30541 | MODERATE | OpenZeppelin Contracts TransparentUpgradeableProxy clashing selector calls may not be delegated |
| GHSA-878m-3g6q-594q | CVE-2023-26488 | MODERATE | OpenZeppelin Contracts contains Incorrect Calculation |
| GHSA-9c22-pwxw-p6hx | CVE-2022-39384 | MODERATE | OpenZeppelin Contracts initializer reentrancy may lead to double initialization |
| GHSA-4h98-2769-gh6h | CVE-2022-35961 | HIGH | OpenZeppelin Contracts vulnerable to ECDSA signature malleability |
| GHSA-xrc4-737v-9q75 | CVE-2022-31198 | HIGH | OpenZeppelin Contracts's GovernorVotesQuorumFraction updates to quorum may affect past defeated proposals |
| GHSA-9j3m-g383-29qr | CVE-2022-35916 | MODERATE | OpenZeppelin Contracts's Cross chain utilities for Arbitrum L2 see EOA calls as cross chain calls |
| GHSA-7grf-83vw-6f5x | CVE-2022-35915 | MODERATE | OpenZeppelin Contracts ERC165Checker unbounded gas consumption |
| GHSA-qh9x-gcfh-pcrw | CVE-2022-31170 | HIGH | OpenZeppelin Contracts's ERC165Checker may revert instead of returning false |
| GHSA-4g63-c64m-25w9 | CVE-2022-31172 | HIGH | OpenZeppelin Contracts's SignatureChecker may revert on invalid EIP-1271 signers |
| GHSA-88g8-f5mf-f5rj | CVE-2021-46320 | HIGH | Improper Initialization in OpenZeppelin |
| GHSA-m6w8-fq7v-ph4m | - | MODERATE | GovernorCompatibilityBravo incorrect ABI encoding may lead to unexpected behavior |
| GHSA-5vp3-v4hc-gx76 | CVE-2021-41264 | CRITICAL | UUPSUpgradeable vulnerability in @openzeppelin/contracts |
| GHSA-wmpv-c2jp-j2xg | - | LOW | ERC1155Supply vulnerability in OpenZeppelin Contracts |
| GHSA-fg47-3c2x-m2wr | CVE-2021-39167 | CRITICAL | TimelockController vulnerability in OpenZeppelin Contracts |
CVE-2024-27094 at a Glance
Security Impact
CVSS: 6.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:H).
How to Fix CVE-2024-27094
To remediate this vulnerability, upgrade all affected @openzeppelin/contracts dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install @openzeppelin/contracts@4.9.6
npm install @openzeppelin/contracts-upgradeable@5.0.2
npm install @openzeppelin/contracts@5.0.2
npm install @openzeppelin/contracts-upgradeable@4.9.6
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @openzeppelin/contracts
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2024-27094, inspect your project dependencies using npm:
npm ls @openzeppelin/contracts
Analyze the terminal output to locate any version of @openzeppelin/contracts in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.9.6), your application is affected.
Note: The npm ls @openzeppelin/contracts command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-125: Out-of-bounds Read, where the product reads data past the end, or before the beginning, of the intended buffer. In @openzeppelin/contracts, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-27094 Affected @openzeppelin/contracts Versions
4 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@openzeppelin/contracts
|
npm |
≥ 4.5.0
< 4.9.6
|
4.9.6
|
|
@openzeppelin/contracts-upgradeable
|
npm |
≥ 5.0.0-rc.0
< 5.0.2
|
5.0.2
|
|
@openzeppelin/contracts
|
npm |
≥ 5.0.0-rc.0
< 5.0.2
|
5.0.2
|
|
@openzeppelin/contracts-upgradeable
|
npm |
≥ 4.5.0
< 4.9.6
|
4.9.6
|
References
Frequently Asked Questions
What is CVE-2024-27094?
Which @openzeppelin/contracts versions are affected?
What version fixes CVE-2024-27094?
Is @openzeppelin/contracts affected?
Is @openzeppelin/contracts-upgradeable affected?
What is the CVSS score of CVE-2024-27094?
What CWE is associated with CVE-2024-27094?
How can I check npm dependencies for CVE-2024-27094?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-9vx6-7xxf-x967",
"modified" : "2025-12-04T22:49:19Z",
"published" : "2024-02-29T20:09:53Z",
"aliases" : [ "CVE-2024-27094" ],
"summary" : "OpenZeppelin Contracts base64 encoding may read from potentially dirty memory",
"details" : "### Impact\n\nThe `Base64.encode` function encodes a `bytes` input by iterating over it in chunks of 3 bytes. When this input is not a multiple of 3, the last iteration may read parts of the memory that are beyond the input buffer.\n\nAlthough the `encode` function pads the output for these cases, up to 4 bits of data are kept between the encoding and padding, corrupting the output if these bits were dirty (i.e. memory after the input is not 0). These conditions are more frequent in the following scenarios:\n\n- A `bytes memory` struct is allocated just after the input and the first bytes of it are non-zero.\n- The memory pointer is set to a non-empty memory location before allocating the input.\n\nDevelopers should evaluate whether the extra bits can be maliciously manipulated by an attacker.\n\n### Patches\n\nUpgrade to 5.0.2 or 4.9.6.\n\n### References\n\nThis issue was reported by the Independent Security Researcher Riley Holterhus through Immunefi (@rileyholterhus on X)",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@openzeppelin/contracts"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.5.0"
}, {
"fixed" : "4.9.6"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "@openzeppelin/contracts-upgradeable"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "5.0.0-rc.0"
}, {
"fixed" : "5.0.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "@openzeppelin/contracts"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "5.0.0-rc.0"
}, {
"fixed" : "5.0.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "@openzeppelin/contracts-upgradeable"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.5.0"
}, {
"fixed" : "4.9.6"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/OpenZeppelin/openzeppelin-contracts/security/advisories/GHSA-9vx6-7xxf-x967"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-27094"
}, {
"type" : "WEB",
"url" : "https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/commit/2d081f24cac1a867f6f73d512f2022e1fa987854"
}, {
"type" : "WEB",
"url" : "https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/commit/723f8cab09cdae1aca9ec9cc1cfa040c2d4b06c1"
}, {
"type" : "WEB",
"url" : "https://github.com/OpenZeppelin/openzeppelin-contracts/commit/92224533b1263772b0774eec3134e132a3d7b2a6"
}, {
"type" : "WEB",
"url" : "https://github.com/OpenZeppelin/openzeppelin-contracts/commit/a6286d0fded8771b3a645e5813e51993c490399c"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/OpenZeppelin/openzeppelin-contracts"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-125" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-02-29T20:09:53Z",
"nvd_published_at" : "2024-03-21T02:52:18Z"
}
}