Tell me more ×
IT Security Stack Exchange is a question and answer site for IT security professionals. It's 100% free, no registration required.

In some environments, it is required that users change a certain number of characters every time they create a new password. This is of course to prevent passwords from being easily-guessable, especially with knowledge of old passwords such as a departed employee might have for a shared service account.

I have separate questions open to address button-pushing side of this enforcement. However, I'm also curious as to how this enforcement works on the back end. If a cleartext password cannot be derived from a strong hashing algorithm, how does the system determine how many characters have been changed in new passwords?

share|improve this question

4 Answers

up vote 18 down vote accepted

I'm not sure about comparing with all the passwords the user has previously used, as it really depends on the hashing system your using and I would say if its possible to derive any similarity from the hash then its not a very good system to begin with.

But assuming that the user has to supply their current password when setting their new password, you could at least check the new one against the current one as you'll have both as unhashed at that point.

The pam_cracklib module on Linux checks passwords like this and does a few basic checks by default.

  • Is the new password just the old password with the letters reversed ("password" vs. "drowssap") or rotated ("password" vs. "asswordp")?
  • Does the new password only differ from the old one due to change of case ("password" vs. "Password")?
  • Are at least some minimum number of characters in the new password not present in the old password? This is where the "difok" parameter comes into play.

You can find some more details about it here.

share|improve this answer
7  
That's a good method, and it's the one that actually gets used in the real world. A password history/complexity enforcer could also check against an arbitrary number of historical passwords by hashing variants and derivations when a user first sets the password, and storing those to check against later. – user502 May 26 '11 at 12:29
+1 @Mark & @user502. The issue of going back beyond the password being updated deeper into the history for more than just a simple hash comparison (slight changes too) got me thinking about the utility of that anyway. If I am not using the identical password of > 1 generations ago how weak is that compared to a completely new password? My thinking is risk may not justify hashing tons of combinations to store on a phone for that test. – zedman9991 May 26 '11 at 13:51
1  
This can be defeated by changing the password twice in a row. – starblue Jun 6 '11 at 18:37
@starblue "changing the password twice in a row." can be defeated by enforcing a minimum time between changes. (Something I do not recommend.) – curiousguy Nov 5 '11 at 17:44

This is easily done on password change (where the user is and should be asked to provide both old and new password).

share|improve this answer
1  
To add to that, it works to check vs the nth password but not the n-1th. I'm not aware of any system that would catch an user using a "washington1", "newyork2", "washington3", "newyork4", "washington5", "newyork6" password sequence – Bruno Rohée Apr 28 '11 at 11:31
Bruno - right, for that you'd have to start storing cleartext passwords I guess (which is not a great idea). – frankodwyer Apr 29 '11 at 9:08

The user should enter both old and new password for a password change. So comparing the new password to the old one can easily be done because the plaintext version is given by the user.

For comparing the new password against previous passwords (other than the current one), checking can only be done by comparing the hash-results. Any method that would allow any other comparison would be a security hole.

share|improve this answer

It can be done only by keeping hashes, it could even be done over several iterations.

The method would be to take the password and iterate it through the hashing algo and check for comparisons against the stored values.

For instance, most users (and service desk folks love to fallback on this as a last resort with angry-important types) will iterate their passwords incredibly simply.

So taking the password: #foob@r1 and making it #foob@r2 which you're likely to see can be tested without knowledge of #foob@r1 by performing a brute force on the algo quickly. With modern processing power you could iterate through the first 4 characters in less than ten seconds.

Though for efficiency sake the last four are typically the ones people change so you're likely to see bigger bang for your buck there. If you're going to do non-consecutive and consecutive you're looking at a pretty big wait for the end user and a big chunk of processor.

share|improve this answer

Your Answer

 
discard

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.