CVE-2022-31170 json
OpenZeppelin Contracts's ERC165Checker may revert instead of returning false
published 2022-07-21 4 y ago modified 2026-06-17 4 mo ago also GHSA-qh9x-gcfh-pcrw , EUVD-2022-6398
- cvss
- 7.5
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 0.8%
- EPSS 0.8% chance of exploitation in 30 days, percentile 56%
- public exploits
- 0
- none known
Summary
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.
Patch / fix
- npm @openzeppelin/contracts 4.7.1
- npm @openzeppelin/contracts-upgradeable 4.7.1
- openzeppelin contracts 4.7.1
- github.com/OpenZeppelin/openzeppelin-contracts#3552 pull request
CISA SSVC
- Exploitation
- none
- Automatable
- yes
- Technical impact
- partial
- Assessed
- 18 mo ago
Exploit prediction
0.79% chance of exploitation in the next 30 days, higher than 56% of all scored CVEs (FIRST EPSS, 2026-11-08).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N |
| NVD | 3.1 | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N |
| GitHub | 3.1 | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| npm | @openzeppelin/contracts | >=4.0.0, <4.7.1 |
4.7.1 |
| npm | @openzeppelin/contracts-upgradeable | >=4.0.0, <4.7.1 |
4.7.1 |
Affected products
- OpenZeppelin openzeppelin-contracts
Classification
References
-
github.com
/OpenZeppelin/openzeppelin-contracts/pull/3552
web, patch, third-party-advisory
-
github.com
/OpenZeppelin/openzeppelin-contracts/security/advisories/GHSA-qh9x-gcfh-pcrw
web, third-party-advisory
-
nvd.nist.gov
/vuln/detail/CVE-2022-31170
advisory
-
github.com
/OpenZeppelin/openzeppelin-contracts
package
Sources
- CVE List CVE-2022-31170
- GitHub Advisory GHSA-qh9x-gcfh-pcrw
- NVD CVE-2022-31170
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.