A replay attack resends a previously valid message and authentication tag so the recipient may accept an old action as current. A MAC proves authenticity, but not freshness, unless the protocol adds replay protection. section 3.3.3 section 3.2
A practical defense tracks message order or freshness:
- Add an incrementing counter to the MAC input; reject tags computed with an unexpected counter. section 3.3.3
- Use fixed-length counters, commonly 64 bits; rotate the shared key before the counter wraps, then reset it. section 3.3.3
- Treat variable-length counters cautiously because ambiguous encodings can enable authentication-tag forgeries. section 3.3.3
Authenticated transport
TLS 1.3 increments the authenticated-encryption nonce for each message. Replayed or reordered records use the wrong nonce, causing decryption to fail and the connection to close. Its 0-RTT early data is different: a passive attacker can replay it, so applications should use it only for safely replayable operations. section 9.2.2
Figure 3.5 Two users sharing two keys, k1 and k2, exchange messages along with authentication tags. These tags are computed from k1 or k2, depending on the direction of the messages. A malicious observer replays one of the messages to the user.
Trace an observer capturing an authenticated message and sending it again, then compare it with the counter-protected exchange. section 3.3.3


