CVE-2022-31170

7.5 HIGH

📋 TL;DR

OpenZeppelin Contracts library versions 4.0.0 through 4.7.0 have a vulnerability where ERC165Checker.supportsInterface() may revert instead of returning false when checking contracts that don't properly implement EIP-165. This affects smart contracts that use ERC165Checker to check interface support and handle non-support gracefully rather than reverting.

💻 Affected Systems

Products:
  • OpenZeppelin Contracts
Versions: 4.0.0 through 4.7.0
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects contracts using ERC165Checker.supportsInterface() and handling non-support without reverting.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Smart contracts relying on ERC165Checker for critical logic could experience unexpected reverts, potentially causing denial of service, failed transactions, or disruption of contract functionality.

🟠

Likely Case

Transactions involving affected contracts may fail when interacting with non-compliant EIP-165 contracts, causing inconvenience and potential financial loss from failed operations.

🟢

If Mitigated

If contracts handle reverts appropriately or only interact with properly implemented contracts, impact is minimal to none.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires interacting with a vulnerable contract and a target contract that doesn't properly implement EIP-165.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 4.7.1

Vendor Advisory: https://github.com/OpenZeppelin/openzeppelin-contracts/security/advisories/GHSA-qh9x-gcfh-pcrw

Restart Required: No

Instructions:

1. Update OpenZeppelin Contracts dependency to version 4.7.1 or later. 2. Recompile and redeploy affected smart contracts. 3. Test contract functionality after update.

🔧 Temporary Workarounds

Avoid ERC165Checker for critical operations

all

Modify contracts to avoid using ERC165Checker.supportsInterface() for critical logic or implement additional error handling.

🧯 If You Can't Patch

  • Implement additional error handling in contracts to catch potential reverts from ERC165Checker calls.
  • Audit and restrict interactions to contracts known to properly implement EIP-165.

🔍 How to Verify

Check if Vulnerable:

Check if your contract uses OpenZeppelin Contracts version 4.0.0-4.7.0 and calls ERC165Checker.supportsInterface().

Check Version:

Check package.json (npm) or .toml files for OpenZeppelin version.

Verify Fix Applied:

Verify OpenZeppelin Contracts version is 4.7.1 or later and test contract interactions with non-compliant EIP-165 contracts.

📡 Detection & Monitoring

Log Indicators:

  • Unexpected transaction reverts when checking interface support
  • Failed contract interactions involving ERC165Checker

Network Indicators:

  • Increased failed transactions from affected contracts

SIEM Query:

Not applicable for smart contract vulnerabilities

🔗 References

📤 Share & Export