Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 17:05

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



vBulletin password encryption

Discussion on vBulletin password encryption within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
XxharCs's Avatar
 
elite*gold: 34
Join Date: Apr 2011
Posts: 1,475
Received Thanks: 1,228
vBulletin password encryption

I need somehow to check my login credentials against the ones stored in the db of vBulletin.
I know that vB uses Bcrypt and I'm using this bcrypt library:

I never succeed to get matching passwords.(yeah I tweaked the library to use $2y$ prefix in the bcrypt_gensalt method)

Code:
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "bcrypt.h"
#include "md5.h"

int main(int argc, char **argv)
{
        if(!(argc >= 2 && argc <= 3)) 
        {
                std::cerr << "Usage: ./bcrypt_release [password] [hash]" << std::endl;
                return EXIT_FAILURE;
        }

        std::string pw = md5(argv[1]);
    
        char salt[BCRYPT_HASHSIZE];
        char hash[BCRYPT_HASHSIZE];
        int ret;
    
        ret = bcrypt_gensalt(10, salt);
        ret = bcrypt_hashpw(pw.c_str(), salt, hash);
    
        if(argc == 3)
        {
                ret = bcrypt_checkpw(pw.c_str(), argv[2]);
                assert(ret != -1);
    
                std::cout << "pw: " << pw.c_str() << "\nsalt: " << salt << "\nhash: " << hash << "\nMatching passwords: " << (ret ? "[FAIL]" : "[OK]") << std::endl;
        }
        else if(argc == 2)
        {
                std::cout << "pw: " << pw.c_str() << "\nsalt: " << salt << "\nhash: " << hash << std::endl;
        }

        return EXIT_SUCCESS;
}
I also tried simple php code(which I found on the vB forums), to be sure it's not a C++ problem
Code:
$userSuppliedPassword = 'Plain Text Password';
$hashToMatch = 'user->token Column Value';
$options['cost'] = 10;
$options['salt'] = 'user->secret Column Value';
if (0 == preg_match('#^[a-zA-Z0-9./]+$#D', $options['salt']))
{
$options['salt'] = str_replace('+', '.', base64_encode($options['salt']));
}
if ($hashToMatch == password_hash(md5($userSuppliedPassword), PASSWORD_BCRYPT, $options))
{
echo "Woot!<br/>\n";
}else{
echo "Sad Face.<br/>\n";
}
But still, pw's don't match.

Anyone an idea?
XxharCs is offline  
Old 03/11/2017, 14:54   #2

 
elite*gold: 150
Join Date: Apr 2007
Posts: 2,392
Received Thanks: 6,644
No clue what Version you are using but VBulletin 4 does it differently:

$encrypted = md5(md5($decryptedpassword) . $row->salt);

$encrypted will be same password as in the database than.
wurstbrot123 is offline  
Old 03/11/2017, 16:36   #3
 
XxharCs's Avatar
 
elite*gold: 34
Join Date: Apr 2011
Posts: 1,475
Received Thanks: 1,228
Quote:
Originally Posted by wurstbrot123 View Post
No clue what Version you are using but VBulletin 4 does it differently:

$encrypted = md5(md5($decryptedpassword) . $row->salt);

$encrypted will be same password as in the database than.
Using vBulletin 5.
I even can't manage to do it via a WebRequest.( to check the user login)
XxharCs is offline  
Old 03/11/2017, 20:07   #4

 
elite*gold: 150
Join Date: Apr 2007
Posts: 2,392
Received Thanks: 6,644
You can actually ask the Customer Support if
you dont have a nulled Version.

They are pretty nice and even help with stuff like that.
wurstbrot123 is offline  
Thanks
1 User
Old 03/22/2017, 14:42   #5
 
elite*gold: 0
Join Date: Mar 2017
Posts: 103
Received Thanks: 78
Vbulleten 4 does it better

Vbulleten 4 does it better
Visual- is offline  
Old 03/22/2017, 18:23   #6
 
Dr. Coxxy's Avatar
 
elite*gold: 0
Join Date: Feb 2011
Posts: 1,206
Received Thanks: 736
php 7 ignores the salt parameter in password_hash afaik - which php version are you using?
also you should use password_verify and not == - though it shouldnt matter in your case, as youre using a custom hash.
Dr. Coxxy is offline  
Old 03/22/2017, 22:13   #7
 
XxharCs's Avatar
 
elite*gold: 34
Join Date: Apr 2011
Posts: 1,475
Received Thanks: 1,228
Quote:
Originally Posted by Dr. Coxxy View Post
php 7 ignores the salt parameter in password_hash afaik - which php version are you using?
also you should use password_verify and not == - though it shouldnt matter in your case, as youre using a custom hash.
My webserver is running php7, though I'm trying not to accomplish this with php but in C++. But I managed a workaround with webrequests, cause I've not that much time to write the support
XxharCs is offline  
Reply


Similar Threads Similar Threads
Password Encryption
06/29/2012 - CO2 Programming - 14 Replies
Here's a quick explanation on passwords and the various mechanisms used to protect them. Method 1: Plain Text Passwords The most simple way of storing a password is... well exactly as it is. What this means is that the string "password" is stored somewhere in a database in it's same human readable form "password". Whenever your credentials are entered to login a server they are verified against the database to ensure that they match. If your thinking it.. you aren't being bias at all.....
Upgrading password encryption
01/13/2011 - CO2 Private Server - 20 Replies
Might as well post it here. I'm trying to upgrade the password encryption from Hybrid's 5135 source to be used with a 5250 client but it's kinda giving me a headache. Well I'm confused. Some information: using System; using System.Collections.Generic; using System.Linq; using System.Text;
[HELP] Password encryption
12/26/2009 - CO2 Private Server - 27 Replies
What Password encryption does conquer have? i want to code register script and don`t know encryption for password,its not md5.
CO password encryption
11/30/2008 - Conquer Online 2 - 3 Replies
Was it ever released? I know it was hiding in dev section for some time but I don't know if it ever got out. If it has, a friendly link to where to? Or if not, maybe an explanation? It's quite a weird encryption at first glance. Thanks in advance. <hr>Append on Apr 6 2007, 20:50<hr> As much as people would probably not like to help out, I'm trying to get stuff going for the benefit of the community : [ I'm doing a c++ server emu and so far everything's going smooth except the password...



All times are GMT +1. The time now is 17:06.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.