Junglewise Threat Intelligence

CVE-2022-35961: OpenZeppelin Contracts ECDSA signature malleability

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

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

Executive brief

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.

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

Timeline

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

References

Related threats