The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Changing vBulletin 4 its password hashing to use BCrypt
This article has also been published at http://blog.technidev.com/changing-v...to-use-bcrypt/, my personal blog about security, exploits, development, etc. Introduction By default, vBulletin uses a very basic and easy to crack password hashing: PHP Code:
Fortunately, it's very easy to change the password hashing. I will change the password hashing of vBulletin to use BCrypt, a much better algorithm. The password hashing will look like this at the end of this guide: PHP Code:
Requirements for this guide: - Access to the FTP or permission to edit .php files on the server. - PHP version of 5.5+ (we make use of the password_hash function) - You must update all of the passwords in the current database. - vBulletin 4.2.2 (this modification has been made on 4.2.2) - Database access in the form of SSH/PHPMyAdmin or any other database manager tool Create a backup of the files we are going to edit first so you can always restore it in case it goes wrong! Step 1: modify password column type First things first, we have to modify the type of the password column in the user table. You can either do this in PHPMyAdmin by changing it to char(60) or by executing the following query: PHP Code:
Step 2: edit /includes/functions_login.php Now let's modify the verify_authentication function in the /includes/functions_login.php file. Look for: PHP Code:
PHP Code:
Step 3: edit /includes/class_dm_user.php This file contains the verify_password and hash_password function which must be changed as well. Look for the hash_password function: PHP Code:
PHP Code:
PHP Code:
PHP Code:
Step 4: update all passwords in the user table The only downside of this is that we have to update all passwords in the database. But no worries, no one will have to change or update their password to make this work since we use the old password hashing in BCrypt. Please make a backup of your database or user table before doing this so you can restore it in case it does not work as intended! Create a file in the root of your forum and name it something like update_passwords.php. Contents of the file: PHP Code:
In case the script timed out, just run it again or change the script execution timeout. Step 5: verifying functionality Now try to login onto your forum and see if that works, in case you get an incorrect username/password error, it means you did something wrong in this guide. In case it works, try to update your password and relog to see if that part works as well. I tested the login, registration, remember me checkbox and changing password function on a local test forum which seemed to work fine. Support will be provided here (comment box). I'll answer the most basic questions here at vbulletin.org. |
#2
|
|||
|
|||
Has anyone tried this?
|
#3
|
|||
|
|||
Yeah I've done this on my local vBulletin testing forum.
|
#4
|
|||
|
|||
A problem I see here is that the browser still transmits the password with the md5 hashes and an eavesdropper can still intercept them and crack them. All your advanced hashing happens on the server after it receives the md5 hashes. What you could do is replace the original vbulletin_md5.js file with one that does the md5 and bcrypt hashing . Then the password is better encrypted in transit. I think you would have to use vBulletin's original code and then add more code (available as open source) to further encrypt both versions of the hashes. Once this is done you could skip the PHP code that bcrypt hashes on the server
There's a further thing to consider though, it seems to me that there's a problem with vbulletin_md5.js and older (and maybe newer) versions of IE, so it doesn't encrypt at all. You'll have to check this out with various browsers. There's open source md5 javascript available and you could copy the vbulletin code that handles the difference between vb_login_md5password and vb_login_md5password_utf into the new md5 algorithm. |
#5
|
|||
|
|||
Quote:
|
#6
|
||||
|
||||
If someone can get an MITM attack, you've got a lot bigger problems than the password being transmitted as md5 or plaintext.
|
#7
|
|||
|
|||
Dave could this be written into a mod? It would help when IB updates vbulletin as I wouldn't have to redo the edits.
|
#8
|
|||
|
|||
Nope, this requires modifications in files which can not be done in hooks.
|
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|