Security
Headlines
HeadlinesLatestCVEs

Headline

CVE-2023-2781: class-xlwuev-woocommerce-confirmation-email-public.php in woo-confirmation-email/tags/3.5.0/public – WordPress Plugin Repository

The User Email Verification for WooCommerce plugin for WordPress is vulnerable to authentication bypass via authenticate_user_by_email in versions up to, and including, 3.5.0. This is due to a random token generation weakness in the resend_verification_email function. This allows unauthenticated attackers to impersonate users and trigger an email address verification for arbitrary accounts, including administrative accounts, and automatically be logged in as that user, including any site administrators. This requires the Allow Automatic Login After Successful Verification setting to be enabled, which it is not by default.

CVE
#csrf#js#wordpress#php#perl#auth

1<?php23if ( ! defined( ‘ABSPATH’ ) ) {4 exit; // Exit if accessed directly5}67class XLWUEV_Woocommerce_Confirmation_Email_Public {89 private static $ins = null;10 public $pl_url;11 public $my_account_id;12 private $user_id;13 private $email_id;14 public $is_checkout_page = false;15 public $user_login;16 public $user_email;17 public $is_user_verified = '’;18 public $is_user_created = false;19 public $is_notice_shown_at_order_received_page = false;20 public $is_user_already_verified = false;21 public $is_new_user_email_sent = false;22 public $is_user_made_from_myaccount_page = false;23 public $should_verification_email_be_send = true;24 public $should_notice_be_shown = true;2526 public function __construct() {27 $this->my_account = get_option( ‘woocommerce_myaccount_page_id’ );2829 if ( ‘’ === $this->my_account ) {30 $this->my_account = get_option( ‘page_on_front’ );31 }3233 $this->pl_url = untrailingslashit( plugin_dir_url( XLWUEV_PLUGIN_FILE ) );34 add_shortcode( 'wcemailverificationcode’, array( $this, ‘wc_email_verification_code’ ) );35 add_shortcode( 'wcemailverificationmessage’, array( $this, ‘wuev_shortcode_xlwuev_verification_page’ ) );36 add_action( 'woocommerce_created_customer_notification’, array( $this, ‘new_user_registration_from_registration_form’ ), 10, 3 );37 add_filter( 'woocommerce_registration_redirect’, array( $this, ‘redirect_new_user’ ) );38 add_action( 'wp’, array( $this, ‘authenticate_user_by_email’ ) );39 add_action( 'wp’, array( $this, ‘show_notification_message’ ) );40 add_action( 'wp’, array( $this, ‘resend_verification_email’ ) );41 add_action( 'wp_enqueue_scripts’, array( $this, ‘wuev_public_js’ ) );42 add_action( 'wp_login’, array( $this, ‘custom_form_login_check’ ), 10, 1 );43 add_action( 'user_register’, array( $this, ‘custom_form_user_register’ ), 10, 1 );44 add_action( 'woocommerce_checkout_update_user_meta’, array( $this, ‘new_user_registeration_from_checkout_form’ ), 10, 2 );45 add_action( 'woocommerce_checkout_process’, array( $this, ‘set_checkout_page’ ), 11, 1 );46 add_action( 'woocommerce_email_footer’, array( $this, ‘append_content_before_woocommerce_footer’ ), 9, 1 );47 add_action( 'woocommerce_register_post’, array( $this, ‘woocommerce_my_account_page’ ), 10, 1 );48 add_action( 'set_auth_cookie’, array( $this, ‘custom_form_login_check_with_cookie’ ), 10, 5 );49 add_filter( 'send_email_change_email’, array( $this, ‘unverify_user_account’ ), 99, 2 );50 }5152 public static function instance() {53 if ( null === self::$ins ) {54 self::$ins = new self;55 }5657 return self::$ins;58 }5960 /*61 * This function sets the is_user_made_from_myaccount_page to true if user is made from myaccount page of woocommerce.62 */63 public function woocommerce_my_account_page( $username ) {64 $this->is_user_made_from_myaccount_page = true;65 }6667 /**68 * This function is executed when a new user is made from the woocommerce registration form in the myaccount page.69 * Its hooked into ‘woocommerce_registration_auth_new_customer’ filter.70 *71 * @param $customer72 * @param $user_id73 *74 * @return mixed75 */76 public function new_user_registration_from_registration_form( $user_id, $new_customer_data = array(), $password_generated = false ) {77 if ( false === $this->is_new_user_email_sent && $this->should_verification_email_be_send ) {78 $this->new_user_registration( $user_id );79 $this->is_new_user_email_sent = true;80 }81 }8283 /*84 * This function is executed when a new user is made from the checkout page of the woocommerce.85 * Its hooked into ‘woocommerce_checkout_update_user_meta’ action.86 */87 public function new_user_registeration_from_checkout_form( $customer_id, $data ) {88 if ( is_array( $data ) && count( $data ) > 0 ) {89 if ( ‘0’ != $customer_id ) {90 if ( ‘1’ == $data[‘createaccount’] ) {91 if ( false === $this->is_new_user_email_sent && $this->should_verification_email_be_send ) {92 $this->new_user_registration( $customer_id );93 $this->is_new_user_email_sent = true;94 }95 }96 }97 }98 }99100 /*101 * This function sends a new verification email upon user registration from any custom registration form.102 */103 public function custom_form_user_register( $user_id ) {104 $user = get_user_by( 'id’, $user_id );105 $status = get_user_meta( (int) $user_id, 'wcemailverified’, true );106107 if ( ! is_super_admin() && ‘administrator’ !== $user->roles[0] ) {108 if ( ‘true’ !== $status ) {109 if ( false === $this->is_new_user_email_sent ) {110 if ( false === $this->is_checkout_page && false === $this->is_user_made_from_myaccount_page && $this->should_verification_email_be_send ) {111 XlWUEV_Common::$is_user_made_from_custom_form = true;112 $this->new_user_registration( $user_id );113 $this->is_new_user_email_sent = true;114 }115 }116 }117 }118 }119120 /*121 * This function is executed just after a new user is made from woocommerce registration form in myaccount page.122 * Its hooked into ‘woocommerce_registration_redirect’ filter.123 * If restrict user setting is enabled from the plugin settings screen, then this function will logs out the user.124 */125 public function redirect_new_user( $redirect ) {126 if ( true === $this->is_new_user_email_sent && false === XlWUEV_Common::$is_xlwuev_resend_link_clicked && defined( ‘WC_DOING_AJAX’ ) === false && false === is_order_received_page() ) {127 $redirect = add_query_arg( array(128 ‘xlrm’ => base64_encode( $this->user_id ),129 ), $redirect );130 $is_xlwuev_restrict_user = XlWUEV_Common::get_setting_value( 'wuev-general-settings’, ‘xlwuev_restrict_user’ );131 if ( ‘1’ == $is_xlwuev_restrict_user ) {132 wp_logout();133 }134 }135136 return $redirect;137 }138139 /*140 * This function verifies the user when the user clicks on the verification link in its email.141 * If automatic login setting is enabled in plugin setting screen, then the user is forced loggedin.142 */143 public function authenticate_user_by_email() {144145 if ( isset( $_GET[‘woo_confirmation_verify’] ) && ‘’ !== $_GET[‘woo_confirmation_verify’] ) { // WPCS: input var ok, CSRF ok.146 $user_meta = explode( '@’, base64_decode( $_GET[‘woo_confirmation_verify’] ) ); // WPCS: input var ok, CSRF ok.147 if ( ‘true’ === get_user_meta( (int) $user_meta[1], 'wcemailverified’, true ) ) {148 $this->is_user_already_verified = true;149 }150151 $verified_code = get_user_meta( (int) $user_meta[1], 'wcemailverifiedcode’, true );152153 if ( ! empty( $verified_code ) && $verified_code === $user_meta[0] ) {154 XlWUEV_Common::$wuev_user_id = (int) $user_meta[1];155 $allow_automatic_login = XlWUEV_Common::get_setting_value( 'wuev-general-settings’, ‘xlwuev_automatic_user_login’ );156157 update_user_meta( (int) $user_meta[1], 'wcemailverified’, ‘true’ );158 do_action( 'xlwuev_on_email_verification’, (int) $user_meta[1] );159160 if ( ‘1’ == $allow_automatic_login ) {161 $this->please_login_email_message();162 } elseif ( ‘2’ == $allow_automatic_login ) {163 $this->allow_automatic_login( (int) $user_meta[1] );164 $this->please_login_email_message();165 }166 }167 }168 }169170 /*171 * This function shows the notification messages based on get parameters.172 * Shows messages for new user registration, user restriction, verification success message, message in user dashboard.173 */174 public function show_notification_message() {175 if ( isset( $_GET[‘xlrm’] ) && ‘’ !== $_GET[‘xlrm’] ) { // WPCS: input var ok, CSRF ok.176 XlWUEV_Common::$wuev_user_id = base64_decode( $_GET[‘xlrm’] ); // WPCS: input var ok, CSRF ok.177 $registration_message = XlWUEV_Common::maybe_parse_merge_tags( XlWUEV_Common::get_setting_value( 'wuev-messages’, ‘xlwuev_email_registration_message’ ) );178 if ( false === wc_has_notice( $registration_message, ‘notice’ ) ) {179 wc_add_notice( $registration_message, ‘notice’ );180 }181 } elseif ( ! is_admin() && is_user_logged_in() && defined( ‘WC_DOING_AJAX’ ) === false ) {182 global $current_user;183 $user_roles = $current_user->roles;184 $user_role = array_shift( $user_roles );185186 if ( ‘customer’ === $user_role ) {187 $user_id = get_current_user_id();188 XlWUEV_Common::$wuev_user_id = $user_id;189 XlWUEV_Common::$wuev_myaccount_page_id = $this->my_account;190 $this->is_user_verified = get_user_meta( $user_id, 'wcemailverified’, true );191 $order_received_page = is_order_received_page();192 $order_pay_page = is_checkout_pay_page();193194 if ( false === $order_received_page && empty( $this->is_user_verified ) && ‘1’ == XlWUEV_Common::get_setting_value( 'wuev-general-settings’, ‘xlwuev_restrict_user’ ) ) {195 if ( false === $order_pay_page ) {196 wp_logout();197 $this->please_confirm_email_message( $user_id );198 // if not order , then redirect to myaccount page199 if ( false === $order_received_page ) {200 $redirect_url = add_query_arg( array(201 ‘xlsm’ => base64_encode( $user_id ),202 ), get_the_permalink( $this->my_account ) );203 wp_safe_redirect( $redirect_url );204 exit;205 }206 }207 }208209 if ( ‘2’ == XlWUEV_Common::get_setting_value( 'wuev-general-settings’, ‘xlwuev_restrict_user’ ) ) {210 $this->please_confirm_email_message( $user_id );211 }212213 if ( $order_received_page ) {214 $order_id = $this->get_order_id();215216 if ( ‘true’ !== $this->is_user_verified ) {217 if ( false === WC()->session->has_session() ) {218 WC()->session->set_customer_session_cookie( true );219 }220221 $this->should_notice_be_shown = apply_filters( 'xlwuev_order_details’, true, $order_id );222 $registration_message = XlWUEV_Common::maybe_parse_merge_tags( XlWUEV_Common::get_setting_value( 'wuev-messages’, ‘xlwuev_email_registration_message’ ) );223224 if ( false === wc_has_notice( $registration_message, ‘notice’ ) && $this->should_notice_be_shown ) {225 wc_add_notice( $registration_message, ‘notice’ );226 }227 }228 }229 }230 }231 if ( isset( $_GET[‘xlsm’] ) && ‘’ !== $_GET[‘xlsm’] ) { // WPCS: input var ok, CSRF ok.232 XlWUEV_Common::$wuev_user_id = base64_decode( $_GET[‘xlsm’] ); // WPCS: input var ok, CSRF ok.233 if ( false === WC()->session->has_session() ) {234 WC()->session->set_customer_session_cookie( true );235 }236 $message = XlWUEV_Common::maybe_parse_merge_tags( XlWUEV_Common::get_setting_value( 'wuev-general-settings’, ‘xlwuev_email_error_message_not_verified_outside’ ) );237 if ( false === wc_has_notice( $message, ‘notice’ ) ) {238 wc_add_notice( $message, ‘notice’ );239 }240 }241 if ( isset( $_GET[‘xlvm’] ) && ‘’ !== $_GET[‘xlvm’] ) { // WPCS: input var ok, CSRF ok.242 $success_message = XlWUEV_Common::maybe_parse_merge_tags( XlWUEV_Common::get_setting_value( 'wuev-messages’, ‘xlwuev_email_success_message’ ) );243 wc_add_notice( $success_message, ‘notice’ );244 }245 }246247 /*248 * Return order id from get parameter249 */250 public function get_order_id() {251 if ( isset( $_GET[‘order-received’] ) ) { // WPCS: input var ok, CSRF ok.252 $order_id = $_GET[‘order-received’]; // WPCS: input var ok, CSRF ok.253 } else {254 $url = $_SERVER[‘SERVER_NAME’] . $_SERVER[‘REQUEST_URI’]; // WPCS: input var ok, CSRF ok.255 $template_name = strpos( $url, ‘/order-received/’ ) === false ? ‘/view-order/’ : '/order-received/’;256 if ( strpos( $url, $template_name ) !== false ) {257 $start = strpos( $url, $template_name );258 $first_part = substr( $url, $start + strlen( $template_name ) );259 $order_id = substr( $first_part, 0, strpos( $first_part, ‘/’ ) );260 }261 }262263 return $order_id;264 }265266 /*267 * This function localizes the plugin version and plugin settings.268 */269 public function wuev_public_js() {270 wp_enqueue_script( XLWUEV_SLUG . '-custom-js’, $this->pl_url . '/assets/js/woo-confirmation-email-admin.js’, false, XLWUEV_VERSION, true );271 $wuev_version = array(272 ‘plugin_version’ => XLWUEV_VERSION,273 );274 wp_localize_script( XLWUEV_SLUG . '-custom-js’, 'xlwuev’, $wuev_version );275 wp_localize_script( XLWUEV_SLUG . '-custom-js’, 'xlwuev_settings’, preg_replace( '/\\\\/’, '’, json_encode( XlWUEV_Common::$plugin_settings ) ) );276 }277278 /**279 * This function appends the verification link to the bottom of the welcome email of woocommerce.280 *281 * @param $emailclass_object282 */283 public function append_content_before_woocommerce_footer( $emailclass_object ) {284 if ( isset( $emailclass_object->id ) && ( ‘customer_new_account’ === $emailclass_object->id ) ) {285286 $verification_email_type = XlWUEV_Common::get_setting_value( 'wuev-email-template’, ‘xlwuev_verification_type’ );287 if ( ‘2’ == XlWUEV_Common::get_setting_value( 'wuev-email-template’, ‘xlwuev_verification_method’ ) ) {288 if ( ‘2’ == $verification_email_type ) {289 $user_id = $emailclass_object->object->data->ID;290 $this->user_id = $user_id;291 XlWUEV_Common::$wuev_user_id = $user_id;292 XlWUEV_Common::$wuev_user_login = $emailclass_object->object->data->user_login;293 XlWUEV_Common::$wuev_display_name = $emailclass_object->object->data->display_name;294 XlWUEV_Common::$wuev_user_email = $emailclass_object->object->data->user_email;295 XlWUEV_Common::$wuev_myaccount_page_id = $this->my_account;296 $is_secret_code_present = get_user_meta( $user_id, 'wcemailverifiedcode’, true );297298 if ( ‘’ === $is_secret_code_present ) {299 $secret_code = md5( $user_id . time() );300 update_user_meta( $user_id, 'wcemailverifiedcode’, $secret_code );301 }302 $email_body = XlWUEV_Common::maybe_parse_merge_tags( XlWUEV_Common::get_setting_value( 'wuev-email-template’, ‘xlwuev_email_body’ ) );303 $email_body = apply_filters( 'the_content’, $email_body );304 echo $email_body;305306 if ( false === XlWUEV_Common::$is_test_email ) {307 do_action( 'xlwuev_trigger_after_email’, $emailclass_object->object->data->user_email );308 }309 }310 }311 }312 }313314 /*315 * This function gets executed from different places when ever a new user is registered or resend verifcation email is sent.316 */317 public function new_user_registration( $user_id ) {318 $current_user = get_user_by( 'id’, $user_id );319 $this->user_id = $current_user->ID;320 $this->email_id = $current_user->user_email;321 $this->user_login = $current_user->user_login;322 $this->user_email = $current_user->user_email;323 $this->is_user_created = true;324 XlWUEV_Common::$wuev_user_login = $current_user->user_login;325 XlWUEV_Common::$wuev_display_name = $current_user->display_name;326 XlWUEV_Common::$wuev_user_email = $current_user->user_email;327 XlWUEV_Common::$wuev_user_id = $current_user->ID;328 XlWUEV_Common::$wuev_myaccount_page_id = $this->my_account;329 $is_secret_code_present = get_user_meta( $this->user_id, 'wcemailverifiedcode’, true );330331 if ( ‘’ === $is_secret_code_present ) {332 $secret_code = md5( $this->user_id . time() );333 update_user_meta( $user_id, 'wcemailverifiedcode’, $secret_code );334 }335336 XlWUEV_Common::code_mail_sender( $current_user->user_email );337 $this->is_new_user_email_sent = true;338339 }340341 /*342 * This function executes just after the user logged in. If restrict user setting is enabled in the plugin settings screen, the the user is force343 * logged out.344 */345 public function custom_form_login_check( $user_login ) {346 $user = get_user_by( 'login’, $user_login );347 if ( ! is_super_admin() && ‘administrator’ !== $user->roles[0] ) {348 if ( ‘true’ !== get_user_meta( $user->ID, 'wcemailverified’, true ) ) {349 $is_force_login_enabled = XlWUEV_Common::get_setting_value( 'wuev-general-settings’, ‘xlwuev_restrict_user’ );350351 if ( ‘1’ == $is_force_login_enabled ) {352 wp_logout();353 if ( false === is_order_received_page() && false === $this->is_checkout_page ) {354 $redirect_url = add_query_arg( array(355 ‘xlsm’ => base64_encode( $user->ID ),356 ), apply_filters( 'xlwuev_custom_form_login_check_redirect_url’, get_the_permalink( $this->my_account ) ) );357 wp_safe_redirect( $redirect_url );358 exit;359 }360 }361 }362 }363 }364365 /*366 * This function executes just after if the user is force logged in. If restrict user setting is enabled in the plugin settings screen, the the user is force367 * logged out.368 */369 public function custom_form_login_check_with_cookie( $auth_cookie, $expire, $expiration, $user_id, $scheme ) {370 $order_received_page = is_order_received_page();371 $order_pay_page = is_checkout_pay_page();372 $allow_automatic_login = XlWUEV_Common::get_setting_value( 'wuev-general-settings’, ‘xlwuev_automatic_user_login’ );373374 if ( false == $order_received_page && false == $order_pay_page && ‘1’ == $allow_automatic_login ) {375 $user = get_user_by( 'ID’, $user_id );376 $user_registered_timestamp = strtotime( $user->data->user_registered );377 $current_timestamp = time();378379 if ( $current_timestamp - $user_registered_timestamp < 60 ) {380 $is_new_user = true;381 } else {382 $is_new_user = false;383 }384385 if ( ! is_super_admin() && ‘administrator’ !== $user->roles[0] ) {386 if ( ‘true’ !== get_user_meta( $user->ID, 'wcemailverified’, true ) ) {387 $is_force_login_enabled = XlWUEV_Common::get_setting_value( 'wuev-general-settings’, ‘xlwuev_restrict_user’ );388389 if ( ‘1’ == $is_force_login_enabled ) {390 wp_clear_auth_cookie();391 if ( false === is_order_received_page() && false === $this->is_checkout_page ) {392 if ( $is_new_user ) {393 $redirect_url = add_query_arg( array(394 ‘xlrm’ => base64_encode( $user->ID ),395 ), get_the_permalink( $this->my_account ) );396 } else {397 $redirect_url = add_query_arg( array(398 ‘xlsm’ => base64_encode( $user->ID ),399 ), get_the_permalink( $this->my_account ) );400 }401402 $error_validation_page = XlWUEV_Common::get_setting_value( 'wuev-general-settings’, ‘xlwuev_verification_error_page’ );403 if ( ‘2’ == $error_validation_page ) {404 $error_validation_page_id = XlWUEV_Common::get_setting_value( 'wuev-general-settings’, ‘xlwuev_verification_error_page_id’ );405 $redirect_url = add_query_arg( array(406 ‘xlsm’ => base64_encode( $user->ID ),407 ), get_the_permalink( $error_validation_page_id ) );408 }409410 wp_safe_redirect( $redirect_url );411 exit;412 }413 }414 }415 }416 }417 }418419 /*420 * This function unverifies a user’s email because the user had changed its email ID. So user has to again verify its email.421 */422423 public function unverify_user_account( $bool, $user ) {424 if ( $bool ) {425 delete_user_meta( $user[‘ID’], ‘wcemailverified’ );426 }427428 return $bool;429 }430431 /*432 * This function sets the is_checkout_page to true if the current page is woocommerce checkout page.433 */434 public function set_checkout_page() {435 $this->is_checkout_page = true;436 if ( isset( $_POST[‘payment_method’] ) && ‘’ != $_POST[‘payment_method’] ) {437 $this->should_verification_email_be_send = apply_filters( 'xlwuev_order_payment_method’, true, $_POST ); // WPCS: input var ok, CSRF ok.438 }439 }440441 /*442 * This function adds woocommerce notices.443 */444 public function please_confirm_email_message( $user_id ) {445 if ( false === WC()->session->has_session() ) {446 WC()->session->set_customer_session_cookie( true );447 }448449 if ( empty( $this->is_user_verified ) ) {450 if ( $this->is_user_created ) {451 if ( true === $this->is_checkout_page ) {452 $registration_message = XlWUEV_Common::maybe_parse_merge_tags( XlWUEV_Common::get_setting_value( 'wuev-messages’, ‘xlwuev_email_registration_message’ ) );453 if ( false === is_order_received_page() ) {454 wc_add_notice( $registration_message, ‘notice’ );455 }456 }457 } else {458 $is_xlwuev_restrict_user = XlWUEV_Common::get_setting_value( 'wuev-general-settings’, ‘xlwuev_restrict_user’ );459 $message = '’;460 if ( ‘1’ == $is_xlwuev_restrict_user ) {461 $message = XlWUEV_Common::maybe_parse_merge_tags( XlWUEV_Common::get_setting_value( 'wuev-general-settings’, ‘xlwuev_email_error_message_not_verified_outside’ ) );462463 } elseif ( ‘2’ == $is_xlwuev_restrict_user ) {464 $message = XlWUEV_Common::maybe_parse_merge_tags( XlWUEV_Common::get_setting_value( 'wuev-general-settings’, ‘xlwuev_email_error_message_not_verified_inside’ ) );465 }466 if ( ‘’ !== $message ) {467 if ( false == wc_has_notice( $message, ‘notice’ ) ) {468 wc_add_notice( $message, ‘notice’ );469 }470 }471 }472 }473 }474475 /*476 * This function shows the verification success messages.477 */478 public function please_login_email_message() {479 if ( false === WC()->session->has_session() ) {480 WC()->session->set_customer_session_cookie( true );481 }482483 $verified = get_user_meta( XlWUEV_Common::$wuev_user_id, 'wcemailverified’, true );484485 if ( ‘true’ === $verified && $this->is_user_already_verified ) {486 $already_verified_message = XlWUEV_Common::maybe_parse_merge_tags( XlWUEV_Common::get_setting_value( 'wuev-messages’, ‘xlwuev_email_verification_already_done’ ) );487 wc_add_notice( $already_verified_message, ‘notice’ );488 } else {489 $success_message = XlWUEV_Common::maybe_parse_merge_tags( XlWUEV_Common::get_setting_value( 'wuev-messages’, ‘xlwuev_email_success_message’ ) );490 if ( ‘1’ == XlWUEV_Common::get_setting_value( 'wuev-general-settings’, ‘xlwuev_verification_page’ ) ) {491 wc_add_notice( $success_message, ‘notice’ );492 } else {493 $hyperlink = add_query_arg( array(494 ‘xlvm’ => true,495 ), get_the_permalink( XlWUEV_Common::get_setting_value( 'wuev-general-settings’, ‘xlwuev_verification_page_id’ ) ) );496 wp_safe_redirect( $hyperlink );497 exit();498 }499 }500 }501502 /**503 * This function sends a new verification email to user if the user clicks on ‘resend verification email’ link.504 * If the email is already verified then it redirects to my-account page505 */506 public function resend_verification_email() {507 if ( isset( $_GET[‘wc_confirmation_resend’] ) && ‘’ !== $_GET[‘wc_confirmation_resend’] ) { // WPCS: input var ok, CSRF ok.508 $user_id = base64_decode( $_GET[‘wc_confirmation_resend’] ); // WPCS: input var ok, CSRF ok.509510 if ( false === WC()->session->has_session() ) {511 WC()->session->set_customer_session_cookie( true );512 }513514 $verified = get_user_meta( $user_id, 'wcemailverified’, true );515516 if ( ‘true’ === $verified ) {517 $already_verified_message = XlWUEV_Common::maybe_parse_merge_tags( XlWUEV_Common::get_setting_value( 'wuev-messages’, ‘xlwuev_email_verification_already_done’ ) );518 wc_add_notice( $already_verified_message, ‘notice’ );519 } else {520 XlWUEV_Common::$wuev_user_id = $user_id;521 XlWUEV_Common::$wuev_myaccount_page_id = $this->my_account;522 XlWUEV_Common::$is_xlwuev_resend_link_clicked = true;523 $this->new_user_registration( $user_id );524 $new_verification_link = XlWUEV_Common::maybe_parse_merge_tags( XlWUEV_Common::get_setting_value( 'wuev-messages’, ‘xlwuev_email_new_verification_link’ ) );525 wc_add_notice( $new_verification_link, ‘notice’ );526 }527 }528 }529530 /**531 * This function generates the verification link from the shortocde [wcemailverificationcode] and returns the link.532 * @return string533 */534 public function wc_email_verification_code() {535 $secret = get_user_meta( $this->user_id, 'wcemailverifiedcode’, true );536 $create_link = $secret . ‘@’ . $this->user_id;537 $hyperlink = add_query_arg( array(538 ‘woo_confirmation_verify’ => base64_encode( $create_link ),539 ), get_the_permalink( $this->my_account ) );540 $link_text = XlWUEV_Common::maybe_parse_merge_tags( XlWUEV_Common::get_setting_value( 'wuev-messages’, ‘xlwuev_email_new_verification_link_text’ ) );541 $link = ‘<a href="’ . $hyperlink . ‘">’ . $link_text . '</a>’;542543 return $link;544 }545546 /**547 * This function adds the verification message on the custom verification page selected by the admin under misc settings tab of the plugin.548 */549 public function wuev_shortcode_xlwuev_verification_page() {550 if ( isset( $_GET[‘xlvm’] ) && ‘’ != $_GET[‘xlvm’] ) { // WPCS: input var ok, CSRF ok.551 if ( false === WC()->session->has_session() ) {552 WC()->session->set_customer_session_cookie( true );553 }554 wc_add_notice( __( XlWUEV_Common::get_setting_value( 'wuev-messages’, ‘xlwuev_email_success_message’ ), ‘woo-confirmation-email’ ), ‘notice’ );555 }556 }557558 /**559 * @param mixed $user_id560 */561 public function set_user_id( $user_id ) {562 $this->user_id = $user_id;563 }564565 /*566 * This function force login a user.567 */568 public function allow_automatic_login( $user_id ) {569 wp_clear_auth_cookie();570 wp_set_current_user( $user_id );571 wp_set_auth_cookie( $user_id );572 }573}574575XLWUEV_Woocommerce_Confirmation_Email_Public::instance();

CVE: Latest News

CVE-2023-50976: Transactions API Authorization by oleiman · Pull Request #14969 · redpanda-data/redpanda
CVE-2023-6905
CVE-2023-6903
CVE-2023-6904
CVE-2023-3907