I want to upgrade the security of some existing databases of users' authentication tokens strictly for the purpose of making sure that if the database is stolen, attackers will not be able to guess any but the weakest passwords in a reasonable period of time. I know there's not much I can do for people who choose "password" for their password, but I think we can protect most people who use words from a bigger dictionary, e.g. "regenerating".
Some of the databases are from the 90's and the existing authentication tokens are stored as
MD5(salt + password)
and some of the salts are pretty weak. Other databases use somewhat better hashes and salts, but still not strong enough to resist attacks from today's computers. However, we don't want to wait until people login to update their database entries. So my plan is to simply take the output of whatever hashing algorithm the password system is currently using and to feed it into bcrypt and store that result as the new authentication token, e.g.
bcrypt(MD5(salt + password), new_secure_salt)
Does anyone see a weakness with this procedure? It seems to me that this will not be any worse than using bcrypt(password, new_secure_salt)
but I know better than to rely on just myself for the evaluation of a cryptographic protocol.
I wouldn't recommend this procedure for new applications, but this method is the best I can come up with for immediately securing an entire database of insecurely stored passwords in a way that is transparent to users.
original_salt + bcrypt(MD5(original_salt + password), new_secure_salt)
$\endgroup$salt
must be derivable from something stored. It is best if the originalsalt
is a subfield ofnew_secure_salt
: that insure MD5 collisions can't be turned into salt collisions; but even without that, yesbcrypt(MD5(salt + password), new_secure_salt)
seems to be an improvement in every respect, as most of the entropy in password remains inMD5(salt + password)
. However I would recommend scrypt over bcrypt; see in particular table 1 of the paper defining scrypt. $\endgroup$