Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/wp-abstracts-manuscripts-manager/abstracts/abstracts.settings.php
+++ b/wp-abstracts-manuscripts-manager/abstracts/abstracts.settings.php
@@ -545,8 +545,8 @@
// Send updated order to the server
jQuery.post(wpabstracts.ajaxurl, {
action: 'reorder_admin_columns',
+ nonce: wpabstracts.admin_nonce,
order: order,
- nonce: wpabstracts.nonce,
}).done(function(response) {
if (response.success) {
alertify.customSuccess(wpabstracts.sort_success);
--- a/wp-abstracts-manuscripts-manager/events/events.topics.php
+++ b/wp-abstracts-manuscripts-manager/events/events.topics.php
@@ -135,8 +135,8 @@
// Send updated order to the server
jQuery.post(wpabstracts.ajaxurl, {
action: 'reorder_topics',
+ nonce: wpabstracts.admin_nonce,
order: order,
- nonce: wpabstracts.nonce,
}).done(function(response) {
if (response.success) {
alertify.customSuccess(wpabstracts.sort_success);
--- a/wp-abstracts-manuscripts-manager/inc/wpabstracts_functions.php
+++ b/wp-abstracts-manuscripts-manager/inc/wpabstracts_functions.php
@@ -801,7 +801,8 @@
$message .= __('Someone requested a password reset for ', 'wpabstracts') . '<strong>' . $user_data->user_login . '</strong>' . ' at ' . get_option('blogname') . "<br><br>";
$message .= __('If this was a mistake, simply ignore this email and nothing will happen.', 'wpabstracts') . "<br><br>";
$message .= __('To reset your password, visit the following link:', 'wpabstracts') . "<br><br>";
- $message .= wpabstracts_get_dashboard() . "?task=resetpassword&key=$key&login=" . $user_data->user_login . "<br><br>";
+ $reset_url = add_query_arg(array('task' => 'resetpassword', 'key' => rawurlencode($key), 'login' => rawurlencode($user_data->user_login)), wpabstracts_get_dashboard());
+ $message .= '<a href="' . esc_url($reset_url) . '">' . esc_html($reset_url) . '</a>' . "<br><br>";
$title = __('Password Reset for ', 'wpabstracts') . get_option('blogname');
$message = apply_filters('retrieve_password_message', $message, $key, $user_data->user_login, $user_data);
@@ -856,7 +857,7 @@
if (is_wp_error($user)) {
$results->success = 0;
- $results->message = __('Invalid password reset key. Please request a new password reset.', 'wpabstracts');
+ $results->message = __('This password reset link has expired or was replaced by a newer one. Please use the link in the most recent email, or request a new password reset.', 'wpabstracts');
} else {
reset_password($user, $password);
$results->success = 1;
@@ -869,13 +870,7 @@
add_action('wp_ajax_wpabs_save_regform', 'wpabstracts_user_save_regform');
function wpabstracts_user_save_regform()
{
- if (!wpabstracts_verify_nonce($_POST['nonce'])) {
- wp_send_json_error([
- 'message' => 'Unable to process your request. Please reload the page and try again.',
- 'error_code' => 'invalid_nonce',
- ]);
- wp_die();
- }
+ wpabstracts_verify_admin_ajax();
$form_data = stripslashes($_POST['form_data']);
update_option('wpabstracts_registration_form', $form_data);
wp_send_json_success(['message' => __("Successfully updated user registration form.", 'wpabstracts')]);
@@ -1133,11 +1128,16 @@
function wpabstracts_sync_wpfields($user_data, $user_id)
{
$form_fields = json_decode(get_option('wpabstracts_registration_form'));
+ // Only the profile fields the form builder offers may be written, never
+ // roles, capabilities or other account data.
+ $sync_fields = apply_filters('wpabstracts_sync_wp_fields', array('first_name', 'last_name', 'nickname', 'address', 'user_url', 'description'));
+ $sync_fields = array_diff($sync_fields, array('wp_capabilities', 'wp_user_level', $GLOBALS['wpdb']->prefix . 'capabilities', $GLOBALS['wpdb']->prefix . 'user_level'));
// sync user meta
foreach ($user_data as $field_name => $field_value) {
$user_field = wpabstracts_get_user_field_record($form_fields, $field_name);
- if ($user_field && property_exists((object)$user_field, 'wpSync')) {
- update_user_meta($user_id, $user_field->wpSync, $field_value);
+ if ($user_field && property_exists((object)$user_field, 'wpSync') && in_array($user_field->wpSync, $sync_fields, true) && is_scalar($field_value)) {
+ $value = 'description' === $user_field->wpSync ? sanitize_textarea_field($field_value) : ('user_url' === $user_field->wpSync ? esc_url_raw($field_value) : sanitize_text_field($field_value));
+ update_user_meta($user_id, $user_field->wpSync, $value);
}
}
// sync display name
@@ -1308,6 +1308,19 @@
return $wpdb->get_results($sql);
}
+// Admin-only AJAX actions: the caller must manage WP Abstracts and send the
+// admin nonce, which is only ever given to administrators.
+function wpabstracts_verify_admin_ajax()
+{
+ $nonce = isset($_POST['nonce']) ? sanitize_text_field(wp_unslash($_POST['nonce'])) : '';
+ if (!current_user_can('manage_options') || !wp_verify_nonce($nonce, 'wpabstracts_admin_ajax')) {
+ wp_send_json_error([
+ 'message' => __('You do not have permission to perform this action.', 'wpabstracts'),
+ 'error_code' => 'forbidden',
+ ], 403);
+ }
+}
+
// utility function to validate a nonce
function wpabstracts_verify_nonce($nonce)
{
--- a/wp-abstracts-manuscripts-manager/wpabstracts.php
+++ b/wp-abstracts-manuscripts-manager/wpabstracts.php
@@ -3,7 +3,7 @@
Plugin Name: WP Abstracts
Plugin URI: http://www.wpabstracts.com
Description: Allow abstracts submissions on your site. Manage everything from events, abstracts, authors, reviews, attachments, notifications and more.
-Version: 2.7.6
+Version: 2.7.7
Author: Kevon Adonis
Author URI: http://www.kevonadonis.com
Tags: wp abstracts, abstracts, manuscripts, wordpress conference plugin, wpabstracts, peer review, submission management, conference
@@ -13,7 +13,7 @@
defined('ABSPATH') or die("ERROR: You do not have permission to access this page");
define('WPABSTRACTS_ACCESS_LEVEL', 'manage_options');
define('WPABSTRACTS_PLUGIN_DIR', dirname(__FILE__) . '/');
-define('WPABSTRACTS_VERSION', '2.7.6');
+define('WPABSTRACTS_VERSION', '2.7.7');
define('WPABSTRACTS_SECRET_KEY', '5a22d6e80bf870.68089106');
register_activation_hook(__FILE__, 'wpabstracts_install');
register_deactivation_hook(__FILE__, 'wpabstracts_deactivation');
@@ -837,6 +837,7 @@
$data = array(
'ajaxurl' => admin_url('admin-ajax.php', $schema),
'nonce' => wp_create_nonce(WPABSTRACTS_SECRET_KEY),
+ 'admin_nonce' => current_user_can('manage_options') ? wp_create_nonce('wpabstracts_admin_ajax') : '',
'confirm_abstract_delete' => __('Do you really want to delete this abstract, its reviews and all its attachments?', 'wpabstracts'),
'confirm_abstracts_delete' => __('Do you really want to delete the selected abstracts, their reviews and all their attachments?', 'wpabstracts'),
'confirm_event_delete' => __('Are you sure you want to delete this event? Deleting this event will delete all submissions, reviews and attachments related to this event. This cannot be undone. Type DELETE to confirm.', 'wpabstracts'),
@@ -884,6 +885,7 @@
add_action('wp_ajax_loadreviewers', 'wpabstracts_load_reviewers_ajax');
function wpabstracts_load_reviewers_ajax()
{
+ wpabstracts_verify_admin_ajax();
require_once(apply_filters('wpabstracts_page_include', WPABSTRACTS_PLUGIN_DIR . 'abstracts/abstracts.manage.php'));
wpabstracts_load_reviewers();
}
@@ -891,13 +893,7 @@
add_action('wp_ajax_loadstatus', 'wpabstracts_load_status_ajax');
function wpabstracts_load_status_ajax()
{
- if (!wpabstracts_verify_nonce($_POST['nonce'])) {
- wp_send_json_error([
- 'message' => 'Unable to process your request. Please reload the page and try again.',
- 'error_code' => 'invalid_nonce',
- ], 403);
- wp_die();
- }
+ wpabstracts_verify_admin_ajax();
require_once apply_filters('wpabstracts_page_include', WPABSTRACTS_PLUGIN_DIR . 'abstracts/abstracts.manage.php');
$html = wpabstracts_load_status();
wp_send_json_success($html);
@@ -935,13 +931,7 @@
add_action('wp_ajax_reorder_topics', 'wpabstracts_reorder_topics');
function wpabstracts_reorder_topics()
{
- if (!wpabstracts_verify_nonce($_POST['nonce'])) {
- wp_send_json_error([
- 'message' => 'Unable to process your request. Please reload the page and try again.',
- 'error_code' => 'invalid_nonce',
- ], 403);
- wp_die();
- }
+ wpabstracts_verify_admin_ajax();
if (!isset($_POST['order']) || !is_array($_POST['order'])) {
wp_send_json_error(['message' => __('Invalid order data.', 'wpabstracts')]);
@@ -966,13 +956,7 @@
add_action('wp_ajax_reorder_admin_columns', 'wpabstracts_reorder_admin_columns');
function wpabstracts_reorder_admin_columns()
{
- if (!wpabstracts_verify_nonce($_POST['nonce'])) {
- wp_send_json_error([
- 'message' => 'Unable to process your request. Please reload the page and try again.',
- 'error_code' => 'invalid_nonce',
- ], 403);
- wp_die();
- }
+ wpabstracts_verify_admin_ajax();
if (!current_user_can('manage_options')) {
wp_send_json_error(array('message' => __('You do not have permission to perform this action.', 'wpabstracts')));
@@ -1029,5 +1013,6 @@
add_action('wp_ajax_wpamaillog', 'wpabstracts_maillog_ajax');
function wpabstracts_maillog_ajax()
{
+ wpabstracts_verify_admin_ajax();
wpabstracts_get_maillog();
}