# CVE-2022-35915: OpenZeppelin Contracts ERC165Checker unbounded gas consumption

Source: https://junglewise.ai/threats/cve-2022-35915-openzeppelin-contracts-erc165checker-unbounded-gas-consumption  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2022-08-14. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

CVE-2022-35915 · Severity: low · CVSS 3.1 · Published 2022-08-14

OpenZeppelin Contracts is a widely-used library for Ethereum smart contract development. A flaw in the ERC165Checker component allows a malicious target contract to consume excessive gas during interface compatibility checks, potentially causing transaction failures or denial of service for applications relying on these checks.

Technologies: [@openzeppelin/contracts (npm)](https://junglewise.ai/threats/technologies/openzeppelin-contracts), [@openzeppelin/contracts-upgradeable (npm)](https://junglewise.ai/threats/technologies/openzeppelin-contracts-upgradeable), [OpenZeppelin Contracts](https://junglewise.ai/threats/technologies/contracts), [OpenZeppelin Contracts Upgradeable](https://junglewise.ai/threats/technologies/contracts-upgradeable). Vendors: [npm](https://junglewise.ai/threats/vendors/npm), [OpenZeppelin](https://junglewise.ai/threats/vendors/openzeppelin).

## Quick answers

**Is CVE-2022-35915 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2022-35915 being exploited in the wild.

**How severe is CVE-2022-35915?** Low severity, with a CVSS score of 3.1, published 14 August 2022.

**Which products and versions are affected?** @openzeppelin/contracts (npm) SEMVER:introduced=2.0.0,fixed=4.7.2; @openzeppelin/contracts-upgradeable (npm) SEMVER:introduced=3.2.0,fixed=4.7.2; openzeppelin-eth (npm) SEMVER:introduced=2.0.0,last_affected=2.2.0; openzeppelin-solidity (npm) SEMVER:introduced=2.0.0,last_affected=4.6.0; and 2 more.

**Is there a fix for CVE-2022-35915?** Yes. @openzeppelin/contracts (npm): upgrade to 4.7.2 or later; @openzeppelin/contracts-upgradeable (npm): upgrade to 4.7.2 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2022-35915 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2022-35915?** Check whether you run @openzeppelin/contracts (npm), @openzeppelin/contracts-upgradeable (npm), openzeppelin-eth (npm) or one of the others listed at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- @openzeppelin/contracts (npm): upgrade to 4.7.2 or later

  ```sh
  npm install @openzeppelin/contracts@4.7.2
  ```

- @openzeppelin/contracts-upgradeable (npm): upgrade to 4.7.2 or later

  ```sh
  npm install @openzeppelin/contracts-upgradeable@4.7.2
  ```


## Technical details

The vulnerability exists in the ERC165Checker utility, which is used to query whether a target contract supports a specific EIP-165 interface via the supportsInterface function. An attacker controlling the target contract can craft a malicious implementation that returns large amounts of data, causing unbounded gas consumption during the query, violating the assumption that such checks have bounded cost. The attack is network-accessible and requires no authentication or user interaction; the attacker must control or manipulate the target contract being queried. This can lead to out-of-gas exceptions and denial of service. The issue has been patched in Contracts v4.7.2 and Contracts Upgradeable v4.7.2.

## Affected products

- OpenZeppelin Contracts 2.0.0 to 4.7.1
- OpenZeppelin Contracts Upgradeable 3.2.0 to 4.7.1
- OpenZeppelin openzeppelin-eth 2.0.0 to 2.2.0
- OpenZeppelin openzeppelin-solidity 2.0.0 to 4.6.0

## Identifiers

- CVE-2022-35915
- GHSA-7grf-83vw-6f5x

## Timeline

- 2022-07-28: disclosed: Advisory published by OpenZeppelin
- 2022-08-14: patched: Fix released in v4.7.2 and Contracts Upgradeable v4.7.2

## References

- [https://github.com/OpenZeppelin/openzeppelin-contracts/security/advisories/GHSA-7grf-83vw-6f5x](https://github.com/OpenZeppelin/openzeppelin-contracts/security/advisories/GHSA-7grf-83vw-6f5x)

## Related threats

- [OpenZeppelin Contracts information disclosure in VestingWalletConfidential](https://junglewise.ai/threats/openzeppelin-confidential-contracts-vestingwalletconfidential-a-14aa72cf)
- [OpenZeppelin Contracts out-of-bounds memory access in Bytes.lastIndexOf](https://junglewise.ai/threats/cve-2025-54070-openzeppelin-contracts-out-of-bounds-memory-access-in-bytes)
- [OpenZeppelin Contracts base64 encoding reads from dirty memory](https://junglewise.ai/threats/cve-2024-27094-openzeppelin-contracts-base64-encoding-reads-from-dirty-memory)
- [OpenZeppelin Contracts duplicated execution in Multicall](https://junglewise.ai/threats/cve-2023-49798-openzeppelin-contracts-duplicated-execution-in-multicall)
- [OpenZeppelin Contracts improper escaping in ERC2771Context](https://junglewise.ai/threats/cve-2023-40014-openzeppelin-contracts-improper-escaping-in-erc2771context)
