{"id":"CVE-2022-31170","aliases":["CVE-2022-31170","GHSA-qh9x-gcfh-pcrw"],"related":[],"kind":"vulnerability","state":"published","title":"OpenZeppelin Contracts's ERC165Checker may revert instead of returning false","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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### Impact\n\n`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.\n\nThe 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.\n\n### Patches\n\nThe issue was patched in 4.7.1.\n\n### References\n\nhttps://github.com/OpenZeppelin/openzeppelin-contracts/pull/3552\n\n### For more information\n\nIf you have any questions or comments about this advisory, or need assistance deploying the fix, email us at [security@openzeppelin.com](mailto:security@openzeppelin.com).","format":"markdown","source":"ghsa"},{"lang":"es","text":"OpenZeppelin Contracts es una biblioteca para el desarrollo de contratos inteligentes. Las versiones 4.0.0 hasta 4.7.1, son vulnerables a una reversión de ERC165Checker en lugar de devolver \"false\". ERC165Checker.supportsInterface está diseñado para devolver siempre un booleano con éxito, y bajo ninguna circunstancia revertir. Sin embargo, una suposición incorrecta sobre \"abi.decode\" de Solidity versión 0.8 permite que algunos casos sean revertidos, dado un contrato de destino que no implementa EIP-165 como es esperado, específicamente si devuelve un valor distinto de 0 o 1. Los contratos que pueden verse afectados son los que usan \"ERC165Checker\" para comprobar el soporte de una interfaz y luego manejar la falta de soporte de una manera distinta a la reversión. El problema fue parcheado en versión 4.7.1","source":"nvd"}],"published":"2022-07-21T14:00:18.000Z","modified":"2026-06-17T04:44:57.307Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"}],"cwes":["CWE-20","CWE-252"],"affected":[{"ranges":[{"version":">= 4.0.0, < 4.7.1","status":"affected"}],"vendor":"OpenZeppelin","product":"openzeppelin-contracts","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"4.0.0","status":"affected","fixed":"4.7.1"}],"ecosystem":"npm","package":"@openzeppelin/contracts","purl":"pkg:npm/%40openzeppelin/contracts","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"4.0.0","status":"affected","fixed":"4.7.1"}],"ecosystem":"npm","package":"@openzeppelin/contracts-upgradeable","purl":"pkg:npm/%40openzeppelin/contracts-upgradeable","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"4.0.0","fixed":"4.7.1"}],"vendor":"openzeppelin","product":"contracts","cpe":"cpe:2.3:a:openzeppelin:contracts:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3552","tags":["patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/OpenZeppelin/openzeppelin-contracts/security/advisories/GHSA-qh9x-gcfh-pcrw","tags":["third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-31170","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/OpenZeppelin/openzeppelin-contracts","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2025-04-23T15:53:10.305Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-31170","url":"https://www.cve.org/CVERecord?id=CVE-2022-31170","licence":"CVE Terms of Use","modified":"2025-04-23T17:57:25.929Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-qh9x-gcfh-pcrw","url":"https://github.com/advisories/GHSA-qh9x-gcfh-pcrw","licence":"CC-BY-4.0","modified":"2023-11-08T04:09:28.586Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-31170","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-31170","licence":"Public domain","modified":"2026-06-17T04:44:57.307Z"}],"updatedAt":"2026-11-25T22:58:13.159Z","epss":{"score":0.00807,"percentile":0.57974,"date":"2026-12-01T12:00:22.000Z"}}