Published : August 8, 2026

CVE-2026-65545: AI Engine – The Chatbot, AI Framework & MCP for WordPress <= 3.6.8 Unauthenticated Stored Cross-Site Scripting PoC, Patch Analysis & Rule

Plugin ai-engine
Severity High (CVSS 7.2)
CWE 79
Vulnerable Version 3.6.8
Patched Version 3.6.9
Disclosed July 27, 2026

Analysis Overview

Atomic Edge analysis of CVE-2026-65545: The AI Engine – The Chatbot, AI Framework & MCP for WordPress plugin, versions up to and including 3.6.8, contains an unauthenticated stored cross-site scripting (XSS) vulnerability in its MCP OAuth handling. The flaw arises from insufficient input sanitization and output escaping in the MCP OAuth login flow, enabling unauthenticated attackers to inject arbitrary web scripts that execute when an administrator or other user loads the affected page. This vulnerability carries a CVSS score of 7.2.

Root Cause: The vulnerability resides in the file ai-engine/labs/mcp-oauth.php. The vulnerable code path, starting at line 683, handles client secret validation for MCP OAuth token refresh requests. When the HTTP Authorization header is absent, the plugin falls back to reading credentials from PHP_AUTH_USER and PHP_AUTH_PW. However, the plugin fails to sanitize or escape the values obtained from these PHP server variables before using them in authentication logic or reflecting them in responses. Specifically, the plugin assigns the raw client_secret parameter or the PHP_AUTH_PW value to the $provided_secret variable without any validation, allowing an attacker to embed malicious script payloads in these fields. These payloads are later rendered without proper output escaping, leading to stored XSS.

Exploitation: An unauthenticated attacker can exploit this vulnerability by crafting a request to the MCP OAuth token endpoint, typically found at /wp-json/mwai/v1/mcp-oauth/token or a similar REST endpoint. The attacker sets the Authorization header to a malicious value containing the XSS payload, or sends a POST request with a crafted client_secret parameter. For example, the attacker could use a payload such as `client_secret=alert(document.cookie)`. Since the plugin does not sanitize or escape this value, the malicious script is stored and executed in the browser of any user who accesses the page where the value is reflected, including administrators.

Patch Analysis: The patch, applied in version 3.6.9, addresses the issue by adding a validation check for the PHP_AUTH_USER value. Specifically, the code now only trusts the PHP_AUTH_PW value if the PHP_AUTH_USER matches the expected client_id. This prevents an attacker from injecting arbitrary scripts through the PHP_AUTH_PW field when the username does not correspond to a valid client identifier. However, the patch does not appear to add direct sanitization or escaping for the $provided_secret variable itself; it only restricts the source of the data. Therefore, while the specific vector through PHP_AUTH_PW is mitigated, the underlying lack of output escaping remains a concern for other input paths, such as the client_secret parameter in the request body, which is still taken directly from the request without sanitization.

Impact: Successful exploitation allows an unauthenticated attacker to inject arbitrary JavaScript or other web scripts into the WordPress admin panel or any page where the reflected data is output. This can lead to session hijacking, deletion of posts, defacement, or complete site compromise if an administrator’s session is leveraged. Since the vulnerability is stored, the payload persists and executes on every page load for any user, significantly increasing the attack surface and potential damage.

Differential between vulnerable and patched code

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

Code Diff
--- a/ai-engine/ai-engine.php
+++ b/ai-engine/ai-engine.php
@@ -4,7 +4,7 @@
 Plugin Name: AI Engine
 Plugin URI: https://wordpress.org/plugins/ai-engine/
 Description: AI meets WordPress. Your site can now chat, write poetry, solve problems, and maybe make you coffee.
-Version: 3.6.8
+Version: 3.6.9
 Requires at least: 6.0
 Requires PHP: 8.1
 Author: Jordy Meow
@@ -14,7 +14,7 @@
 License URI: https://www.gnu.org/licenses/gpl-2.0.html
 */

-define( 'MWAI_VERSION', '3.6.8' );
+define( 'MWAI_VERSION', '3.6.9' );
 define( 'MWAI_PREFIX', 'mwai' );
 define( 'MWAI_DOMAIN', 'ai-engine' );
 define( 'MWAI_ENTRY', __FILE__ );
--- a/ai-engine/labs/mcp-oauth.php
+++ b/ai-engine/labs/mcp-oauth.php
@@ -683,6 +683,15 @@
           }
         }
       }
+      elseif ( isset( $_SERVER['PHP_AUTH_USER'] ) && $_SERVER['PHP_AUTH_USER'] === $client->client_id ) {
+        // Apache with mod_php performs HTTP Basic auth itself: it moves the credentials
+        // into PHP_AUTH_USER/PHP_AUTH_PW and never exposes the header, so get_header()
+        // above finds nothing even though the client sent one. A Bearer header is left
+        // alone, which is exactly why MCP tool calls keep working on these hosts while
+        // every single token refresh is rejected as invalid_client: the connection dies
+        // once the access token ages out and never comes back.
+        $provided_secret = (string) ( $_SERVER['PHP_AUTH_PW'] ?? '' );
+      }
     }
     else {
       $provided_secret = (string) ( $request->get_param( 'client_secret' ) ?? '' );

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.