From 78c7ec883db958c7c05f5a08eb6277eb278e2399 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Wed, 29 Nov 2017 16:21:34 +0000 Subject: [PATCH] Hardening: Use a properly generated hash for the `newbloguser` key instead of a determinate substring. Merges [42258] to the 4.6 branch. Built from https://develop.svn.wordpress.org/branches/4.6@42276 git-svn-id: http://core.svn.wordpress.org/branches/4.6@42105 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/user-new.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-admin/user-new.php b/wp-admin/user-new.php index 42732434a1..a6e197de5f 100644 --- a/wp-admin/user-new.php +++ b/wp-admin/user-new.php @@ -70,7 +70,7 @@ if ( isset($_REQUEST['action']) && 'adduser' == $_REQUEST['action'] ) { add_existing_user_to_blog( array( 'user_id' => $user_id, 'role' => $_REQUEST[ 'role' ] ) ); $redirect = add_query_arg( array( 'update' => 'addnoconfirmation' , 'user_id' => $user_id ), 'user-new.php' ); } else { - $newuser_key = substr( md5( $user_id ), 0, 5 ); + $newuser_key = wp_generate_password( 20, false ); add_option( 'new_user_' . $newuser_key, array( 'user_id' => $user_id, 'email' => $user_details->user_email, 'role' => $_REQUEST[ 'role' ] ) ); $roles = get_editable_roles();