Skip to main content
Vulnerability Database/CVE-2026-104021

CVE-2026-104021: Fastcache WordPress Plugin RCE Vulnerability

CVE-2026-104021 is a code injection flaw in the Fastcache by Host.it WordPress plugin allowing authenticated admins to inject Apache directives into .htaccess files and execute arbitrary PHP code. This article covers technical details, affected versions, impact, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-104021 Overview

The Fastcache by Host.it plugin for WordPress contains a code injection vulnerability affecting all versions up to and including 1.7.4. The flaw resides in the fastcache_settings[cache_cookie_exclude][] parameter, which is registered via register_setting() without a sanitize_callback. Attackers with administrator-level access can inject arbitrary Apache directives into the site's .htaccess file, enabling server-level configuration changes. By setting php_value auto_prepend_file, an attacker can execute attacker-controlled PHP code on every request to the site. The issue is tracked under CWE-94: Improper Control of Generation of Code.

Critical Impact

Authenticated administrators can achieve persistent remote code execution by injecting .htaccess directives that force PHP to auto-prepend attacker-controlled files on every HTTP request.

Affected Products

  • Fastcache by Host.it WordPress plugin, all versions up to and including 1.7.4
  • WordPress sites running on Apache web servers with .htaccess overrides enabled
  • Sites where plugin settings are writable by administrator-level users

Discovery Timeline

  • 2026-10-10 - CVE-2026-104021 published to the National Vulnerability Database
  • 2026-10-13 - Last updated in NVD database

Technical Details for CVE-2026-104021

Vulnerability Analysis

The Fastcache by Host.it plugin registers the cache_cookie_exclude setting through WordPress's register_setting() API without supplying a sanitize_callback argument. User-supplied cookie exclusion values are then consumed by buildSiteHtaccessRules() in the plugin's Utility.php module. Before interpolation into an Apache RewriteCond directive, the plugin applies only trim() to each cookie value. trim() removes surrounding whitespace but preserves embedded newline characters inside the string. An attacker can submit a value containing a line break followed by arbitrary Apache configuration directives, breaking out of the intended RewriteCond capture group. The resulting content is written to .htaccess via file_put_contents(), giving the attacker direct control over server-level configuration.

Root Cause

The root cause is a missing sanitization callback combined with insufficient input normalization. trim() is not a safe sanitizer for data interpolated into line-oriented configuration files. Any newline-bearing payload breaks the single-line assumption of the RewriteCond syntax and lets subsequent lines be interpreted as independent Apache directives.

Attack Vector

Exploitation requires authenticated access at the administrator level or higher. The attacker submits a crafted value for fastcache_settings[cache_cookie_exclude][] through the plugin's settings interface. The payload contains an embedded newline followed by an Apache directive such as php_value auto_prepend_file "/path/to/attacker.php". Once the plugin rewrites .htaccess, Apache loads the attacker-controlled PHP file before every request handled under that directory scope, resulting in persistent remote code execution.

See the Wordfence writeup and plugin source for the specific sinks: Admin.php L73, Utility.php L420, Utility.php L521, Utility.php L545, Dispatcher.php L480, and the Wordfence Vulnerability Analysis.

Stop Remote Code Execution Before It Runs

Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.

Stop Exploit Attempts

Detection Methods for CVE-2026-104021

Indicators of Compromise

  • Unexpected php_value auto_prepend_file or php_value auto_append_file directives in the WordPress site's .htaccess file
  • .htaccess entries referencing PHP files located in uploads directories, temporary paths, or other non-standard locations
  • Modifications to wp_options rows containing fastcache_settings where cache_cookie_exclude entries contain embedded newline characters
  • Apache RewriteCond blocks followed by directives that do not match the plugin's expected template

Detection Strategies

  • Compare the current .htaccess against a known-good baseline and alert on new PHP configuration directives
  • Audit the wp_options table for fastcache_settings values containing \n, \r, or other control characters
  • Review WordPress administrator activity logs for recent updates to the Fastcache settings page
  • Monitor Apache access logs for requests to unusual PHP files loaded through auto_prepend_file

Monitoring Recommendations

  • Enable file integrity monitoring on .htaccess, plugin directories, and the WordPress document root
  • Forward Apache and WordPress audit logs to a centralized analytics backend for correlation
  • Alert on PHP processes spawning shells, outbound connections, or write operations outside standard WordPress paths
  • Track administrator account logins from new IP addresses or unusual geographies

How to Mitigate CVE-2026-104021

Immediate Actions Required

  • Update the Fastcache by Host.it plugin to a version newer than 1.7.4 once the vendor releases a fixed build
  • Audit all administrator accounts, rotate credentials, and enforce multi-factor authentication
  • Inspect .htaccess for injected directives and restore from a trusted backup if tampering is found
  • Review wp_options for malicious values in the fastcache_settings setting and reset them if necessary

Patch Information

The vendor committed a change to the plugin repository referenced in the WordPress Plugin Changeset. Administrators should apply the latest available plugin release and verify that cookie exclusion values are sanitized to reject newline characters.

Workarounds

  • Deactivate and remove the Fastcache by Host.it plugin until a patched version is installed
  • Set AllowOverride None in the Apache server configuration to prevent .htaccess from altering PHP behavior
  • Restrict administrator-level access to a minimal set of trusted accounts and enforce strong authentication
  • Make .htaccess immutable at the filesystem layer (for example, chattr +i) after confirming it is clean
bash
# Example Apache hardening to neutralize .htaccess-based PHP overrides
<Directory /var/www/html>
    AllowOverride None
    php_admin_value auto_prepend_file none
    php_admin_value auto_append_file none
</Directory>

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.