Skip to content

Improve security of signature generation #4885

Open
@paulmillr

Description

@paulmillr

Recent Elliptic.js CVE highlightened a danger of fault attacks.

Check out blog post: Deterministic signatures are not your friends and ethresear.ch post. Deterministic RFC6979 signatures are good, however, if an error happens during sig generation, then the error is propagated to the very end. In worst cases it will mean k reuse and private key leak.

Solution

Use hedged signatures. RFC6979 3.6: already specifies additional k' extraEntropy to mix-in 32 byte of random data on every signature. It is standard way of doing this.

Switch is from k = hash_6979(private_key, message) to k = hash_6979(private_key, message, extraEntropy)

Pros

Increased security against private key leakage. Even when passed-through randomness is bad, the security would be just like today, not worse.

Cons

  • Signatures (r, s) would become non-deterministic and "new" after every signature.
    • Some protocols use deterministic sigs as keys.
    • These protocols can ask for deterministic sigs, for example, by specifying static extraEntropy
  • Slightly increased chance of fingerprinting
    • Injecting caf3 as first 2 bytes will take 65K+ generations on average - totally infeasible for hardware wallets (ledger uses 48MHz STM32F042)
    • To be reliable, fingerprinting needs to inject 10+ bytes, which means billions of signatures

Metadata

Metadata

Assignees

Labels

discussionQuestions, feedback and general information.on-deckThis Enhancement or Bug is currently being worked on.v6Issues regarding v6

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions