CVE-2022-31172 OpenZeppelin Contracts's SignatureChecker may revert on invalid EIP-1271 signers

High 7.5 Published Updated

Attackers can cause smart contracts using OpenZeppelin's SignatureChecker to revert unexpectedly when interacting with non-compliant EIP-1271 signers.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-31172?

CVE-2022-31172 is a high-severity denial of service vulnerability in openzeppelin-contracts, published on 21 Jul 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

OpenZeppelin Contracts is a library for smart contract development. Versions 4.1.0 until 4.7.1 are vulnerable to the SignatureChecker reverting. `SignatureChecker.isValidSignatureNow` is not expected to 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-1271 as expected. The contracts that may be affected are those that use `SignatureChecker` to check the validity of a signature and handle invalid signatures in a way other than reverting. The issue was patched in version 4.7.1.

Weakness: CWE-347, CWE-20

Which versions are affected by CVE-2022-31172?

4 open source packages ship an affected version, including @openzeppelin/contracts and @openzeppelin/contracts-upgradeable. It affects 1 product.

PackageAffectedFixed in
@openzeppelin/contracts npmFrom 4.1.04.7.1
@openzeppelin/contracts npmFrom 4.1.04.7.1
@openzeppelin/contracts-upgradeable npmFrom 4.1.04.7.1
@openzeppelin/contracts-upgradeable npmFrom 4.1.04.7.1

Products include Openzeppelin Contracts.

How do I fix CVE-2022-31172?

Upgrade @openzeppelin/contracts to 4.7.1 or later.

Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.

Is CVE-2022-31172 being exploited?

There is no known exploitation of CVE-2022-31172 in the wild and no public exploit code.

Sources

Also known as GHSA-4g63-c64m-25w9.

Is CVE-2022-31172 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free