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
- https://github.com/OpenZeppelin/openzeppelin-contracts/security/advisories/GHSA-4h98-2769-gh6h
- https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3610
- https://github.com/OpenZeppelin/openzeppelin-contracts/commit/d693d89d99325f395182e4f547dbf5ff8e5c3c87
- https://github.com/OpenZeppelin/openzeppelin-contracts
- https://github.com/OpenZeppelin/openzeppelin-contracts/releases/tag/v4.7.3