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 messagekeystream = bytes(c ^ p for c, p in zip(c1, known))Related terms
- nonce — A value meant to be used only once, such as a unique number given to a cipher or a random token that marks trusted scripts in a web page.
- keystream — A stream of random-looking bytes made from a key and a nonce, which a stream cipher combines with the message using XOR to encrypt it.
- AES-GCM — AES in Galois/Counter Mode: the most widely used way to encrypt data so that it stays secret and any tampering is detected.
- ChaCha20-Poly1305 — An authenticated encryption scheme that pairs the ChaCha20 stream cipher with the Poly1305 authenticator, and runs fast even on devices without AES hardware.
Taught in
- Symmetric Encryption: AES-GCM & ChaCha20 — Cybersecurity Fundamentals, GRC & Cryptography