Nonce Reuse Vulnerability

Reusing the random value in a signature, which leaks the private key outright.

Basically

Reusing the same random number to sign two messages can expose your private key. Anyone with the two signatures can work it out.

Key Takeaways

  • Reusing a nonce, or random number, for two different digital signatures lets anyone extract your private key with simple algebra. They need only public information from the two signatures.
  • Sony's PlayStation 3 key was extracted in 2010 after it used a constant nonce. A broken random number generator caused the 2013 Android Bitcoin wallet vulnerability. Both incidents led to complete cryptographic compromise.
  • Deterministic nonce generation under RFC 6979 derives the nonce from the private key and message hash. It removes all dependence on random number generators during signing.

What Is a Nonce Reuse Vulnerability?

A nonce reuse vulnerability occurs when a cryptographic signing algorithm uses the same random number, called a nonce or k-value, for two different signatures. In elliptic curve signature schemes such as ECDSA and Schnorr signatures, the nonce is a critical one-time secret that must be unique for every signature operation. Breaking this rule lets an attacker recover the private key through straightforward algebra.

Nonce reuse is not a theoretical weakness that requires enormous computational power. One reused nonce gives anyone observing the two signatures enough information to compute the signer's private key in milliseconds on ordinary hardware. The vulnerability affects any system using ECDSA or Schnorr signatures, including Bitcoin, Ethereum, TLS certificates, and code-signing infrastructure.

How It Works

ECDSA signature construction shows why nonce reuse is catastrophic. An ECDSA signature over a message hash z uses private key x and nonce k on the secp256k1 curve to produce two values, (r, s).

The value r depends only on the nonce k and the curve generator point G. Two signatures created with the same nonce share the same r value, which reveals nonce reuse on any public blockchain.

The Key Extraction

Two signatures (r, s₁) and (r, s₂) over different message hashes z₁ and z₂ can reveal the private key when they use the same nonce k. An attacker recovers the key in two steps.

Both operations use simple modular arithmetic. They require no brute force, lattice reduction, or special hardware, and the security of the entire private key collapses into a single division.

The same principle applies to Schnorr signatures. A Schnorr signature is a pair (R, s), where s = k + e · x and e is the challenge hash. Two Schnorr signatures sharing the same nonce k, and therefore the same R, reveal the private key through x = (s₁ - s₂) · (e₁ - e₂)⁻¹ mod n.

Detection on the Blockchain

Bitcoin's blockchain reveals nonce reuse when transactions from the same public key have identical r values in their ECDSA signatures. Researchers have systematically scanned the blockchain and found hundreds of vulnerable transactions. One study identified 123 vulnerable transactions and recovered 416 private keys controlling a combined 26.85 BTC.

PlayStation 3 ECDSA Key Extraction (2010)

Sony's PlayStation 3 code-signing implementation is the most infamous nonce reuse incident. Sony used ECDSA to sign all PS3 software, ensuring only authorised code could run on the console. However, Sony's implementation used a constant value for the nonce k instead of generating a fresh random value for each signature.

In December 2010, the hacker group fail0verflow presented its findings at the 27th Chaos Communication Congress (27C3) in Berlin. Every Sony signature used the same k, so any two signed firmware updates provided enough information to extract the private signing key. Days later, George Hotz (geohot) published the recovered private key, permanently compromising the PS3's security model; anyone could now sign code that the PS3 would accept as legitimate Sony software.

Android Bitcoin Wallet Vulnerability (2013)

In August 2013, the Bitcoin community discovered that Android's implementation of Java's SecureRandom class was not properly initialising its pseudorandom number generator (PRNG). Bitcoin wallet applications consequently produced duplicate or predictable nonce values when signing transactions, particularly transactions with multiple inputs.

The vulnerability affected several popular wallets, including Bitcoin Wallet, BitcoinSpinner, Mycelium, and blockchain.info. Attackers exploited the flaw to extract private keys and steal approximately 55.82 BTC. The Bitcoin.org security advisory urged all Android wallet users to generate new addresses with a properly patched application and transfer funds immediately.

Blockchain-Wide Nonce Reuse

Nonce reuse has also appeared throughout Bitcoin's history beyond high-profile incidents. Researchers scanning the blockchain have repeatedly identified addresses with reused r values in their transaction signatures, typically caused by faulty wallet implementations or broken random number generators. These findings show that the vulnerability is not limited to single events but remains a persistent risk wherever signing software handles nonce generation incorrectly.

The Solution: Deterministic Nonce Generation

Reliance on random number generators during signing is the root cause of nonce reuse. A broken, poorly seeded, or compromised RNG can produce duplicate nonces without the signer ever realising it. RFC 6979, published in August 2013 by Thomas Pornin, eliminates this dependency entirely.

RFC 6979: How It Works

RFC 6979 derives the nonce deterministically instead of calling a random number generator. It uses two inputs the signer already possesses, the private key and the message hash, and produces the nonce with HMAC-DRBG, a deterministic random bit generator based on HMAC.

The same private key signing the same message always produces the same signature, making signatures reproducible and testable. Different messages always produce different nonces, preventing reuse, while the nonce remains unpredictable to anyone who does not know the private key. This preserves all the security properties of random nonces without the risks of RNG failure.

Most modern Bitcoin wallet implementations, including Bitcoin Core, use RFC 6979 for ECDSA signing. The BIP-340 Schnorr signature specification also mandates a deterministic nonce derivation scheme, though it uses a slightly different construction from RFC 6979.

Implications for Multisig and Threshold Signing

RFC 6979 effectively solves nonce reuse for single-signer scenarios, but multi-party signing protocols such as MuSig2 and FROST introduce additional complexity. Multiple signers must coordinate nonces to produce a single aggregate signature. The interactive nature of this process creates new attack surfaces.

The MuSig2 Nonce Challenge

In MuSig2 multisignature signing, each participant contributes a partial nonce that is combined into the final aggregate nonce. Unlike single-signer ECDSA, MuSig2 signers cannot safely use purely deterministic nonces. A malicious co-signer could open two concurrent signing sessions and provide different contributions in each, while an honest signer using deterministic nonces would unknowingly reuse the same nonce value across both sessions and expose their key share.

MuSig2 requires signers to pre-commit to their nonces before seeing other participants' contributions. Its two-round protocol structure also binds nonces to the session context.

FROST Threshold Signatures

FROST threshold signatures face similar challenges but include formal security proofs against concurrent session attacks. FROST incorporates each participant's identifier into the binding factor hash, ensuring that different participants derive different binding factors even in concurrent sessions. This design prevents the Wagner generalized birthday attack that could otherwise allow a malicious coordinator to manipulate nonce combinations.

Protocols such as Spark that rely on threshold signatures for their security model must implement rigorous nonce management. Proper nonce handling is essential for any system where multiple parties collaborate to produce signatures over shared keys.

Prevention and Best Practices

Defending against nonce reuse requires attention at multiple levels. These levels span the signing stack.

Why It Matters

Nonce reuse is one of the few cryptographic vulnerabilities that leads to total, irreversible key compromise from publicly visible data. Unlike attacks that require computational power or physical access, nonce reuse exploitation requires nothing more than observing two signatures on a public blockchain. Private key recovery is instant and deterministic.

Nonce reuse matters to Bitcoin users and builders because every transaction broadcast to the network permanently publishes signature data. A wallet that generates even a single pair of signatures with a reused nonce has irrecoverably exposed its private key to anyone who checks. Cold storage wallets and hot wallets alike must therefore use well-audited signing implementations, and the shift towards deterministic nonce generation, RFC 6979 for ECDSA and BIP-340 for Taproot Schnorr signatures, represents one of the most important practical security improvements in Bitcoin's history.

This glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.

0

← All 1876 glossary terms