From cd0d7d699d6d91a899ef414ae826b249d4c96d30 Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Wed, 30 Mar 2016 14:50:48 +0000 Subject: [PATCH] Multisite: Validate new email address confirmations. Merge of [37103] to the 4.1 branch. Built from https://develop.svn.wordpress.org/branches/4.1@37107 git-svn-id: http://core.svn.wordpress.org/branches/4.1@37074 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/user-edit.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wp-admin/user-edit.php b/wp-admin/user-edit.php index fb614cbd43..e80a1254d8 100644 --- a/wp-admin/user-edit.php +++ b/wp-admin/user-edit.php @@ -99,7 +99,7 @@ if ( is_multisite() // Execute confirmed email change. See send_confirmation_on_profile_email(). if ( is_multisite() && IS_PROFILE_PAGE && isset( $_GET[ 'newuseremail' ] ) && $current_user->ID ) { $new_email = get_option( $current_user->ID . '_new_email' ); - if ( $new_email[ 'hash' ] == $_GET[ 'newuseremail' ] ) { + if ( $new_email && hash_equals( $new_email[ 'hash' ], $_GET[ 'newuseremail' ] ) ) { $user = new stdClass; $user->ID = $current_user->ID; $user->user_email = esc_html( trim( $new_email[ 'newemail' ] ) ); @@ -110,7 +110,8 @@ if ( is_multisite() && IS_PROFILE_PAGE && isset( $_GET[ 'newuseremail' ] ) && $c wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) ); die(); } -} elseif ( is_multisite() && IS_PROFILE_PAGE && !empty( $_GET['dismiss'] ) && $current_user->ID . '_new_email' == $_GET['dismiss'] ) { +} elseif ( is_multisite() && IS_PROFILE_PAGE && !empty( $_GET['dismiss'] ) && $current_user->ID . '_new_email' === $_GET['dismiss'] ) { + check_admin_referer( 'dismiss-' . $current_user->ID . '_new_email' ); delete_option( $current_user->ID . '_new_email' ); wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) ); die(); @@ -413,7 +414,7 @@ if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_c $new_email = get_option( $current_user->ID . '_new_email' ); if ( $new_email && $new_email['newemail'] != $current_user->user_email && $profileuser->ID == $current_user->ID ) : ?>
-

%1$s. Cancel'), $new_email['newemail'], esc_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ) ) ); ?>

+

%1$s. Cancel'), esc_html( $new_email['newemail'] ), esc_url( wp_nonce_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ), 'dismiss-' . $current_user->ID . '_new_email' ) ) ); ?>