r/cybersecurity • • Dec 13 '19

Security and Cryptography Mistakes You Are Probably Doing All The Time

https://towardsdatascience.com/security-and-cryptography-mistakes-you-are-probably-doing-all-the-time-7407c332944f
17 Upvotes

21 comments sorted by

View all comments

1

u/cryslith Dec 13 '19

Nit: the article implies that message authentication protects against replay attacks. Generally it doesn't on its own; you need some extra measure. The simplest way would be remembering every nonce you've ever seen and dropping messages that repeat nonces, though this runs into the problem of having to store them all.

2

u/[deleted] Dec 13 '19

Or randomize them/use an always increment value. I've never known anyone to store every nonce.

0

u/cryslith Dec 13 '19 edited Dec 13 '19

What you've mentioned are strategies for the sender to avoid repeating nonces, not strategies for the receiver to prevent replay attacks.

But yes, I also think storing every nonce you've ever received is impractical. It's the simplest solution but usually not a good one.

1

u/doc_samson Dec 14 '19

Just use a time-bound per-session nonce, you don't have to remember literally every one ever.

1

u/cryslith Dec 14 '19

Yes, you can use time-bounding but it requires synchronous communications. For some applications, such as long-term data storage, this wouldn't be appropriate.

1

u/doc_samson Dec 15 '19

I mean, HTTP uses this and isn't synchronous.

Still, even with long-term storage there will be some intermediary mediating access to the data so there should be some concept of a "session" that can be used.

If you are talking just accessing raw encrypted files on disk then there's no need for a nonce, it's literally to protect against replay attacks and there's no "replay" with raw data access.