6

At a company I worked at, I had to change my password every 90 days and I could only reuse a password after 8 iterations. This no-reusal included passwords being too similar to the old one, e.g. when I only changed one letter, that new password was not accepted.

Does that mean they were storing this password in plaintext? This seems rather bad practice to me. Or is there some hash function that allows similarity comparisons?

helm
  • 446
  • 4
  • 11
  • They could just be storing the last 8 hashes... –  Nov 05 '14 at 13:48
  • 2
    How would they compare similarity (and not just equality) then? If you downvoted the question, I'd be interested in knowing why the answer is so obvious. – helm Nov 05 '14 at 13:50
  • Oh I somehow missed that. I've seen companies pre-compute similar hashes and store them. The short answer is nobody knows but the server admins...but it is possible that they are plaintext –  Nov 05 '14 at 13:52
  • @Simon: Sorry, I didn't phrase that very well at all. What I meant was they might store the last 8 passwords once in hashed form, with which the current password can be checked to see if it is the same. They may only compare the new password with the one previous to see if it is _similar_. As you've just entered the old password as a security check, this can be compared in plaintext with the new password for similarities. – SilverlightFox Nov 05 '14 at 14:17
  • `YRGn5bl8ou` has just been added to a dictionary list somewhere. – Matthew Peters Nov 05 '14 at 14:47
  • dupe or nearly of http://security.stackexchange.com/questions/3170/how-can-a-system-enforce-a-minimum-number-of-changed-characters-in-passwords-wi and http://security.stackexchange.com/questions/53481/does-facebook-store-plain-text-passwords – dave_thompson_085 Nov 06 '14 at 09:11

3 Answers3

11

No, it does not mean they are storing the passwords in plain text. The question doesn't completely describe the behavior. Are they matching patterns only from your current password, or patterns from all 8 of your previous passwords?

If it's the first case, the answer is dead simple, and this is that they have the hashes from the 8 previous passwords to compare against, and when you change your password, you enter your current password as well as your new password, and they now have both of these in plain text to compare for patterns. This is more likely what is happening.

If it is the second case, there are still several other ways this could be done, including storing the passwords in an encrypted (rather than hashed) format, so they can be decrypted and compared, or storing the pattern (or mask) of your passwords along with the hashes and then disallowing new passwords that match any of those old masks. Arguably these options are not as secure as just storing the hashes, but that shouldn't particularly concern you... It's risk to the business not to you, and if they feel it's acceptable risk, then that is their decision. Your only concern (and regardless of the password policy at your company, this should always be a concern for you) is to ensure that the passwords you use for work network are different than the passwords you use everywhere else, so a compromise of your work password doesn't endanger your personal accounts and vice versa.

Benoit Esnard
  • 13,979
  • 7
  • 65
  • 65
Xander
  • 35,616
  • 27
  • 114
  • 141
  • The first case seems likely, I'll have to check that the next time. I believe it was the previous password I tried to reuse slightly changed. – helm Nov 05 '14 at 14:24
  • It's also somewhat common for lazy people to just add a suffix to their password when they are forced to change it. For instance, adding "!". You could protect against that by hashing substrings of the new password and comparing them to the hashed password history. – Scott McIntyre Feb 25 '16 at 18:27
0

I can think of a few options

Most probably, they're storing passwords encrypted instead of hashed. This is not as secure as hashing with a strong hash algorithm but as long as the encryption key is properly secured it shouldn't be a problem

Another probable option is to just compare the new password with the previous one when you enter it. You can check if this is true using a forgot password function or trying to use a password similar to a previous one but not the last one

Other option is to take the new password and perform some permutations, substitutions, append and/or substract some characters, then hash this modified password and compare with previous hashes. It's essentially the same as storing hashes for similar passwords when you change it, but that's probably infeasible due to the required space to have that much hashes

The last option, is to have the passwords in plaintext. No need to say how insecure it is

Mr. E
  • 1,954
  • 9
  • 18
0

A hash by definition should not allow you to find if it's similar to something else.

From wikipedia:

  1. it is easy to compute the hash value for any given message
  2. it is infeasible to generate a message that has a given hash
  3. it is infeasible to modify a message without changing the hash
  4. it is infeasible to find two different messages with the same hash.

Have you tested if the system really verify this rule? I cannot think a way to do this without storing password in a recoverable format (such as plaintext or encrypting with a symetric key)

drpexe
  • 775
  • 1
  • 5
  • 12
  • 1
    Yes, I found out by test only. At one point I was unwilling to memorize another password and tried to change just one letter, which did not work. – helm Nov 05 '14 at 13:53