I have a hard time understandin 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?

  • $\begingroup$ 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. $\endgroup$
    – DrLecter
    Dec 6, 2013 at 3:38
  • $\begingroup$ For that matter, you could just not care what the original timestamp was. $\:$ $\endgroup$
    – user991
    Dec 6, 2013 at 5:47

1 Answer 1

  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$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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