CVE-2024-27094

CVE-2024-27094 is a medium-severity out-of-bounds read vulnerability in @openzeppelin/contracts (npm), affecting versions >= 4.5.0, < 4.9.6. It is fixed in 4.9.6, 5.0.2.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

OpenZeppelin Contracts base64 encoding may read from potentially dirty memory

References

This issue was reported by the Independent Security Researcher Riley Holterhus through Immunefi (@rileyholterhus on X)

Impact

The 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.

Although 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:

  • A bytes memory struct is allocated just after the input and the first bytes of it are non-zero.
  • The memory pointer is set to a non-empty memory location before allocating the input.

Developers should evaluate whether the extra bits can be maliciously manipulated by an attacker.

A read operation accesses a memory location beyond the intended buffer boundary. Typical impact: sensitive data disclosure or crash.

CVE-2024-27094 has a CVSS score of 6.5 (Medium). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (4.9.6, 5.0.2); upgrading removes the vulnerable code path.

Affected versions

@openzeppelin/contracts (>= 4.5.0, < 4.9.6) @openzeppelin/contracts-upgradeable (>= 5.0.0-rc.0, < 5.0.2) @openzeppelin/contracts (>= 5.0.0-rc.0, < 5.0.2) @openzeppelin/contracts-upgradeable (>= 4.5.0, < 4.9.6)

Security releases

@openzeppelin/contracts → 4.9.6 (npm) @openzeppelin/contracts-upgradeable → 5.0.2 (npm) @openzeppelin/contracts → 5.0.2 (npm) @openzeppelin/contracts-upgradeable → 4.9.6 (npm)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

Upgrade to 5.0.2 or 4.9.6.

Frequently Asked Questions

  1. What is CVE-2024-27094? CVE-2024-27094 is a medium-severity out-of-bounds read vulnerability in @openzeppelin/contracts (npm), affecting versions >= 4.5.0, < 4.9.6. It is fixed in 4.9.6, 5.0.2. A read operation accesses a memory location beyond the intended buffer boundary.
  2. How severe is CVE-2024-27094? CVE-2024-27094 has a CVSS score of 6.5 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which packages are affected by CVE-2024-27094?
    • @openzeppelin/contracts (npm) (versions >= 4.5.0, < 4.9.6)
    • @openzeppelin/contracts-upgradeable (npm) (versions >= 5.0.0-rc.0, < 5.0.2)
  4. Is there a fix for CVE-2024-27094? Yes. CVE-2024-27094 is fixed in 4.9.6, 5.0.2. Upgrade to this version or later.
  5. Is CVE-2024-27094 exploitable, and should I be worried? Whether CVE-2024-27094 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether CVE-2024-27094 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix CVE-2024-27094?
    • Upgrade @openzeppelin/contracts to 4.9.6 or later
    • Upgrade @openzeppelin/contracts-upgradeable to 5.0.2 or later
    • Upgrade @openzeppelin/contracts to 5.0.2 or later
    • Upgrade @openzeppelin/contracts-upgradeable to 4.9.6 or later

Other vulnerabilities in @openzeppelin/contracts

Stop the waste.
Protect your environment with Kodem.