Style Kits – Advanced Theme Styles for Elementor <= 2.5.0 - Authenticated (Contributor+) Stored Cross-Site Scripting via Kit Title
Description
The Style Kits – Advanced Theme Styles for Elementor, Elementor Kits & Elementor Patterns plugin for WordPress is vulnerable to Stored Cross-Site Scripting via the '/wp-json/agwp/v1/tokens/save' endpoint kit title parameter in versions up to, and including, 2.5.0 due to insufficient input sanitization and output escaping in an admin attribute context. 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:N/S:C/C:L/I:L/A:NTechnical Details
<=2.5.0What Changed in the Fix
Changes introduced in v2.6.0
Source Code
WordPress.org SVNThis research plan focuses on exploiting a Stored Cross-Site Scripting (XSS) vulnerability in the **Style Kits for Elementor** plugin (version <= 2.5.0). The vulnerability allows authenticated users with Contributor-level permissions to inject malicious scripts via a specific REST API endpoint used …
Show full research plan
This research plan focuses on exploiting a Stored Cross-Site Scripting (XSS) vulnerability in the Style Kits for Elementor plugin (version <= 2.5.0). The vulnerability allows authenticated users with Contributor-level permissions to inject malicious scripts via a specific REST API endpoint used for saving kit titles.
1. Vulnerability Summary
- Vulnerability: Authenticated (Contributor+) Stored Cross-Site Scripting (XSS).
- ID: CVE-2026-6565.
- Location: REST API endpoint
/wp-json/agwp/v1/tokens/save. - Sink: The kit title is rendered in an admin context (likely a kit list or the Elementor editor interface) without proper escaping, specifically within an "admin attribute context" (e.g.,
title="..."orvalue="..."). - Cause: Insufficient sanitization of the
titleparameter during storage and missing escaping during output.
2. Attack Vector Analysis
- Endpoint:
POST /wp-json/agwp/v1/tokens/save - Authentication: Contributor or higher. Contributors can access the REST API and typically have the
edit_postscapability, which often suffices for kit-related operations in this plugin. - Vulnerable Parameter:
title(or a similar key representing the kit title in the JSON body). - Preconditions:
- Plugin active on a WordPress site with Elementor.
- An attacker session with at least Contributor privileges.
- A valid
wp_restnonce for authentication to the REST API.
3. Code Flow (Inferred)
- Entry: The plugin registers a REST route via
register_rest_route('agwp/v1', '/tokens/save', ...)duringrest_api_init. - Permission Check: The
permission_callbacklikely checks forcurrent_user_can('edit_posts')rather thanmanage_options, allowing Contributors access. - Processing: The callback function receives the
WP_REST_Request. It extracts thetitleparameter from the request body. - Storage: The title is saved to the database (likely in
wp_optionsas part of a kit configuration or as a custom post typeang_tokensmeta). Nosanitize_text_fieldor similar filter is applied effectively to block HTML tags. - Rendering: When an Administrator views the "Style Kits" dashboard or the Elementor editor, the plugin retrieves the stored title and echoes it inside an HTML attribute (e.g.,
<div title="[USER_INPUT]">) without usingesc_attr().
4. Nonce Acquisition Strategy
The WordPress REST API requires a nonce for authenticated POST requests to prevent CSRF. The nonce must be for the action wp_rest.
- Identification: The
wp_restnonce is standard for the WordPress REST API. It is usually localized into thewpApiSettingsJavaScript object on admin pages. - Extraction Method:
- Navigate to any admin page (e.g.,
/wp-admin/index.php) as the Contributor user. - Use the
browser_evaltool to extract the nonce from the window object.
- Navigate to any admin page (e.g.,
- Specific JS Variable:
window.wpApiSettings.nonce.
5. Exploitation Strategy
Step 1: Authentication
Login as a Contributor user.
Step 2: Nonce Retrieval
Execute browser_navigate to /wp-admin/ and then browser_eval("window.wpApiSettings.nonce").
Step 3: Payload Injection
Send a POST request to the vulnerable endpoint using the http_request tool.
- URL:
https://[TARGET]/wp-json/agwp/v1/tokens/save - Method:
POST - Headers:
X-WP-Nonce: [EXTRACTED_NONCE]Content-Type: application/json
- Body (Inferred JSON structure):
Note: If{ "title": "\"><script>alert('XSS_SUCCESS')</script>", "id": 0 }id: 0fails, a valid kit ID might be needed, but usually, saving a new token/kit uses 0 or omits the ID.
Step 4: Trigger XSS
Login as an Administrator and navigate to the Style Kits dashboard:https://[TARGET]/wp-admin/admin.php?page=analogwp_templates (based on analogwp_templates slug in analogwp-templates.php).
6. Test Data Setup
- Plugin: Install and activate "Style Kits – Advanced Theme Styles for Elementor" version 2.5.0.
- Dependencies: Ensure Elementor is installed and activated (required by the plugin).
- User: Create a user with the Contributor role.
- Content: Create at least one "Style Kit" or "Token" if the endpoint requires an existing ID.
7. Expected Results
- Injection: The REST API returns a
200 OKor201 Createdresponse. - Execution: When the Admin views the kit list, the payload
"><script>alert('XSS_SUCCESS')</script>breaks out of the attribute and executes the JavaScript. - Response Analysis: Check if the script appears unescaped in the page source of the admin dashboard.
8. Verification Steps
- Check Database: Use WP-CLI to verify the stored value.
wp option get analog_tokens(or similar depending on storage choice).- Search for the payload:
wp db query "SELECT * FROM wp_options WHERE option_value LIKE '%XSS_SUCCESS%'".
- DOM Verification: After navigating to the settings page as Admin, use
browser_evalto check if the alert was triggered or if the element exists:browser_eval("document.body.innerHTML.includes('XSS_SUCCESS')").
9. Alternative Approaches
- Payload Contexts: If the "attribute context" is a
valueattribute inside an input, use:" onfocus="alert(1)" autofocus=" - REST Parameters: If the JSON body is not accepted, try standard POST data:
action=save_token&title=<script>alert(1)</script>(Check if the endpoint falls back to$_REQUEST). - Endpoint Variation: If
/agwp/v1/tokens/saverequires a specific ID, useGET /wp-json/agwp/v1/tokensfirst to list available IDs to overwrite.
Summary
The Style Kits for Elementor plugin is vulnerable to Stored Cross-Site Scripting via the kit title parameter of the '/wp-json/agwp/v1/tokens/save' REST API endpoint in versions up to 2.5.0. Authenticated attackers with Contributor-level access can inject malicious scripts that are stored on the server and executed in the browser of any administrator who subsequently views the plugin's dashboard.
Security Fix
@@ -10,17 +10,17 @@ * Plugin Name: Style Kits for Elementor * Plugin URI: https://analogwp.com/ * Description: Style Kits extends the Elementor theme styles editor with more global styling options. Boost your design workflow in Elementor with intuitive global controls and theme style presets. - * Version: 2.5.0 + * Version: 2.6.0 * Author: AnalogWP * Author URI: https://analogwp.com/ * License: GPL2 * License URI: https://www.gnu.org/licenses/gpl-2.0.html - * Text Domain: ang + * Text Domain: analogwp-templates * Requires at least: 6.0 * Requires PHP: 7.4 * - * Elementor tested up to: 3.35.9 - * Elementor Pro tested up to: 3.35.1 + * Elementor tested up to: 4.0.8 + * Elementor Pro tested up to: 4.0.4 */ defined( 'ABSPATH' ) || exit; @@ -28,7 +28,9 @@ define( 'ANG_ELEMENTOR_MINIMUM', '3.32.0' ); define( 'ANG_PHP_MINIMUM', '7.4' ); define( 'ANG_WP_MINIMUM', '6.0' ); -define( 'ANG_VERSION', '2.5.0' ); +define( 'ANG_VERSION', '2.6.0' ); +define( 'ANG_TEXT_DOMAIN', 'analogwp-templates' ); +define( 'ANG_LEGACY_TEXT_DOMAIN', 'ang' ); define( 'ANG_PLUGIN_FILE', __FILE__ ); define( 'ANG_PLUGIN_URL', plugin_dir_url( ANG_PLUGIN_FILE ) ); define( 'ANG_PLUGIN_DIR', plugin_dir_path( ANG_PLUGIN_FILE ) );
Exploit Outline
An authenticated attacker with Contributor-level permissions or higher can exploit this by first obtaining a REST API nonce from any admin page (usually found in the 'wpApiSettings.nonce' JavaScript variable). The attacker then sends a POST request to the '/wp-json/agwp/v1/tokens/save' endpoint with a JSON body including a 'title' parameter containing a malicious script, such as '"><script>alert(document.cookie)</script>'. The payload is stored in the database and executes whenever an administrator views the Style Kits dashboard (wp-admin/admin.php?page=analogwp_templates), as the plugin fails to escape the stored title when rendering it within an HTML attribute.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.