Home / Knowledge hub / Nonce reuse
Knowledge hub
Nonce reuse
Using a single-use value twice, which can break the encryption or the check built on it.
What it means
Nonce reuse is when a value that was meant to be used once appears a second time. A nonce is only safe because it does not repeat. In many cryptographic schemes it must not repeat under the same key, and the standard says so plainly.
The rule is stricter than it sounds. The value need not be secret and need not be random. It just must be new each time. The failure does not announce itself: the program runs and the data looks encrypted. Only the underlying guarantee has quietly gone.
Why it matters
In some encryption modes, reusing a nonce with the same key reveals relationships between messages and can let an attacker forge new ones. NIST SP 800-38D, which covers AES-GCM, warns that repeating the IV under one key destroys the security assurances. In signature schemes, a repeated per-signature value can expose the private key.
The damage is often permanent. Once data is encrypted badly and copied to backups, you cannot make it safe again by fixing the code. You re-encrypt or rotate the key, and tell customers why. That is a costly week for a one-line mistake.
How it shows up
It shows up where code builds its own encryption calls: a nonce hardcoded as zeros, a counter that restarts after a deployment, two servers each counting from one, or a random nonce too short to avoid collisions across billions of messages. See initialisation vectors and AES-GCM.
At application level, the same idea covers one-time links, payment tokens and single-use coupons that can be used again. Check where the nonce is created, whether it is stored or derived, and what happens after a restart or a failover. Prefer library functions that manage nonces for you, and rotate keys on schedule.
Questions people ask
Nonce reuse, answered
Why is nonce reuse so dangerous in AES-GCM?
GCM turns the block cipher into a stream and adds an authentication tag. If the same nonce is used twice with one key, the streams match, so combining the two ciphertexts exposes the plaintexts, and the tag key can be recovered.
Then an attacker can forge messages that pass the check.
Does a random nonce avoid reuse?
Mostly, if it is long enough. With a 96-bit random nonce, the chance of collision grows as you encrypt more messages under one key, so NIST sets a limit on how many.
For high volume, use a counter design or rotate keys, or choose a mode built to tolerate misuse.
Is nonce reuse the same as a replay attack?
They are related but different. Reuse is a fault on the sender or issuer side: the same value is produced twice. Replay is an attacker sending an old message again.
A system that never reuses nonces and remembers the ones it has seen resists both.
How could reuse happen after a restart?
If the nonce is a counter held in memory, a restart or a second server can start again at the same number. If it is derived from a clock, two messages in the same tick collide.
Persist the counter, partition it per node, or use a library that handles it.
How do we find nonce reuse?
Review how each encryption or signing call gets its nonce. In testing, trigger the same operation repeatedly and across instances, then compare the values produced.
Any repeat under one key is a defect, however small the volume.
Related
Terms that sit next to this one
Nonce
A value issued for a single use, so it cannot be replayed later.
AES-GCM
A widely used encryption mode that also detects tampering with the data.
Initialisation vector (IV)
A starting value that makes the same data encrypt differently each time.
Replay attack
Capturing a valid request and sending it again to get the same result twice.
Key rotation
Replacing a credential on a schedule so a leaked one has a short life.
Does a one-time value stay one-time?
Single-use links, payment tokens and signed values that turn out to be reusable are in scope for us, and each finding arrives with the exact requests we sent. Ask us to run it on one of your applications.
Or start with a $199 pilot on one application: thirty days, success criteria agreed before day one, credited against the annual if you convert.