CVE-2022-35915 is a medium-severity (CVSS 5.3) Uncontrolled Resource Consumption vulnerability in @openzeppelin/contracts. A fix is available for @openzeppelin/contracts — see the affected versions and patch details below.
Unbounded gas consumption in @openzeppelin/contracts
Exploitation Status
No confirmed exploitation observed yet
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for CVE-2022-35915.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
Where this sits among everything scored
Real-World Exposure
How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.
@openzeppelin/contractsnpmopenzeppelin-soliditynpm@openzeppelin/contracts-upgradeablenpmDescription
Impact
The target contract of an EIP-165 supportsInterface query can cause unbounded gas consumption by returning a lot of data, while it is generally assumed that this operation has a bounded cost.
Patches
The issue has been fixed in v4.7.2.
References
https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3587
For more information
If you have any questions or comments about this advisory, or need assistance deploying a fix, email us at [email protected].
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | @openzeppelin/contracts | ≥ 2.0.0&&< 4.7.2 | 4.7.2npm install @openzeppelin/contracts@4.7.2 |
| 📦npm | openzeppelin-solidity | ≥ 2.0.0 | No fix |
| 📦npm | @openzeppelin/contracts-upgradeable | ≥ 3.2.0&&< 4.7.2 | 4.7.2npm install @openzeppelin/contracts-upgradeable@4.7.2 |
| 📦npm | openzeppelin-eth | ≥ 2.0.0 | No fix |
Affected Products
contractsopenzeppelincontracts upgradeableopenzeppelinopenzeppelin-ethopenzeppelinopenzeppelin-solidityopenzeppelinDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for @openzeppelin/contracts, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update @openzeppelin/contracts to 4.7.2 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2022-35915 is resolved across your whole dependency graph.
Workarounds
Cap what an attacker can consume: apply request size, rate and timeout limits in front of the affected component, and run it with memory and CPU limits so exhaustion degrades one worker rather than the whole service.
Frequently Asked Questions
Is CVE-2022-35915 in your dependencies?
Find it across npm, including transitive dependencies.