flow-go icon indicating copy to clipboard operation
flow-go copied to clipboard

[Crypto] handling of ecdsa signature malleability

Open LanfordCai opened this issue 3 years ago • 2 comments

Flow is using ecdsa as signing algorithms(nistp256 and secp256k1). In ecdsa, the signature is in the form of (r, s), but there is a second valid signature (r, -s), which can be generated by using (r, s). One of the signatures' s-value is less than half of the curve order(aka, low-s signature), and the other one is not. For other blockchains like Bitcoin/Ethereum, they choose the low-s signature as the canonical one to prevent the problems caused by transaction malleability. But on Flow, both low-s form signature and high-s form signature are regarded as valid(check it here). The malleability of signature might cause transaction malleability problem on Flow(check it here).

I wrote a demo to show these problems here.

In my opinion:

  • The inconsistency in the judgement criteria over the validity of signatures would cause inconvenience for the possible interoperation between Flow and other chains. This means certain signatures generated by Flow(i.e, high-s form) might be regarded as invalid on other mainstream blockchains(Bitcoin/Ethereum/Cosmos, etc), and high-s signatures that are invalid on other blockchains might be deemed as valid on Flow.
  • There do exist transaction malleability problem on Flow.

Should we change this behavior?

LanfordCai avatar Apr 05 '22 09:04 LanfordCai

Hi @LanfordCai, thank you for submitting the issue and providing the demos 👌🏼 We have been looking at this flag since we received your question on Discord. We'll get back to you about transaction malleability soon with more details.

tarakby avatar Apr 07 '22 16:04 tarakby

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Oct 06 '24 02:10 github-actions[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jan 05 '25 02:01 github-actions[bot]