Ticket #13655: stripslash-passwords.patch
File stripslash-passwords.patch, 3.7 KB (added by , 15 years ago) |
---|
-
wp-includes/user.php
27 27 if ( ! empty($_POST['log']) ) 28 28 $credentials['user_login'] = $_POST['log']; 29 29 if ( ! empty($_POST['pwd']) ) 30 $credentials['user_password'] = $_POST['pwd'];30 $credentials['user_password'] = stripslashes($_POST['pwd']); 31 31 if ( ! empty($_POST['rememberme']) ) 32 32 $credentials['remember'] = $_POST['rememberme']; 33 33 } -
wp-includes/pluggable.php
1460 1460 function wp_check_password($password, $hash, $user_id = '') { 1461 1461 global $wp_hasher; 1462 1462 1463 /* 1464 * For a long time WordPress did not stripslash() passwords in $_POST. 1465 * To handle password hashes created during that time we must therefore 1466 * also check against addslashed passwords and update hash on match. 1467 */ 1468 1463 1469 // If the hash is still md5... 1464 1470 if ( strlen($hash) <= 32 ) { 1465 1471 $check = ( $hash == md5($password) ); 1472 if (!$check) 1473 $check = ( $hash == md5(addslashes($password)) ); 1466 1474 if ( $check && $user_id ) { 1467 1475 // Rehash using new hash. 1468 1476 wp_set_password($password, $user_id); … … 1482 1490 1483 1491 $check = $wp_hasher->CheckPassword($password, $hash); 1484 1492 1493 // Also check using slashed password, and migrate if necessary 1494 if ( !$check && $user_id ) { 1495 $check = $wp_hasher->CheckPassword(addslashes($password), $hash); 1496 if ( $check ) { 1497 // Rehash with correct password 1498 wp_set_password($password, $user_id); 1499 $hash = wp_hash_password($password); 1500 } 1501 } 1502 1485 1503 return apply_filters('check_password', $check, $password, $hash, $user_id); 1486 1504 } 1487 1505 endif; -
wp-admin/includes/user.php
70 70 71 71 $pass1 = $pass2 = ''; 72 72 if ( isset( $_POST['pass1'] )) 73 $pass1 = $_POST['pass1'];73 $pass1 = stripslashes($_POST['pass1']); 74 74 if ( isset( $_POST['pass2'] )) 75 $pass2 = $_POST['pass2'];75 $pass2 = stripslashes($_POST['pass2']); 76 76 77 77 if ( isset( $_POST['role'] ) && current_user_can( 'edit_users' ) ) { 78 78 $new_role = sanitize_text_field( $_POST['role'] ); … … 148 148 } 149 149 150 150 /* Check for "\" in password */ 151 if ( false !== strpos( stripslashes($pass1), "\\" ) )151 if ( false !== strpos( $pass1, "\\" ) ) 152 152 $errors->add( 'pass', __( '<strong>ERROR</strong>: Passwords may not contain the character "\\".' ), array( 'form-field' => 'pass1' ) ); 153 153 154 154 /* checking the password has been typed twice the same */ -
wp-admin/install.php
183 183 // Fill in the data we gathered 184 184 $weblog_title = isset( $_POST['weblog_title'] ) ? trim( stripslashes( $_POST['weblog_title'] ) ) : ''; 185 185 $user_name = isset($_POST['user_name']) ? trim( stripslashes( $_POST['user_name'] ) ) : 'admin'; 186 $admin_password = isset($_POST['admin_password']) ? $_POST['admin_password']: '';187 $admin_password_check = isset($_POST['admin_password2']) ? $_POST['admin_password2']: '';186 $admin_password = isset($_POST['admin_password']) ? trim( stripslashes( $_POST['admin_password'] ) ) : ''; 187 $admin_password_check = isset($_POST['admin_password2']) ? trim( stripslashes( $_POST['admin_password2'] ) ) : ''; 188 188 $admin_email = isset( $_POST['admin_email'] ) ?trim( stripslashes( $_POST['admin_email'] ) ) : ''; 189 189 $public = isset( $_POST['blog_public'] ) ? (int) $_POST['blog_public'] : 0; 190 190 // check e-mail address