ECDSA signature malleability in OpenZeppelin Contracts
openzeppelin-contracts
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| @openzeppelin/contracts npm |
|
|
| @openzeppelin/contracts-upgradeable npm |
|
|
openzeppelin-contracts
| Product | Affected | Fixed in |
|---|---|---|
| @openzeppelin/contracts npm |
|
|
| @openzeppelin/contracts-upgradeable npm |
|
|
OpenZeppelin Contracts is a library for secure smart contract development. The functions `ECDSA.recover` and `ECDSA.tryRecover` are vulnerable to a kind of signature malleability due to accepting EIP-2098 compact signatures in addition to the traditional 65 byte signature format. This is only an issue for the functions that take a single `bytes` argument, and not the functions that take `r, v, s` or `r, vs` as separate arguments. The potentially affected contracts are those that implement signature reuse or replay protection by marking the signature itself as used rather than the signed message or a nonce included in it. A user may take a signature that has already been submitted, submit it again in a different form, and bypass this protection. The issue has been patched in 4.7.3.
From the CVE record · GitHub_M
The bytes-argument forms of ECDSA.recover and ECDSA.tryRecover accept both compact and traditional signatures for the same signed content. In contracts that prevent replay by marking the signature itself as used, a user can resubmit a previously submitted signature in a different form and bypass that protection. The forms that take signature components as separate arguments are not affected.
Check projects using @openzeppelin/contracts or @openzeppelin/contracts-upgradeable versions >=4.1.0 and <4.7.3, especially contracts that track used signatures rather than signed messages or nonces.