Harden HMAC verification. props duck_. [28053] for 3.7.
Built from https://develop.svn.wordpress.org/branches/3.7@28055 git-svn-id: http://core.svn.wordpress.org/branches/3.7@27885 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ab7e094de3
commit
4932c36533
|
@ -546,7 +546,7 @@ function wp_validate_auth_cookie($cookie = '', $scheme = '') {
|
||||||
$key = wp_hash($username . $pass_frag . '|' . $expiration, $scheme);
|
$key = wp_hash($username . $pass_frag . '|' . $expiration, $scheme);
|
||||||
$hash = hash_hmac('md5', $username . '|' . $expiration, $key);
|
$hash = hash_hmac('md5', $username . '|' . $expiration, $key);
|
||||||
|
|
||||||
if ( $hmac != $hash ) {
|
if ( hash_hmac( 'md5', $hmac, $key ) !== hash_hmac( 'md5', $hash, $key ) ) {
|
||||||
do_action('auth_cookie_bad_hash', $cookie_elements);
|
do_action('auth_cookie_bad_hash', $cookie_elements);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue