OpenZeppelin Contracts's ERC165Checker may revert instead of returning false
openzeppelin-contracts
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| @openzeppelin/contracts npm |
|
|
| @openzeppelin/contracts-upgradeable npm |
|
|
openzeppelin-contracts
| Product | Affected | Fixed in |
|---|---|---|
| @openzeppelin/contracts npm |
|
|
| @openzeppelin/contracts-upgradeable npm |
|
|
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.
From the CVE record · GitHub_M
ERC165Checker.supportsInterface can revert instead of returning false when a target contract returns a value other than 0 or 1 for an EIP-165 check. An attacker could trigger this behavior where a contract checks such a target and expects to handle unsupported interfaces without reverting. The input does not specify authentication or user-interaction requirements.
Check applications using npm @openzeppelin/contracts or @openzeppelin/contracts-upgradeable versions >=4.0.0 and <4.7.1, particularly those using ERC165Checker.