ManageWP Worker <= 4.9.31 - Unauthenticated Stored Cross-Site Scripting
Description
The ManageWP Worker plugin for WordPress is vulnerable to Stored Cross-Site Scripting in versions up to, and including, 4.9.31 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 v4.9.32
Source Code
WordPress.org SVN# Research Plan: ManageWP Worker Unauthenticated Stored XSS (CVE-2026-39463) ## 1. Vulnerability Summary The **ManageWP Worker** plugin (versions <= 4.9.31) is vulnerable to **Unauthenticated Stored Cross-Site Scripting (XSS)**. The vulnerability exists because the plugin records communication erro…
Show full research plan
Research Plan: ManageWP Worker Unauthenticated Stored XSS (CVE-2026-39463)
1. Vulnerability Summary
The ManageWP Worker plugin (versions <= 4.9.31) is vulnerable to Unauthenticated Stored Cross-Site Scripting (XSS). The vulnerability exists because the plugin records communication errors from incoming ManageWP service requests into a WordPress option (mwp_last_communication_error) without proper sanitization. When a service request fails authentication (e.g., due to an invalid signature or missing public key), the plugin includes parts of the request—such as the provided public key name or the request parameters—directly in the error message. This stored error message is subsequently displayed in the WordPress admin dashboard (specifically in the connection modal or admin notices) without sufficient output escaping, allowing an unauthenticated attacker to inject malicious JavaScript.
2. Attack Vector Analysis
- Endpoint: Any page on the WordPress site (ManageWP Worker intercepts requests at the
initorplugins_loadedstage). - Trigger: An incoming HTTP request containing ManageWP-specific headers that fail authentication.
- Vulnerable Parameter:
MWP-Public-Keyheader (mapped tokeyName) or request parameters. - Authentication Level: Unauthenticated (no login required).
- Preconditions: The plugin must be active.
3. Code Flow
- Entry Point: A request is made to the WordPress site with the header `MWP
Summary
The ManageWP Worker plugin for WordPress is vulnerable to unauthenticated Stored Cross-Site Scripting (XSS) via the 'mwp_last_communication_error' option. The plugin records failed authentication attempts from the ManageWP service and includes unsanitized request metadata, such as public key names or raw message contents, which are then displayed to administrators without proper escaping.
Vulnerable Code
// src/MWP/EventListener/MasterRequest/AuthenticateServiceRequest.php $keyName = $request->getKeyName(); if (empty($serviceSignature) || empty($keyName)) { $this->context->optionSet('mwp_last_communication_error', 'Unexpected: service signature or key name are empty. Key name: '.$keyName.', Signature: '.$serviceSignature.', Algorithm: '.($algorithm ? $algorithm : 'SHA1')); return; } // ... line 67 ... if (empty($publicKey)) { $this->context->optionSet('mwp_last_communication_error', 'Could not find the appropriate communication key. Searched for: '.$keyName); return; } // ... line 101 ... if (!$verify) { $this->context->optionSet('mwp_last_communication_error', 'Message signature invalid. Tried to verify: '.$messageToCheck.', Signature: '.base64_encode($serviceSignature)); return; } --- // src/MWP/EventListener/PublicRequest/AddConnectionKeyInfo.php <p> <?php echo 'Last communication error: '.$this->context->optionGet('mwp_last_communication_error', '') ?> </p>
Security Fix
@@ -46,6 +46,8 @@ } $algorithm = $request->getSignatureAlgorithm(); + // Sanitize algorithm to prevent XSS when displayed in debug output + $sanitizedAlgorithm = sanitize_text_field($algorithm); if ($algorithm == 'SHA256') { $serviceSignature = $request->getServiceSignatureV2(); @@ -56,9 +58,11 @@ } $keyName = $request->getKeyName(); + // Sanitize key name to prevent XSS when displayed in debug output + $sanitizedKeyName = sanitize_text_field($keyName); if (empty($serviceSignature) || empty($keyName)) { - $this->context->optionSet('mwp_last_communication_error', 'Unexpected: service signature or key name are empty. Key name: '.$keyName.', Signature: '.$serviceSignature.', Algorithm: '.($algorithm ? $algorithm : 'SHA1')); + $this->context->optionSet('mwp_last_communication_error', 'Unexpected: service signature or key name are empty. Key name: '.$sanitizedKeyName.', Signature: '.$serviceSignature.', Algorithm: '.($sanitizedAlgorithm ? $sanitizedAlgorithm : 'SHA1')); return; } @@ -67,7 +71,7 @@ if (empty($publicKey)) { // for now do not throw an exception, just do not authenticate the request // later we should start throwing an exception here when this becomes the main communication method - $this->context->optionSet('mwp_last_communication_error', 'Could not find the appropriate communication key. Searched for: '.$keyName); + $this->context->optionSet('mwp_last_communication_error', 'Could not find the appropriate communication key. Searched for: '.$sanitizedKeyName); return; } @@ -75,7 +79,7 @@ $messageToCheck = ''; if (empty($communicationKey)) { - $this->context->optionSet('mwp_last_communication_error', 'Unexpected: communication key is empty. Key name: '.$keyName); + $this->context->optionSet('mwp_last_communication_error', 'Unexpected: communication key is empty. Key name: '.$sanitizedKeyName); return; } @@ -88,7 +92,7 @@ if (empty($messageToCheck)) { // for now do not throw an exception, just do not authenticate the request // later we should start throwing an exception here when this becomes the main communication method - $this->context->optionSet('mwp_last_communication_error', 'Unexpected: message to check is empty. Host: '.$request->server['HTTP_HOST']); + $this->context->optionSet('mwp_last_communication_error', 'Unexpected: message to check is empty. Host: '.sanitize_text_field($request->server['HTTP_HOST'])); return; } @@ -101,7 +105,7 @@ if (!$verify) { // for now do not throw an exception, just do not authenticate the request // later we should start throwing an exception here when this becomes the main communication method - $this->context->optionSet('mwp_last_communication_error', 'Message signature invalid. Tried to verify: '.$messageToCheck.', Signature: '.base64_encode($serviceSignature)); + $this->context->optionSet('mwp_last_communication_error', 'Message signature invalid. Tried to verify: '.base64_encode($messageToCheck).', Signature: '.base64_encode($serviceSignature)); return; } @@ -410,21 +410,28 @@ if ($refreshedKeys['success'] === true) { echo 'Keys successfully refreshed!'; } else { - echo 'Keys were not successfully refreshed. Error: '.$refreshedKeys['message']; + echo 'Keys were not successfully refreshed. Error: '.esc_html($refreshedKeys['message']); } ?> </p> <p> - <?php echo 'Last communication error: '.$this->context->optionGet('mwp_last_communication_error', '') ?> + <?php echo 'Last communication error: '.esc_html($this->context->optionGet('mwp_last_communication_error', '')) ?> </p>
Exploit Outline
To exploit this vulnerability, an unauthenticated attacker sends a crafted HTTP request containing ManageWP-specific headers, such as 'MWP-Public-Key', with a malicious JavaScript payload (e.g., <script>alert(1)</script>). By purposefully omitting or invalidating the 'MWP-Signature' header, the attacker triggers an authentication failure. The plugin's AuthenticateServiceRequest listener captures the failure and saves the error message—including the malicious header value—into the 'mwp_last_communication_error' WordPress option. When a site administrator later visits the plugin's connection management interface (typically via plugins.php?worker_connections=1), the stored payload is rendered without escaping, resulting in script execution in the administrator's browser context.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.