CVE-2022-35961: OpenZeppelin Contracts ECDSA signature malleability

CVE-2022-35961 · Severity: low · CVSS 3.1 · Published 2022-08-18

OpenZeppelin Contracts is a widely-used library for building secure blockchain applications. The library's ECDSA signature verification functions contain a flaw that allows an attacker to reuse signatures in different formats, potentially bypassing security controls that prevent replayed transactions. Applications relying on signature-based replay protection are at risk of unauthorized transaction replay attacks.

Technologies: @openzeppelin/contracts (npm), @openzeppelin/contracts-upgradeable (npm), OpenZeppelin Contracts, OpenZeppelin Contracts Upgradeable. Vendors: npm, OpenZeppelin.

Quick answers

Is CVE-2022-35961 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2022-35961 being exploited in the wild.
How severe is CVE-2022-35961?
Low severity, with a CVSS score of 3.1, published 18 August 2022.
Which products and versions are affected?
@openzeppelin/contracts (npm) SEMVER:introduced=4.1.0,fixed=4.7.3; @openzeppelin/contracts-upgradeable (npm) SEMVER:introduced=4.1.0,fixed=4.7.3; OpenZeppelin Contracts 4.1.0 to 4.7.2; OpenZeppelin Contracts Upgradeable 4.1.0 to 4.7.2.
Is there a fix for CVE-2022-35961?
Yes. @openzeppelin/contracts (npm): upgrade to 4.7.3 or later; @openzeppelin/contracts-upgradeable (npm): upgrade to 4.7.3 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2022-35961 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2022-35961?
Check whether you run @openzeppelin/contracts (npm), @openzeppelin/contracts-upgradeable (npm), OpenZeppelin Contracts or one of the others listed at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • @openzeppelin/contracts (npm): upgrade to 4.7.3 or later
    npm install @openzeppelin/contracts@4.7.3
  • @openzeppelin/contracts-upgradeable (npm): upgrade to 4.7.3 or later
    npm install @openzeppelin/contracts-upgradeable@4.7.3

Technical details

The ECDSA.recover and ECDSA.tryRecover functions (when taking a single bytes argument) accept both traditional 65-byte signatures and compact EIP-2098 64-byte encoded signatures, leading to signature malleability. Applications that implement replay or signature-reuse protection by marking the signature bytes as consumed—rather than the signed message or a nonce—are vulnerable to an attacker converting a previously-submitted signature to its compact form and resubmitting it to bypass this protection. The vulnerability only affects single-bytes variants; functions accepting r, v, s or r, vs as separate arguments are not affected. The patch in version 4.7.3 disables compact signature support in the single-bytes variant; compact signature support remains available via separate argument functions.

Affected products

  • OpenZeppelin @openzeppelin/contracts 4.1.0 to 4.7.2
  • OpenZeppelin @openzeppelin/contracts-upgradeable 4.1.0 to 4.7.2

Identifiers

  • CVE-2022-35961
  • GHSA-4h98-2769-gh6h

Timeline

  • 2022-08-18: disclosed: Security advisory published
  • 2022-08-10: patched: Patch released in version 4.7.3

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.