Path: blob/main/frontier/09-commitments-sigma-protocols/break/schnorr-nonce-reuse.ipynb
483 views
Break: Schnorr Protocol Nonce Reuse
Module 09 | Breaking Weak Parameters
When the prover reuses a nonce across two Schnorr protocol runs, the secret key falls out with simple algebra.
Why This Matters
The Schnorr protocol (from 09d) requires the prover to choose a fresh random nonce for every protocol execution. The commitment is sent to the verifier, and the response encodes both and the secret .
The nonce acts as a one-time pad for : without knowing , nobody can extract from . But if the same is used twice with different challenges, we get two equations in two unknowns ( and ), and the system solves trivially.
This is not a theoretical concern:
Sony PS3 (2010): Sony used a fixed nonce for ECDSA signatures on firmware updates. The hacker group fail0verflow extracted the master signing key.
Android Bitcoin wallets (2013): A faulty RNG produced repeated nonces, leaking users' private keys.
ROCA (2017): Weak nonce generation in Infineon smartcards allowed key recovery.
The same algebra applies to Schnorr identification, Schnorr signatures, and ECDSA.
The Scenario
Alice proves knowledge of (where ) using the Schnorr protocol. She runs the protocol twice, using the same nonce both times but receiving different challenges and .
Recall the Schnorr protocol:
| Step | Action | Computation |
|---|---|---|
| Commit | Prover sends | |
| Challenge | Verifier sends | Random |
| Response | Prover sends |
If is reused, an eavesdropper who sees both transcripts and can recover .
Let's set up concrete parameters and demonstrate the full attack.
Step 1: Alice Runs the Protocol Twice with the Same Nonce
Alice uses the same nonce in two protocol executions. The verifier (or two different verifiers) sends different challenges and .
Run 1: , challenge , response
Run 2: (same!), challenge , response
The telltale sign: both transcripts have the same commitment .
Step 2: The Algebra of the Attack
An eavesdropper (Eve) observes both transcripts. She writes down the two response equations:
Subtract the second from the first:
The nonce cancels out! Since is prime and , the value is invertible mod . Solve for :
Two equations, two unknowns, high school algebra. The secret key is gone.
The Fix: Deterministic Nonce Derivation
The root cause is that the Schnorr protocol demands a fresh, unpredictable, never-repeated nonce for every execution. This is a dangerous requirement: one failure is catastrophic.
RFC 6979 (2013) eliminates nonce reuse by deriving deterministically:
Properties:
Same pair always produces the same (and the same proof/signature), deterministic.
Different messages produce different values, no collisions.
No randomness needed at proving time, no RNG to fail.
EdDSA (Ed25519) takes this further: the nonce is where the prefix is derived from the private key. Deterministic nonces are baked into the design, not bolted on as an afterthought.
Exercises
Exercise 1: Known Nonce Offset
Suppose Alice does not reuse exactly, but the attacker knows that for a known constant . The two transcripts are:
Subtract: , so .
Verify this with the concrete parameters below.
Summary
| Aspect | Detail |
|---|---|
| Vulnerability | Reusing nonce in two Schnorr protocol runs |
| Telltale sign | Two transcripts with the same commitment |
| Attack | |
| Consequence | Full secret key recovery; attacker impersonates prover |
| Real-world victims | PS3 (2010), Android Bitcoin wallets (2013) |
| Fix | RFC 6979 deterministic nonces, or use EdDSA |
| Generalization | Any known relationship between nonces (e.g., ) is equally fatal |
The nonce reuse attack is a direct application of special soundness from 09d: the extraction formula that proves the protocol is sound is exactly the formula an attacker uses when nonces collide. Special soundness is a security feature (it proves the protocol cannot be cheated), but it becomes a weapon when the prover violates the protocol's requirements.