I imagine it’s due to time stamps and sequence numbers. However, those can be replayed as well.

The attacker can't create new sequence numbers or time stamps without being detected if the integrity of every message is maintained. This can be obtained by using HMAC verification of an authentication tag over the message. The attacker doesn't have the symmetric HMAC key if it was sent over an encrypted tunnel between the victim and server.

Is there more to it than this? Or is this really the basic idea?

closed as unclear what you're asking by Steffen Ullrich, Xander, S.L. Barth, ThoriumBR, kasperd Jul 22 '18 at 15:47

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Your question is unclear to me. Are you asking about how to design a protocol where replay attacks are impossible? Are you asking how replay attacks are handled in specific protocols (which?). Are you asking for all ways how replay attacks can be prevented (too broad)? – Steffen Ullrich Jul 14 '18 at 12:34
  • Sorry for being unclear, I want to know if replay attacks are prevented completely by combining tcp sequencing numbers and HTTPS. – AznBoyStride Jul 14 '18 at 18:49
  • If the system is checking timestamps and sequence numbers, how can this be replayed?? – schroeder Jul 18 '18 at 11:27
  • Can you not, as an attacker, create a fake timestamp and sequence number? – AznBoyStride Jul 18 '18 at 16:39
  • @AznBoyStride if you are creating your own timestamps and sequence numbers, then it is no longer being "replayed" – schroeder Jul 23 '18 at 16:04

Yes, sequence numbers and time stamps are good ways to disallow replay attacks. However, you don't need message authenticity nor message integrity to make them work. The reason is simple: the check only disallows messages that would otherwise be accepted.

However, if you do offer authenticity / integrity over the message then you'll still want to include the sequence number / time stamp in the calculation. Otherwise an attacker may change just the sequence number / time stamp to a new value and use that. And you do want to offer authenticity / authenticity for a secure protocol, for instance by calculating an authentication tag using a secure MAC algorithm.

The above isn't officially a replay attack because it is an active attack that alters the message that is send. That is however of little consolation if your protocol is compromised. And yes, after the integrity of the message is validated, you just need to check the sequence number or timestamp. It is then "that simple".


  • Checking a time stamp or storing a sequence number in a persistent way is not necessarily easy, which is why I put "that simple" between quotation marks.
  • Make sure that you cannot replay your own messages, for instance by including an sender / receiver in the message or by using separate session keys for each party.

Not the answer you're looking for? Browse other questions tagged or ask your own question.