GHSA-9vx6-7xxf-x967
MEDIUMOpenZeppelin Contracts base64 encoding may read from potentially dirty memory
EPSS Exploitation Probability
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
Blast Radius
Weekly download volume for affected packages — a proxy for how broadly this vulnerability is deployed.
@openzeppelin/contractsnpm@openzeppelin/contracts-upgradeablenpmDescription
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 memorystruct 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.
Patches
Upgrade to 5.0.2 or 4.9.6.
References
This issue was reported by the Independent Security Researcher Riley Holterhus through Immunefi (@rileyholterhus on X)
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | @openzeppelin/contracts | ≥ 4.5.0&&< 4.9.6 | 4.9.6 |
| 📦npm | @openzeppelin/contracts-upgradeable | ≥ 5.0.0-rc.0&&< 5.0.2 | 5.0.2 |
| 📦npm | @openzeppelin/contracts | ≥ 5.0.0-rc.0&&< 5.0.2 | 5.0.2 |
| 📦npm | @openzeppelin/contracts-upgradeable | ≥ 4.5.0&&< 4.9.6 | 4.9.6 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for @openzeppelin/contracts. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.
Fix
Update @openzeppelin/contracts to 4.9.6 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-9vx6-7xxf-x967 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 pinpoints whether GHSA-9vx6-7xxf-x967 is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.
Tailored to GHSA-9vx6-7xxf-x967. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is GHSA-9vx6-7xxf-x967 in your dependencies?
O3 detects GHSA-9vx6-7xxf-x967 across npm dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.