WordPress HTTP Headers Plugin Remote Code Execution via File Path Manipulation (CVE-2026-4132)
The HTTP Headers WordPress plugin is vulnerable to remote code execution (RCE) due to insufficient validation of the htpasswd file path and lack of sanitization of the username, allowing authenticated administrators to write arbitrary code to the server.
The HTTP Headers plugin for WordPress, versions up to and including 1.19.2, is vulnerable to remote code execution (RCE) due to a file path manipulation vulnerability (CVE-2026-4132). This vulnerability stems from the plugin’s insufficient validation of the ‘hh_htpasswd_path’ option, which controls the location of the .htpasswd file. Furthermore, the ‘hh_www_authenticate_user’ option, used for setting the username for HTTP Basic Authentication, lacks proper sanitization. This allows attackers with administrator privileges to specify an arbitrary file path for the htpasswd file and inject unsanitized content into it. By crafting a malicious username containing PHP code and setting the htpasswd path to a web-accessible directory, an attacker can execute arbitrary code on the server. This exploit requires administrator-level access to the WordPress dashboard.
Attack Chain
- The attacker authenticates to the WordPress dashboard with administrator privileges.
- The attacker navigates to the HTTP Headers plugin settings page.
- The attacker modifies the ‘hh_htpasswd_path’ option, setting it to a web-accessible directory (e.g.,
/var/www/html/wp-content/uploads/.shell.php). - The attacker modifies the ‘hh_www_authenticate_user’ option, injecting PHP code into the username field (e.g.,
<?php system($_GET['cmd']); ?>). - The
apache_auth_credentials()function uses sprintf to combine the malicious username with a SHA hash, creating a crafted htpasswd entry. - The
update_auth_credentials()function then writes the crafted content, including the injected PHP code, to the attacker-controlled file path usingfile_put_contents(). - The attacker accesses the newly created PHP file via a web browser (e.g.,
http://example.com/wp-content/uploads/.shell.php?cmd=id). - The injected PHP code executes, allowing the attacker to run arbitrary commands on the server.
Impact
Successful exploitation of this vulnerability grants the attacker remote code execution on the affected WordPress server. This can lead to complete compromise of the server, including data theft, website defacement, malware deployment, and further attacks against internal networks. Given the widespread use of WordPress and its plugins, a successful exploit could impact a large number of websites and organizations.
Recommendation
- Immediately update the HTTP Headers plugin to a patched version (if available) to remediate CVE-2026-4132.
- Monitor web server logs for requests to unusual file paths that match the ‘hh_htpasswd_path’ setting specified in the plugin configuration to detect potential exploitation attempts.
- Implement the Sigma rule to detect file creation events in web-accessible directories with PHP extensions that are triggered by the web server process.
- Restrict access to the WordPress administrator dashboard to only trusted individuals and enforce strong password policies to prevent unauthorized access to plugin settings.
Detection coverage 2
Detect PHP File Creation in Web Directories
highDetects the creation of PHP files in common web directories by the web server process, potentially indicating malicious file upload or RCE attempts.
Detect Unsanitized Username Injection in HTTP Headers Plugin htpasswd File
criticalDetects modifications to the .htpasswd file with usernames containing PHP tags, potentially indicating a RCE attempt.
Detection queries are kept inside the platform. Get full rules →