Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- 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>