Used to have monthly changes for a Microsoft account. When trying to change, it said “You used this password 6 months ago, please use another”, besides the “passwords needs to be at least this different” message. Clearly they are storing them, not sure if they’re stored cleartext or they’re decrypting them on the fly somehow
You should not be able to decrypt a password, passwords aren’t encrypted but hashed, they would be insecure would they be encrypted.
Hashing differs from encryption in that it is irreversible, because two or more strings might result in the same hash if the hashing function is applied to them (hashing is not injective).
But since your password will always yield the same hash you can compare the two hashes and if they are equal you are considered authenticated.
If you try to log in with a different password (or even the hash of the correct password) then it will produce a different hash resulting in a failed authentication attempt
The way crackers get a password if they have the hash is by guessing pw candidates and using the hash function on them, if its the same as the hash they have they found the/a valid password. The guessing can be quite involved and with enough time and data about a victim often 12-13 digit passwords with special characters and all can be cracked - If the victim used a somewhat mnemonic pw that is.
Generated pws from a password safe are much safer (but usually also longer).
In your case I suspect MS was storing a history of hashes which is not advisable as it gives potential crackers more to work with, but its way less bad then storing plain text or encrypting passwords
I mean “because password hashes” is basically my original rational so not sure it qualifies as a counter argument.
But the link you provide is more explicit:
When the user enters the new password, the system generates the variations of the new password entered, hashes each one of them, and compares each hash against the old password’s hash. If any of the hash matches, it throws an error. Else, it successfully changes the password
It is possible to hash all 1 character variations I guess, I kinda doubt that it is done often (does anyone know a library?).
I guess complexity increases linearly so password length is might not severely limit this mechanism.
It would be interesting to see a calculation of how long it takes for a long password can to calculate all possibilities for 1 char variations for utf-8 or other charsets
You’re not supposed to have the old password. If you had the old password you could just compare it to the new password.
The only way you can do it is to take the new password and make a hash for every possible single-character variation and compare them all to the old hash
They shouldn’t be storing the old password hashed, either. Expired password hashes should be destroyed like any other potentially-sensitive information that is no longer business critical.
There is a reason hackers look to get users tables even though the passwords are hashed. Because with enough of them and enough time, they can usually figure out plaintext. Giving them 10 previous hashed passwords for each user is just increasing the hypothetical risk.
Sorry, that’s what I meant as well :) Came out upside down when I wrote. We used to figure out shitty ISP router passwords this way by having a table of common passwords and their hashes.
How would they know how many digits changed? They don’t store the password in cleartext.
Right?
…
Well they don’t need to store it to a drive. You just entered your old password in order to login and authorise your password change.
It’ll still be in memory against your session.
Sure if the means of authorising a password change is your old pw then everythings fine
Used to have monthly changes for a Microsoft account. When trying to change, it said “You used this password 6 months ago, please use another”, besides the “passwords needs to be at least this different” message. Clearly they are storing them, not sure if they’re stored cleartext or they’re decrypting them on the fly somehow
You should not be able to decrypt a password, passwords aren’t encrypted but hashed, they would be insecure would they be encrypted.
Hashing differs from encryption in that it is irreversible, because two or more strings might result in the same hash if the hashing function is applied to them (hashing is not injective).
But since your password will always yield the same hash you can compare the two hashes and if they are equal you are considered authenticated. If you try to log in with a different password (or even the hash of the correct password) then it will produce a different hash resulting in a failed authentication attempt
The way crackers get a password if they have the hash is by guessing pw candidates and using the hash function on them, if its the same as the hash they have they found the/a valid password. The guessing can be quite involved and with enough time and data about a victim often 12-13 digit passwords with special characters and all can be cracked - If the victim used a somewhat mnemonic pw that is. Generated pws from a password safe are much safer (but usually also longer).
In your case I suspect MS was storing a history of hashes which is not advisable as it gives potential crackers more to work with, but its way less bad then storing plain text or encrypting passwords
No you don’t need to store anything in clear text to check password parameters
But you need to know previous password if the objective is to make sure there’s at least two characters difference compared to new password
No, because password hashes. Read this: https://security.stackexchange.com/questions/139738/company-can-tell-if-new-and-old-passwords-are-too-similar-is-there-a-security-p
I mean “because password hashes” is basically my original rational so not sure it qualifies as a counter argument.
But the link you provide is more explicit:
It is possible to hash all 1 character variations I guess, I kinda doubt that it is done often (does anyone know a library?).
I guess complexity increases linearly so password length is might not severely limit this mechanism. It would be interesting to see a calculation of how long it takes for a long password can to calculate all possibilities for 1 char variations for utf-8 or other charsets
Thanks for sharing the link!
deleted by creator
You could take the old password, change one or two letters and compare the hash to the hash of the new password?
That’s the point though.
You’re not supposed to have the old password. If you had the old password you could just compare it to the new password.
The only way you can do it is to take the new password and make a hash for every possible single-character variation and compare them all to the old hash
They shouldn’t be storing the old password hashed, either. Expired password hashes should be destroyed like any other potentially-sensitive information that is no longer business critical.
There is a reason hackers look to get users tables even though the passwords are hashed. Because with enough of them and enough time, they can usually figure out plaintext. Giving them 10 previous hashed passwords for each user is just increasing the hypothetical risk.
You’re right ofc if you wanted to make a general remark, but wrong if you thought that was what I was implying. Never store hash histories, kids!
Sorry, that’s what I meant as well :) Came out upside down when I wrote. We used to figure out shitty ISP router passwords this way by having a table of common passwords and their hashes.