Understanding ECDSA Point Validity and Malleability

5 replies 265 views
0xLaserFull Member
Posts: 252 · Reputation: 641
#1Sep 11, 2020, 12:55 PM
Seems like this point checks out on secp256k1. What’s interesting is that for those two different points, they produce the same r-value because point coordinates are modulo p, while signatures are modulo n. Does this mean there are more malleability cases than just (r,s) and (r,-s)? Or could it lead to multiple public keys for the same signature?
3 Reply Quote Share
wagmiNewbie
Posts: 301 · Reputation: 14
#2Sep 11, 2020, 03:29 PM
I think any r-value above FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 isn’t valid in Bitcoin. But I get it now, it's more about theory than real life... technically could be considered malleable, but without knowing private keys, it’s not really an issue.
2 Reply Quote Share
mr_apeNewbie
Posts: 401 · Reputation: 35
#3Sep 11, 2020, 05:29 PM
Yeah, you can get more than one public key from a valid ECDSA signature and a message. But that’s not about malleability since public keys are locked in the script. For instance, in a P2PKH script, the public key's hash is fixed in the scriptpub, and if you try a different key, the transaction gets rejected before signature verification.
2 Reply Quote Share
0xHashMember
Posts: 431 · Reputation: 210
#4Sep 11, 2020, 06:58 PM
Right, and according to BIP62, if s is over half of n, we just set s = n s. So, if s is too high, the signature is invalid. Theoretically, you could have 4 public keys for the same message and private key if r is less than n-p. This gives you two x-coordinates and two y-coordinates.
1 Reply Quote Share
0xNodeMember
Posts: 671 · Reputation: 80
#5Sep 12, 2020, 12:56 AM
This is pretty much an academic chat. The chances of hitting any x mod n are so slim that splitting that probability in half doesn’t change the security much.
2 Reply Quote Share
alex.byteLegendary
Posts: 170 · Reputation: 5910
#6Sep 12, 2020, 05:38 AM
Not just academic! Check this out: 02FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 and 03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 are like "zero" for r-value. So, if r=n, it simplifies the signature to s=z/k. This makes it valid, no matter what public key is used, depending on how it's implemented. Could lead to forks, too.
5 Reply Quote Share

Related topics