FS#17109 - AUR passwords are not salted
Attached to Project:
AUR web interface
Opened by Gavin Bisesi (Daenyth) - Thursday, 12 November 2009, 16:04 GMT
Last edited by Loui Chang (louipc) - Monday, 20 September 2010, 01:27 GMT
Opened by Gavin Bisesi (Daenyth) - Thursday, 12 November 2009, 16:04 GMT
Last edited by Loui Chang (louipc) - Monday, 20 September 2010, 01:27 GMT
|
Details
With the current work by foutrelis on password resets, I
noticed that the AUR does not salt user passwords. This
means that if the aur password db is comprimised, the user
passwords are MUCH easier to crack.
Due to the fact that all existing users have their hashes stored unsalted, we would need two code paths in the login page. I think this would require a new db entry, "salted", as a bool so that you could do login_user { if pass_is_salted: check_hash(md5(username + entered_pass [+ get_salt_string_from_config()])) else: check_hash(md5(entered_pass) } See also: http://en.wikipedia.org/wiki/Salt_%28cryptography%29 |
This task depends upon
Closed by Loui Chang (louipc)
Monday, 20 September 2010, 01:27 GMT
Reason for closing: Implemented
Additional comments about closing: 1.7.0
Monday, 20 September 2010, 01:27 GMT
Reason for closing: Implemented
Additional comments about closing: 1.7.0
FS#3061I think the common approach is:
if (md5sum($_POST['passwd'] . $salt) == $dbhash) {
login();
} elseif (md5sum($_POST['passwd']) == $dbhash) {
$salt = random_salt();
update_database("salt = $salt", "dbhash = md5sum($_POST['passwd'] . $salt)");
login();
} else {
die "Wrong password";
}
The concept is called "key strengthening": http://en.wikipedia.org/wiki/Key_strengthening
while ( $row = $sql -> fetch_assoc ( ) )
{
# $sql -> query ()...? # x 100 = 100 queries... lol
}
Add a salted column and replace the hash(password) with hash(salt + hash(password))
The only thing you need is to switch the files at the same time you update the database.
Can anyone comment as to whether this would be more or less secure than any other proposed method?
It includes a salt as well as a configurable number of iterations.
Here's a PHP tutorial for PBKDF2:
http://www.itnewb.com/v/Encrypting-Passwords-with-PHP-for-Storage-Using-the-RSA-PBKDF2-Standard
Don't expect anything to be done without them.
So why don't you send in a patch if it worries you so much?
Thanks.
do we have 'sha1' function? (PHP 4 >= 4.3.0, PHP 5) - SHA1 is still weak but better than MD5
do we have 'mhash' function? ('mhash' extension, PHP 4, PHP 5) - obsoleted by 'hash' extension listed below
do we have 'hash' function? ('hash' extension, PHP 5 >= 5.1.2, PECL hash >= 1.1)