Hi guys,
This seems to be an extension of this thread
http://mibew.org/forums/index.php/topic,191525.0.htmlI installed mibew 1.6.9 on my server hosted on Hostgator a while ago and everything worked just fine. I upgraded to 1.6.10, and that was also fine. I received a notice from Hostgator that they are going to upgrade the PHP installation on their servers. After the upgrade, I can no longer login using my username and password.
I have tracked down the issue to the use of crypt() function in calculate_password_hash() of libs/operator.php. The behavior of the crypt function changed with the php upgrade. Specifically, before the upgrade, the crypt() function would take a salt that is less that 22 characters and pad it with $$$$ to get it up to 22 characters. With the new setup, if the salt is less than 22 characters, it returns '*0', which in the calculate_password_hash() logic, will default to MD5. The problem why I can't login is that it comparing the blowfish hash from before to the md5 hash now.
I have another server that pads a short salt when using the crypt function. I put together a script to test the behavior on both servers, and my results are below. The script is attached.
My question to the Mibew devs. Is it correct usage of crypt() to assume that it will do the padding? If not then the logic in calculate_password_hash() should take care of padding or truncating at 22 chars of the login.
Eyong
========================================================
PHP_VERSION_ID = 50513CRYPT_BLOWFISH = 1
CRYPT_MD5 = 1
Testing crypt() functions...
Blowfish hashes
crypt(dumb_password, $2y$08$lessthan22) = *0 <---- No automatic padding, error result
crypt(dumb_password, $2a$08$lessthan22) = *0 <---- No automatic padding, error resultMD5 hash
crypt(dumb_password, $1$lessthan22) = $1$lessthan$eA/WAfDovhEkcObRrTIp4/
Blowfish hashes
crypt(dumb_password, $2y$08$22exacltytwentytwochar) = $2y$08$22exacltytwentytwochaeJBqe6eLBO8vNU4NXoOEFmRGwKCEueUO
crypt(dumb_password, $2a$08$22exacltytwentytwochar) = $2a$08$22exacltytwentytwochaeJBqe6eLBO8vNU4NXoOEFmRGwKCEueUO
MD5 hash
crypt(dumb_password, $1$22exacltytwentytwochar) = $1$22exaclt$vruhg8twySmse2TpsuWth.
=============================================================================
PHP_VERSION_ID = 50410CRYPT_BLOWFISH = 1
CRYPT_MD5 = 1
Testing crypt() functions...
Blowfish hashes
crypt(dumb_password, $2y$08$lessthan22) = $2y$08$lessthan22$$$$$$$$$$$.0qxTgMIOECtmZ30vig9MHwyMjHgNMWC
crypt(dumb_password, $2a$08$lessthan22) = $2a$08$lessthan22$$$$$$$$$$$.0qxTgMIOECtmZ30vig9MHwyMjHgNMWCMD5 hash
crypt(dumb_password, $1$lessthan22) = $1$lessthan$eA/WAfDovhEkcObRrTIp4/
Blowfish hashes
crypt(dumb_password, $2y$08$22exacltytwentytwochar) = $2y$08$22exacltytwentytwochaeJBqe6eLBO8vNU4NXoOEFmRGwKCEueUO
crypt(dumb_password, $2a$08$22exacltytwentytwochar) = $2a$08$22exacltytwentytwochaeJBqe6eLBO8vNU4NXoOEFmRGwKCEueUO
MD5 hash
crypt(dumb_password, $1$22exacltytwentytwochar) = $1$22exaclt$vruhg8twySmse2TpsuWth.