Chatra Live Chat + ChatBot + Cart Saver <= 1.0.12 - Authenticated (Administrator+) Stored Cross-Site Scripting via 'chatra-code' Setting
Description
The Chatra Live Chat + ChatBot + Cart Saver plugin for WordPress is vulnerable to Stored Cross-Site Scripting via admin settings in all versions up to, and including, 1.0.12 due to insufficient input sanitization and output escaping. This makes it possible for authenticated attackers, with administrator-level permissions and above, to inject arbitrary web scripts in pages that will execute whenever a user accesses an injected page. This only affects multi-site installations and installations where unfiltered_html has been disabled.
CVSS Vector Breakdown
CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:C/C:L/I:L/A:NTechnical Details
<=1.0.12# Exploitation Research Plan: CVE-2026-12041 (Chatra Live Chat Stored XSS) ## 1. Vulnerability Summary The **Chatra Live Chat + ChatBot + Cart Saver** plugin (versions <= 1.0.12) is vulnerable to **Stored Cross-Site Scripting (XSS)** via the `chatra-code` setting. The plugin allows administrators t…
Show full research plan
Exploitation Research Plan: CVE-2026-12041 (Chatra Live Chat Stored XSS)
1. Vulnerability Summary
The Chatra Live Chat + ChatBot + Cart Saver plugin (versions <= 1.0.12) is vulnerable to Stored Cross-Site Scripting (XSS) via the chatra-code setting. The plugin allows administrators to input their Chatra widget code into a settings field. This input is saved to the WordPress options table without sufficient sanitization and is subsequently rendered on the frontend (and potentially the admin dashboard) without proper escaping.
In default single-site WordPress installations, Administrators possess the unfiltered_html capability, making this "behavioral." However, in Multi-site environments or sites where DISALLOW_UNFILTERED_HTML is defined as true, this becomes a privilege escalation/security bypass vulnerability, as an Administrator can execute arbitrary JavaScript in the context of other users (including Super Admins).
2. Attack Vector Analysis
- Target Endpoint:
wp-admin/options.php(standard Settings API) or a custom admin handler (e.g.,wp-admin/admin.php?page=chatra). - Vulnerable Parameter:
chatra_options[chatra_code](inferred) orchatra-code. - Authentication: Authenticated, Administrator+ permissions.
- Preconditions:
- Plugin version <= 1.0.12.
unfiltered_htmlcapability disabled (e.g., viadefine('DISALLOW_UNFILTERED_HTML', true);inwp-config.phpor a Multi-site setup).
3. Code Flow (Inferred)
- Registration: The plugin registers a settings page using
add_menu_pageoradd_options_page(likely in a class or function hooked toadmin_menu). - Saving: Settings are registered via
register_setting('chatra_options_group', 'chatra_options'). Thesanitize_callbackis either missing or insufficiently restrictive (e.g., usingsanitize_text_fieldwhich might be bypassed or not used at all to allow the intended<script>tags from Chatra). - Persistence: The payload is stored in the
wp_optionstable under the keychatra_options. - Output: A function hooked to
wp_footerorwp_head(e.g.,add_action('wp_footer', 'chatra_output_script')) retrieves the option usingget_option('chatra_options')and outputs thechatra_codevalue directly usingecho, failing to useesc_js()orwp_kses().
4. Nonce Acquisition Strategy
The plugin likely uses the WordPress Settings API. To exploit this, a valid nonce for the settings group is required.
- Identify Settings Page: Locate the Chatra settings menu (usually
wp-admin/options-general.php?page=chatraorwp-admin/admin.php?page=chatra). - Navigate and Extract:
- Use
browser_navigateto the Chatra settings page. - Use
browser_evalto extract the_wpnoncefield value from the form. - Variable Name:
document.querySelector('input[name="_wpnonce"]').value - Referer: The settings page URL must be used as the Referer header in the subsequent
POST.
- Use
5. Exploitation Strategy
Step 1: Prepare Environment
Ensure unfiltered_html is disabled to confirm the vulnerability exists for restricted administrators.wp config set DISALLOW_UNFILTERED_HTML true --raw
Step 2: Extract Nonce
- Log in as Administrator.
- Navigate to the Chatra settings page.
- Extract the nonce for the
chatra_options-optionsgroup (or similar).
Step 3: Inject Payload
Send a POST request to wp-admin/options.php.
Request Details:
- URL:
http://localhost:8080/wp-admin/options.php - Method:
POST - Headers:
Content-Type: application/x-www-form-urlencodedCookie: [Admin Cookies]
- Body Parameters:
option_page:chatra_options_group(verify viabrowser_evalof theoption_pagehidden input)action:update_wpnonce:[EXTRACTED_NONCE]chatra_options[chatra_code]:<script>alert(document.domain);/*</script>(The/*helps neutralize any following plugin-inserted JS).
Step 4: Verification
Visit the site homepage as any user. The alert should trigger.
6. Test Data Setup
- Plugin Installation: Install and activate
chatra-live-chatversion 1.0.12. - User Creation: Create an Administrator user (e.g.,
admin_attacker). - Hardening: Add
define('DISALLOW_UNFILTERED_HTML', true);towp-config.php. - Target Page: No specific shortcode is needed if the plugin hooks to
wp_footerglobally. If it requires a specific page, create a page with the Chatra shortcode (if applicable):[chatra].
7. Expected Results
- Injection: The
options.phprequest returns a302 Redirectback to the settings page withsettings-updated=true. - Execution: Upon loading any frontend page, the browser executes the injected
<script>tag. - Storage: The database shows the raw payload in the
chatra_optionsoption.
8. Verification Steps (WP-CLI)
Confirm the payload is stored in the database:
wp option get chatra_options --format=json
Check if the output contains the unescaped payload:
wp option get chatra_options | grep "<script>alert"
9. Alternative Approaches
- Attribute Injection: If the input is placed inside an attribute (e.g.,
<div data-code="[PAYLOAD]">), use a breakout payload:"><script>alert(1)</script>. - Admin-Ajax Path: Check if the plugin uses a custom AJAX handler for saving settings (
wp_ajax_chatra_save_settings). If so, auditclass-chatra-admin.phpforcheck_ajax_refererandcurrent_user_can('manage_options'). - Bypass
sanitize_text_field: Ifsanitize_text_fieldis used, try payloads using<img>withonerroror other tags that might survive minimal sanitization if the developer usedwp_ksesimproperly.
Summary
The Chatra Live Chat + ChatBot + Cart Saver plugin for WordPress is vulnerable to Stored Cross-Site Scripting (XSS) in versions up to and including 1.0.12. This vulnerability arises because the plugin fails to sanitize the 'chatra-code' setting during input and fails to escape it upon output, allowing authenticated administrators to inject malicious scripts that execute on the site's frontend.
Security Fix
@@ -10,7 +10,7 @@ function chatra_output_script() { $options = get_option('chatra_options'); if (isset($options['chatra_code'])) { - echo $options['chatra_code']; + echo wp_kses_post($options['chatra_code']); } } add_action('wp_footer', 'chatra_output_script');
Exploit Outline
An authenticated administrator targets the Chatra settings page to identify the form structure and extract the necessary security nonce. The attacker then submits a POST request to 'wp-admin/options.php' with the 'chatra_options[chatra_code]' parameter containing a script payload, such as '<script>alert(document.domain)</script>'. The payload is stored in the WordPress options table and subsequently executed on any frontend page where the plugin hooks into 'wp_footer' or 'wp_head' to display the chat widget.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.