Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

Which of the following protocols is susceptible to replay attack :-

1) A -----> B username, password

2) A -----> B username, h(timestamp,password)

3) A -----> B username timestamp, h(password)

4) A -----> B username, h(timestamp), h(password)

I think the answer is 1 and 3

I know 2) is secure because the password and time-stamp are hashed together, I know 1) is definitely insecure. 3) is insecure if somehow the intruder gets to know the time-stamp he may replay it. I am slightly confused about 4) while it is true that we can't get the time-stamp from hash. I was wondering if it is possible to brute force a time stamp. I think there wouldn't be a lot of time difference between when the packet was sent and the time intruder intercepted it. Is it possible and send all possible timestamps until B accepts it?

share|improve this question
Why would you exclude 4 from being problematic? Would you really need to brute force time stamps? You would know the actual time stamp when conducting the replay. –  DrLecter Dec 6 '13 at 3:38
For that matter, you could just not care what the original timestamp was. $\:$ –  Ricky Demer Dec 6 '13 at 5:47
add comment

1 Answer

  1. Insecure, you just replay $\text{username}$ and $\text{password}$. Password is also sent in clear text.
  2. Secure, if the hash function $H$ used is strong enough to resist bruteforcing of the password. However you'll also need to send the timestamp so that the server can check the auth, so this scheme is better portrayed as $\text{username, timestamp, }H(\text{timestamp}||\text{password})$.
  3. Insecure, you replay $\text{username}$, $\text{timestamp_now}\ $ and $\text{password}$. Password is also sent in clear text.
  4. Insecure, you replay $\text{username}$, $H(\text{timestamp_now})\ $ and $\text{H(password)}$. Password is also sent in clear text.

Make sure to use a secure PBKDF for password hashing, like $scrypt$.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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