CVE-2022-31170
HIGH 7.5CVSS 3.1OpenZeppelin Contracts's ERC165Checker may revert instead of returning false
OpenZeppelin Contracts is a library for smart contract development. Versions 4.0.0 until 4.7.1 are vulnerable to ERC165Checker reverting instead of returning false. ERC165Checker.supportsInterface is designed to always successfully return a boolean, and under no circumstance revert. However, an incorrect assumption about Solidity 0.8's abi.decode allows some cases to revert, given a target contract that doesn't implement EIP-165 as expected, specifically if it returns a value other than 0 or 1. The contracts that may be affected are those that use ERC165Checker to check for support for an interface and then handle the lack of support in a way other than reverting. The issue was patched in version 4.7.1.
- Published
- 22 Jul 2022
- Last modified
- 17 Jun 2026
- Assigned by
- security-advisories@github.com
- NVD status
- Modified
- Weakness
- CWE-20CWE-252
- Also known as
- GHSA-qh9x-gcfh-pcrw
- Sources
- NVDJSONOSV GHSA-qh9x-gcfh-pcrwJSON
Scores
| Source | Scored by | Version | Score | Vector / decision |
|---|---|---|---|---|
| NVD | security-advisories@github.com (Secondary) | CVSS 3.1 | HIGH 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N |
| NVD | nvd@nist.gov (Primary) | CVSS 3.1 | HIGH 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N |
| OSV | GitHub | CVSS 3.1 | HIGH 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N |
Affected
| Source | Vendor / ecosystem | Product / package | Affected versions | Fixed in |
|---|---|---|---|---|
| NVD | openzeppelin | contractscpe:2.3:a:openzeppelin:contracts:*:*:*:*:*:node.js:*:* |
>= 4.0.0, < 4.7.1 | 4.7.1 |
| OSV | npm | @openzeppelin/contracts | >= 4.0.0, < 4.7.1 | 4.7.1 |
| OSV | npm | @openzeppelin/contracts-upgradeable | >= 4.0.0, < 4.7.1 | 4.7.1 |
References
- https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3552 · Patch, Third Party Advisory, WEB
- https://github.com/OpenZeppelin/openzeppelin-contracts/security/advisories/GHSA-qh9x-gcfh-pcrw · Third Party Advisory, WEB
- https://nvd.nist.gov/vuln/detail/CVE-2022-31170 · ADVISORY
- https://github.com/OpenZeppelin/openzeppelin-contracts · PACKAGE
History
- 25 Nov 2026 20:34 UTC · NVD: first stored (published 22 Jul 2022)
- 25 Nov 2026 20:11 UTC · OSV: first stored (published 21 Jul 2022)