Live data from Hacker News

AES-GCM and breaking it on nonce reuse

frereit.de

61–64 of 64 posts

Re: AES-GCM and breaking it on nonce reuse

#61
post #15

"At first glance, this seems fine, but it is not. If an attacker knows the plaintext p1 and the ciphertext c1, then they can compute the keystream by XORing p1 and c1 together" Also, if the attacker only has c1 and c2, if the nonce is reused then c1 xor c2 will be the same as p1 xor p2. In most cases, two plaintexts xored with each other are trivial to decode.

I made an entire "game" based on this concept (AES CTR though) https://aes-cpa.fly.dev/

For anyone interested, I made a few more:

* https://ctr.var.tailcall.net/

* https://ecb.var.tailcall.net/

* https://cbc.var.tailcall.net/

The goal is a bit different (I use them when teaching university courses, to show that encryption is not authentication), but the same ideas apply.

Re: AES-GCM and breaking it on nonce reuse

#63

Earlier quoted context omitted.

From the OCB FAQ[1]: >What happens if you repeat the nonce? You’re going to mess up authenticity for all future messages, and you’re going to mess up privacy for the messages that use the repeated nonce. The loss of privacy on OCB nonce reuse is not as severe. It would be more or less the same as with ECB mode. [1] https://www.cs.ucdavis.edu/~rogaway/ocb/ocb-faq.htm

The next few lines are: > It is the user’s obligation to ensure that nonces don’t repeat within a session. In settings where this is infeasible, OCB should not be used. But earlier in that section we have: > […] The nonce doesn’t have to be random or secret or unpredictable. It does have to be something new with each message you encrypt. A counter value will work for a nonce, and that is what is recommended. […] * ht…

OCB is superior to AES-GCM-SIV in every way other than nonce reuse. OCB is faster than generic GCM for any combination of hardware acceleration. OCB is also significantly better than generic GCM for nonce reuse.

GCM-SIV is not perfect for nonce reuse anyway. It reveals to the attacker that two messages are identical.

Re: AES-GCM and breaking it on nonce reuse

#64

If the attacker never gets a hold of a plaintext-ciphertext pair, how well does AES-GCM with nonce reuse hold up?

It breaks down to a primitive of repeating key xor.

If you never had a plaintext you could potentially (depending on the content) collect enough ciphertexts to do frequency analysis on it. You'd recover the keystream at least partially, and then guess based on context to fill out the rest.

Post reply on HN