ShopLentor - WooCommerce Builder for Elementor & Gutenberg <= 3.3.8 - Authenticated (Contributor+) Stored Cross-Site Scripting via Product Grid 'blockUniqId' Block Attribute
Description
The ShopLentor - WooCommerce Builder for Elementor & Gutenberg plugin for WordPress is vulnerable to Stored Cross-Site Scripting via the 'blockUniqId' block attribute in multiple Product Gride blocks in versions up to, and including, 3.3.8 due to insufficient input sanitization and output escaping. This makes it possible for authenticated attackers, with contributor-level access and above, 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:L/UI:R/S:C/C:L/I:L/A:NTechnical Details
<=3.3.8What Changed in the Fix
Changes introduced in v3.3.9
Source Code
WordPress.org SVNThis research plan outlines the steps required to demonstrate a Stored Cross-Site Scripting (XSS) vulnerability in the ShopLentor plugin for WordPress. This vulnerability allows an authenticated attacker with Contributor-level permissions or higher to inject malicious scripts into pages via the `blo…
Show full research plan
This research plan outlines the steps required to demonstrate a Stored Cross-Site Scripting (XSS) vulnerability in the ShopLentor plugin for WordPress. This vulnerability allows an authenticated attacker with Contributor-level permissions or higher to inject malicious scripts into pages via the blockUniqId attribute of ShopLentor's Product Grid Gutenberg blocks.
1. Vulnerability Summary
- Vulnerability: Authenticated (Contributor+) Stored Cross-Site Scripting (XSS)
- ID: CVE-2026-6287
- Plugin: ShopLentor – All-in-One WooCommerce Growth & Store Enhancement Plugin (slug:
woolentor-addons) - Affected Attribute:
blockUniqIdwithin Gutenberg blocks (e.g., Product Grid). - Cause: The plugin fails to sanitize or escape the
blockUniqIdattribute before rendering it in the HTML output. This attribute is intended to be a unique identifier (likely for CSS/JS targeting) but can be manipulated by an attacker to include script tags.
2. Attack Vector Analysis
- Endpoint: WordPress REST API for posts (
/wp-json/wp/v2/posts) or the standard Gutenberg editor flow. - Authentication: Requires a user with at least
Contributorrole (to create/edit posts). - Vulnerable Parameter: The
post_contentfield containing a Gutenberg block comment with a maliciousblockUniqIdattribute. - Payload Location: Inside the JSON attributes of the ShopLentor block (e.g.,
<!-- wp:woolentor/product-grid {"blockUniqId":"PAYLOAD"} /-->).
3. Code Flow
- Entry Point: An attacker creates or updates a post containing a ShopLentor Gutenberg block (e.g.,
woolentor/product-grid). The attributes of this block are stored in thepost_content. - Processing: When the post is viewed, WordPress parses the
post_content. The ShopLentor plugin registers arender_callbackfor its blocks. - Sink: The PHP rendering logic (likely found in the block registration files under
includes/gutenberg/- not provided in the snippet but inferred) retrieves theblockUniqIdattribute. It then echoes this value directly into the HTML, likely as anidattribute or within a script/style block, without using functions likeesc_attr()oresc_js(). - Execution: The payload is rendered in the victim's browser (e.g., an administrator viewing the post), leading to script execution.
4. Nonce Acquisition Strategy
To save a post via the REST API or the Gutenberg editor flow, a wp_rest nonce is required.
- Navigate to Editor: Log in as a Contributor and navigate to the "New Post" page:
/wp-admin/post-new.php. - Extract Nonce: Use
browser_evalto extract the REST nonce from the WordPress global settings object.- JavaScript Variable:
window.wpApiSettings.nonce
- JavaScript Variable:
- Alternative Nonce: If using the standard AJAX autosave, the
_wpnoncecan be found inwindow.heartbeatSettings.nonce.
5. Exploitation Strategy
- Authentication: Authenticate as a
Contributoruser. - Nonce Retrieval: Navigate to
/wp-admin/post-new.phpand extract thewp_restnonce usingbrowser_eval("wpApiSettings.nonce"). - Identify Block Name: Based on common ShopLentor naming conventions, the block is likely
woolentor/product-grid. - Payload Construction:
- Construct a block comment:
<!-- wp:woolentor/product-grid {"blockUniqId":"\"><script>alert(document.domain)</script>"} /--> - This payload attempts to break out of an
idattribute (e.g.,<div id="..."><script>...</script>">).
- Construct a block comment:
- Inject Payload: Send a POST request to
/wp-json/wp/v2/poststo create a new post.- Method:
POST - Headers:
X-WP-Nonce: [EXTRACTED_REST_NONCE]Content-Type: application/json
- Body:
{ "title": "ShopLentor XSS Test", "content": "<!-- wp:woolentor/product-grid {\"blockUniqId\":\"\\\"><script>alert(document.domain)</script>\"} /-->", "status": "publish" }
- Method:
- Trigger XSS: Obtain the URL of the created post and navigate to it. The script should execute immediately.
6. Test Data Setup
- Role: Ensure a user with the
Contributorrole exists. - Plugin State: ShopLentor version <= 3.3.8 must be active.
- Environment: A standard WordPress installation with WooCommerce (as ShopLentor is a WooCommerce builder).
7. Expected Results
- The REST API should return a
201 Createdstatus code. - When viewing the post frontend, the HTML source should contain the unescaped script tag.
- A JavaScript alert box showing the document domain should appear.
8. Verification Steps
- Check Post Content: Use WP-CLI to verify the payload is stored correctly:
wp post list --post_type=post(find the ID)wp post get [ID] --field=post_content
- Check HTML Output: Use the
http_requesttool to fetch the post URL and search for the raw payload:- Look for
<script>alert(document.domain)</script>in the response body.
- Look for
- Confirm Lack of Escaping: Verify that the rendered HTML looks like:
<div id="[PREVIOUS_HTML]\"><script>alert(document.domain)</script>" ...>
9. Alternative Approaches
- Other Blocks: If
woolentor/product-gridis patched or behaves differently, try other Product Grid variants likewoolentor/product-grid-modern. - Attribute Breakout: If the
blockUniqIdis rendered inside a JavaScript block (e.g.,var config = {"id": "blockUniqId"};), use a payload like:"; alert(1); //. - UI-Based Injection: If the REST API is restricted, use the
browser_typetool to manually enter the payload into the "Unique ID" field in the Gutenberg block settings sidebar for the Product Grid block.
Summary
The ShopLentor plugin for WordPress is vulnerable to Stored Cross-Site Scripting (XSS) via the 'blockUniqId' attribute (mapped to 'grid_id' in PHP) in several Product Grid components. Authenticated attackers with Contributor-level permissions or higher can inject malicious scripts that execute in the browser of any user viewing the affected page due to missing output escaping.
Vulnerable Code
// includes/addons/product-grid/base/class.product-grid-base.php:538 echo '<button class="woolentor-load-more-btn" data-complete-loadtxt="'.esc_attr( $settings['load_more_complete_text'] ).'" data-grid-id="'.$settings['grid_id'].'" data-page="' . ( $current_page + 1 ) . '" data-max-pages="' . $total_pages . '">'; --- // includes/addons/product-grid/base/class.product-grid-base.php:541 echo '<button class="woolentor-load-more-btn" data-complete-loadtxt="'.esc_attr( $settings['load_more_complete_text'] ).'" data-grid-id="'.$settings['grid_id'].'" data-page="' . ( $current_page + 1 ) . '" data-max-pages="' . $total_pages . '" disabled="true">'; --- // includes/addons/product-grid/base/class.product-grid-base.php:548 case 'infinite': echo '<div class="woolentor-infinite-scroll" data-grid-id="'.$settings['grid_id'].'" data-page="' . ( $current_page + 1 ) . '" data-max-pages="' . $total_pages . '">';
Security Fix
@@ -535,18 +535,18 @@ case 'load_more': if ( $current_page < $total_pages ) { echo '<button class="woolentor-ajax-loader"><span class="spinner"></span></button>'; - echo '<button class="woolentor-load-more-btn" data-complete-loadtxt="'.esc_attr( $settings['load_more_complete_text'] ).'" data-grid-id="'.$settings['grid_id'].'" data-page="' . ( $current_page + 1 ) . '" data-max-pages="' . $total_pages . '">'; + echo '<button class="woolentor-load-more-btn" data-complete-loadtxt="'.esc_attr( $settings['load_more_complete_text'] ).'" data-grid-id="'.esc_attr( $settings['grid_id'] ).'" data-page="' . ( $current_page + 1 ) . '" data-max-pages="' . $total_pages . '">'; echo esc_html( $settings['load_more_text'] ); echo '</button>'; }else{ - echo '<button class="woolentor-load-more-btn" data-complete-loadtxt="'.esc_attr( $settings['load_more_complete_text'] ).'" data-grid-id="'.$settings['grid_id'].'" data-page="' . ( $current_page + 1 ) . '" data-max-pages="' . $total_pages . '" disabled="true">'; + echo '<button class="woolentor-load-more-btn" data-complete-loadtxt="'.esc_attr( $settings['load_more_complete_text'] ).'" data-grid-id="'.esc_attr( $settings['grid_id'] ).'" data-page="' . ( $current_page + 1 ) . '" data-max-pages="' . $total_pages . '" disabled="true">'; echo esc_html( $settings['load_more_complete_text'] ); echo '</button>'; } break; case 'infinite': - echo '<div class="woolentor-infinite-scroll" data-grid-id="'.$settings['grid_id'].'" data-page="' . ( $current_page + 1 ) . '" data-max-pages="' . $total_pages . '">'; + echo '<div class="woolentor-infinite-scroll" data-grid-id="'.esc_attr( $settings['grid_id'] ).'" data-page="' . ( $current_page + 1 ) . '" data-max-pages="' . $total_pages . '">'; echo '<button class="woolentor-ajax-loader"><span class="spinner"></span></button>'; echo '</div>'; break;
Exploit Outline
To exploit this vulnerability, an attacker with at least Contributor-level access must create a new post or edit an existing one using the Gutenberg editor. The attacker adds a ShopLentor Product Grid block (e.g., `woolentor/product-grid`) and modifies its metadata to include a malicious payload in the `blockUniqId` attribute. This can be done via the REST API endpoint `/wp-json/wp/v2/posts` by supplying a block comment like `<!-- wp:woolentor/product-grid {"blockUniqId":"\"><script>alert(1)</script>"} /-->`. When the post is rendered, the plugin echoes the unescaped `blockUniqId` directly into the `data-grid-id` attribute of an HTML element, allowing the attacker to break out of the attribute and execute arbitrary JavaScript.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.