Welcome Guest, Not a member yet? Register   Sign In
phpass HAVE BEEN CRACKED! What is the solution?
#54

[eluser]WanWizard[/eluser]
The salt is stored in the user record at the moment, it is generated when the user record is created, or regenerated when the user changes the password.

We thought about storing the salt elsewhere, but imho the benifit is negligible, if a hacker can get in to the level that he has access to the database tables, he probably has access to all other data as well...

This is the code used in the local authentication module of ExiteCMS:
Code:
// attempt to get the user info
$user = $this->fetch( array('name' => set_value('auth_local_username') ) );

// a user found? then use the salt (if present) and check the password
if ( $user->id )
{
    // check if this is an MD5 or SHA1 password hash
    if ( strlen($user->password) == 32 )
    {
        if ( ! empty($user->password_salt) )
        {
            // encode the password
            $password = md5(md5(set_value('auth_local_password')).$user->password_salt);
        }
        else
        {
            // encode the password
            $password = md5(md5(set_value('auth_local_password')));
        }
    }
    else
    {
        if ( ! empty($user->password_salt) )
        {
            // encode the password
            $password = sha1(set_value('auth_local_password').$user->password_salt);
        }
        else
        {
            // encode the password
            $password = sha1(set_value('auth_local_password'));
        }
    }

    // does the encoded password match?
    if ( $password === $user->password )
    {
        // update the password to a SHA1 hashed password if needed
        if ( strlen($user->password) == 32 )
        {
            // generate a random salt for this password
            $user->password_salt = md5(microtime(TRUE));

            // create the new password hash
            $user->password = sha1(set_value('auth_local_password').$user->password_salt);
        }

        // we have a valid login. update the last_visit timestamp
        $user->lastvisit = now();
        $user->save();
    }
    else
    {
        // no match
        $user = $this->rbac->library->rbac->_dummy_user('guest');
    }
}

// user record found?
if ( ! $user->id )
{
    // no. logon failed, show an error message and signal failure
    $this->exitecms->message( $this->self->lang->line('authentication_account_unknown'), MSG_ERROR );
}


Messages In This Thread
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 10:13 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 10:26 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 10:36 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 11:03 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 11:07 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 11:21 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 12:05 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 12:06 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 12:09 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 12:13 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 12:26 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 12:32 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 12:47 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 12:49 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 12:54 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 01:09 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 01:15 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 04:33 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 06:10 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 06:37 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 08:00 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 08:18 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 09:52 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 11:10 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 11:19 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-16-2009, 11:39 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-17-2009, 01:38 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-17-2009, 02:37 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-17-2009, 07:31 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-17-2009, 07:35 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-17-2009, 07:44 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-17-2009, 07:55 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-17-2009, 08:51 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-17-2009, 08:53 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-18-2009, 12:30 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-18-2009, 01:00 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-18-2009, 01:17 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-18-2009, 01:20 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-18-2009, 08:21 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-18-2009, 09:30 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-18-2009, 01:47 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-18-2009, 02:01 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-18-2009, 03:42 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-18-2009, 03:52 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-18-2009, 04:34 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-18-2009, 07:40 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 10-03-2010, 08:50 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 10-03-2010, 12:32 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 10-03-2010, 01:03 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 10-03-2010, 03:52 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 10-03-2010, 04:01 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 10-04-2010, 12:53 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 10-04-2010, 01:10 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 10-04-2010, 02:54 AM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 04-06-2011, 07:58 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 04-13-2011, 02:54 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 04-13-2011, 04:10 PM
phpass HAVE BEEN CRACKED! What is the solution? - by El Forum - 06-21-2012, 08:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB