CVE-2022-31170: OpenZeppelin Contracts's ERC165Checker may revert instead of returning false
7.5
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.27924%
CWE
Published
7/21/2022
Updated
1/30/2023
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| @openzeppelin/contracts | npm | >= 4.0.0, < 4.7.1 | 4.7.1 |
| @openzeppelin/contracts-upgradeable | npm | >= 4.0.0, < 4.7.1 | 4.7.1 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from ERC165Checker's assumption that target contracts properly implement EIP-165. The core issue was in supportsERC165InterfaceUnchecked which performed an unsafe abi.decode on potentially malformed return data. The GitHub PR #3552 specifically modifies this function to check return data length and interpret any non-zero value as 'true', avoiding strict boolean decoding. While supportsInterface is the public facing function, the actual vulnerability was in the unchecked low-level implementation it depends on.