malleable-signatures icon indicating copy to clipboard operation
malleable-signatures copied to clipboard

This repository implements a simplified PoC that demonstrates how signature malleability attacks using compact signatures can be executed.

Signature Malleability

Test smart contracts License: WTFPL

This repository implements a simplified PoC that demonstrates how signature malleability attacks using compact signatures can be executed. The PoC showcases two interconnected issues:

  1. A vulnerability with the OpenZeppelin 4.6 ECDSA library which is vulnerable to the signature malleability exploit. The vulnerability was patched in version 4.7.3. Also, see here for the published security advisory.

  2. Signatures MUST NOT be used as unique identifiers, since the ecrecover precompile generally allows for malleable (non-unique) signatures (see EIP-2) or signatures can be malleablised using EIP-2098. The underlying issue in the ecrecover precompile stems from the fact that there are two y-coordinates for every x-coordinate on the elliptic curve. The OpenZeppelin ECDSA library prevents this particular malleability attack vector by reverting if the secp256k1 32-byte signature parameter s is too high.