nonce reuse

The mistake of encrypting two messages with the same key and the same nonce, which can expose both messages and allow forgeries.

A single repeat can reveal plaintext, and with AES-GCM it lets attackers forge messages the receiver accepts.

In more detail

In stream-style modes such as CTR, GCM and ChaCha20-Poly1305, the same key and nonce produce the same keystream, so combining the two ciphertexts with XOR cancels it out and anyone who knows or guesses one message can read the other. With AES-GCM a repeat also leaks the secret used to compute tags, letting attackers forge messages. It usually comes from a hard-coded nonce, a counter that resets after a restart or too many random nonces under one key.

Examples

NONCE = bytes(12)  # the bug: a constant nonce, reused for every message
keystream = bytes(c ^ p for c, p in zip(c1, known))

Related terms

Taught in

References