Section 19.1.13

Nonce collision probability versus replay freshness

Definition

Nonce §5.18 collision probability is the probability that two independent random draws of a nonce, a value meant to be used only once, coincide. By the birthday bound §5.6, repeats become likely once the number of draws nears the square root of the number of possible values. Replay freshness is the property that a receiver acts on each authenticated message at most once, even if an attacker resends the message. A collision is an accident of honest draws; a replay is a deliberate copy, which repeats the nonce with certainty.

Where it fits

Main entry: Nonce (§5.18).

The Nonce entry explains how nonces are produced and why some algorithms §14.1 fail when one repeats. If a sender draws qq nonces independently and uniformly (each value equally likely) from the 2b2^{b} possible bb-bit values, the probability that some two of them are equal is at most q(q−1)/2b+1q(q-1)/2^{b+1}: the number of pairs, q(q−1)/2q(q-1)/2, times the probability 2−b2^{-b} that one pair matches. For b=64b = 64 and q=220q = 2^{20}, about one million messages, the bound is 220(220−1)/265≈2−25≈3.0×10−82^{20}(2^{20} - 1)/2^{65} \approx 2^{-25} \approx 3.0 \times 10^{-8}. For b=32b = 32 and q=216=65,536q = 2^{16} = 65{,}536 messages, it is about 0.5. This number says how likely two honest messages are to share a nonce, and nothing more.

Freshness asks a different question, the one the Replay attack §1.26 entry treats. A sender draws the nonce 0x5e2a91c7, places it in an unlock command and computes an authentication §1.6 tag over the whole command: a short value that only a holder of the secret key can compute. An attacker records the command with its tag and sends the same bytes an hour later. No second draw took place, so the collision probability plays no part: the nonce repeats with probability 1, because the attacker copied it. The tag still verifies, because the bytes are exactly the ones the key holder authenticated, and a receiver that checks only the tag executes the command twice. A random nonce makes each new message differ from the others; it cannot make an old message new.

Freshness comes from the receiver, from state that the receiver keeps or from a value that the receiver chose.

Two conditions hold in every case. The nonce, counter or challenge must lie inside the authenticated bytes; otherwise the attacker replaces it with a value the receiver has not seen, and the tag still verifies. And the two notions have different scopes. An encryption nonce must be unique for as long as its key is used. A freshness rule must hold for as long as an old authenticated message could still be accepted, which includes every restart and reset of the receiver.

Questions answered

Does a random nonce make a command fresh?

No. A random nonce, a value the sender draws at random for one use, makes it unlikely that two honest commands carry the same value, but it does not make a received command fresh, meaning not accepted before. An attacker who records an authenticated command and sends it again repeats the nonce exactly, and the authentication tag still verifies, so the probability of a random collision says nothing about that copy. Freshness requires the receiver to act: to remember the nonces or counter values it has accepted and reject repeats, or to issue its own random challenge that the command must include. In each case the nonce must be covered by the authentication tag, and the receiver’s memory must survive restarts for as long as old commands could still be accepted.

Related entries: Replay attack (§1.26), Birthday bound (§5.6), Authentication coverage (§5.41), Replay resistance requires state or a fresh challenge (§17.10), Monotonic counter (§8.28).