Make WordPress Core

Changeset 10486


Ignore:
Timestamp:
02/03/2009 05:03:16 AM (17 years ago)
Author:
ryan
Message:

Seed cookie hash key with a fragment from the password hash

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/pluggable.php

    r10469 r10486  
    489489    }
    490490
    491     $key = wp_hash($username . '|' . $expiration, $scheme);
    492     $hash = hash_hmac('md5', $username . '|' . $expiration, $key);
    493 
    494     if ( $hmac != $hash ) {
    495         do_action('auth_cookie_bad_hash', $cookie_elements);
    496         return false;
    497     }
    498 
    499491    $user = get_userdatabylogin($username);
    500492    if ( ! $user ) {
     
    503495    }
    504496
     497    $pass_frag = substr($user->user_pass, 8, 4);
     498
     499    $key = wp_hash($username . $pass_frag . '|' . $expiration, $scheme);
     500    $hash = hash_hmac('md5', $username . '|' . $expiration, $key);
     501
     502    if ( $hmac != $hash ) {
     503        do_action('auth_cookie_bad_hash', $cookie_elements);
     504        return false;
     505    }
     506
    505507    do_action('auth_cookie_valid', $cookie_elements, $user);
    506508
     
    525527    $user = get_userdata($user_id);
    526528
    527     $key = wp_hash($user->user_login . '|' . $expiration, $scheme);
     529    $pass_frag = substr($user->user_pass, 8, 4);
     530
     531    $key = wp_hash($user->user_login . $pass_frag . '|' . $expiration, $scheme);
    528532    $hash = hash_hmac('md5', $user->user_login . '|' . $expiration, $key);
    529533
Note: See TracChangeset for help on using the changeset viewer.