Written by: Mio Kanzaki(Security Analyst (AI))Reviewed by: 千葉圭介Updated
A replay attack is an attack that resends captured communication to impersonate someone. MITRE's CWE describes it as a flaw, called capture-replay, in which a person who has watched communication can resend its content to a server and bypass authentication. The resent content is the same as the original communication, or the original with a very small part changed.
How does a replay attack work?
Imagine a password spoken at an entrance is recorded and played back, and the person who recorded it passes as the genuine person. If you only check whether the password is correct, you cannot tell whether the speaker is the real person. According to CWE, it is difficult to prevent replay without using cryptography.
CWE places it as a kind of network injection attack, one that watches a valid command sent earlier and sends it again, changing it slightly if necessary. MITRE's CAPEC lists, as session replay, the trick of stealing a valid session ID used in an earlier transaction and reusing it to impersonate someone. The damage after communication has been stolen is gathered under session hijacking. What is visible from outside, such as the encryption information of your site, can also be seen with the free URL check.
Why does a replay attack matter?
Because the communication is a correct one, the server cannot tell it from a genuine request. Even if the password has not been stolen, there is a risk of impersonation from the communication record alone. A party that runs a system accepting member logins or requests from devices needs a design that checks whether the communication it received is a replay.
As a measure at the design stage, CWE lists a mechanism that combines a sequence number or timestamp with a checksum that covers it, and accepts the same message only once. A sequence number is visible to an eavesdropper, so the message is signed cryptographically so that the sequence number alone cannot be rewritten. CAPEC lists invalidating the session ID after logout, giving the session ID an expiry time, and encrypting communication as measures.
For a review of how authentication and signatures are designed, contact us.
Related terms
- Session hijacking: a trick that takes over a login state and impersonates the person.
- Man-in-the-middle attack: an attack that cuts into communication on its way and reads or rewrites its content.
- TOTP: a mechanism that confirms who you are with a number that changes over time.
- HMAC signature: a signature mechanism for checking that the content of communication has not been rewritten.
Next step
The damage after communication has been stolen is gathered under session hijacking. The free URL check shows only what is visible from outside. For a review of how authentication and signatures are designed, contact us for a free consultation.
Frequently asked questions
If we encrypt, are replay attacks prevented?
What CWE recommends is a design that combines a sequence number or timestamp with a checksum that covers it, and accepts the same message only once. A sequence number is visible to an eavesdropper, so a cryptographic signature is used together with it.
What do we do to stop a login state from being reused?
CAPEC lists invalidating the session ID after logout, giving the session ID an expiry time, and encrypting communication. Making sure an old ID cannot be used after logout makes it easier to prevent reuse of a stolen ID.
Frequently asked questions
If we encrypt, are replay attacks prevented?
What CWE recommends is a design that combines a sequence number or timestamp with a checksum that covers it, and accepts the same message only once. A sequence number is visible to an eavesdropper, so a cryptographic signature is used together with it.
What do we do to stop a login state from being reused?
CAPEC lists invalidating the session ID after logout, giving the session ID an expiry time, and encrypting communication. Making sure an old ID cannot be used after logout makes it easier to prevent reuse of a stolen ID.