WordPress Core CVE-2026-87902: Unauthenticated RFI to RCE Under Mass Exploitation

·

CVE-2026-87902 is an unauthenticated remote file inclusion (CWE-98) in WordPress core — not a plugin, not a theme, but the CMS engine that W3Techs estimates powers more than 40% of all websites. WordPress shipped the fix in 7.1.2 on September 22, 2026, alongside backports to every branch down to 4.7. Attackers had working exploitation traffic in the wild before the day was out.

The bug lets an unauthenticated request reach a local .php file outside the active theme through the pagename query parameter. Where the server has PHP's register_argc_argv enabled — the default in official PHP Docker images and in cPanel stacks on PHP below 8.5 — that inclusion escalates to full remote code execution via PEAR's pearcmd.php. CISA added it to the Known Exploited Vulnerabilities catalog on September 25 with a September 28 remediation deadline.

If you run WordPress below 7.1.2 (or the matching backport), treat this as an emergency patch. This brief covers the root cause, the LFI-to-RCE mechanics, live IOCs from Patchstack and honeypot telemetry, ready-to-run hunt queries, and the hardening that closes the door even before you patch.

◈ Table of Contents

01 Vulnerability Profile & Affected Versions 02 Disclosure & Exploitation Timeline 03 Root Cause: How get_page_template Fails 04 Initial Access: The pagename RFI 05 Deep Dive: LFI to RCE via pearcmd.php 06 Post-Exploitation: Webshells & Payloads 07 Exposure & Scale 08 Indicators of Compromise 09 Detection & Hunt Queries 10 MITRE ATT&CK Mapping 11 Mitigation & Hardening 12 Sources & References
🛡️

Vulnerability Profile & Affected Versions

Phase 01

CVE-2026-87902 is unusual precisely because it lives in WordPress core. Plugin and theme flaws are a weekly occurrence; a pre-authentication remote file inclusion in the base CMS reaches into a decade of releases and every hosting stack that runs them. The NVD record and CISA KEV entry give the authoritative shape of the flaw.

AttributeValue
CVE IDCVE-2026-87902
Vulnerability classCWE-98 — Improper Control of Filename for Include/Require (Remote File Inclusion)
NVD CVSS v3.18.1 HIGH — AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
Vendor (Patchstack) score9.2 CRITICAL
Authentication requiredNone (unauthenticated, pre-auth)
User interactionNone
Affected productWordPress Core
Affected versions4.7.0 through 7.1.1 (all releases below 7.1.2)
Fixed versions7.1.2, 7.0.6, 6.9.9, 6.8.10 — plus backports on every supported branch to 4.7
Discovered byRobert Ressl
NVD published2026-09-22 · last modified 2026-09-26
CISA KEVAdded 2026-09-25 · federal remediation due 2026-09-28

The NVD base score of 8.1 hinges on "high" attack complexity because RCE depends on server-side preconditions. Do not let that lull you: the preconditions (a theme directory prefixed "page-" and register_argc_argv=On) are the norm on shared hosting and default Docker images, which is why Patchstack scored it 9.2 and exploitation was mass, not targeted.

🕒

Disclosure & Exploitation Timeline

Phase 02

The gap between patch and exploitation was measured in hours. This is a textbook "patch-diff to n-day" case: the fix commit told attackers exactly where the vulnerable code path was, and automated scanners were probing before most administrators had read the release notes.

T
From Patch to Mass Exploitation
UTC
  • 12026-09-22 — WordPress releases 7.1.2 and backported fixes down to branch 4.7. The advisory describes the flaw as an unauthenticated path traversal that can lead to RCE.
  • 22026-09-22, ~11:49 UTC — Previdian's honeypot network records the first exploitation attempt, the same day the patch shipped.
  • 32026-09-22, 17:44 UTC — Patchstack observes reconnaissance probes against protected sites, under five hours after the release. Early requests target harmless core files to fingerprint vulnerable installs.
  • 42026-09-23 — Attack traffic surges more than tenfold. Payloads shift from passive reconnaissance to writing executable PHP to disk via pearcmd.php.
  • 52026-09-25 — CISA adds CVE-2026-87902 to the KEV catalog; the Cyber Security Agency of Singapore issues alert AL-2026-128 confirming in-the-wild exploitation and a public PoC.
  • 62026-09-28 — Federal remediation deadline. By this point mass scanning has broadened well beyond the original honeypot source IPs.

When a widely-deployed project ships a security release, assume the patch itself is the exploit blueprint. The window to "patch on the next maintenance cycle" no longer exists for internet-facing CMS software — the safe assumption is exploitation within 24 hours of the commit landing.

🧩

Root Cause: How get_page_template Fails

Phase 03

The flaw is a missing security check on a single filename. WordPress already knows how to defend against directory traversal — it calls validate_file() in the same code region — but the path built from the pagename parameter skips that guard entirely.

01
The Unvalidated Template Filename
Analysis

During template resolution, get_page_template() constructs a candidate template filename of the form page-{$pagename}.php. An earlier urldecode() converts encoded traversal sequences in pagename into real path separators. The result is passed toward the include machinery without the validate_file() traversal check that WordPress applies to the neighbouring template candidates.

Conceptual sink (simplified)
// wp-includes/template.php — get_page_template(), simplified // $pagename comes from the query var, attacker-controlled $pagename = get_query_var( 'pagename' ); // sibling candidates ARE validated: if ( $page_template && ! validate_file( $page_template ) ) { ... } // guarded // but the pagename-derived candidate is NOT: $templates[] = "page-{$pagename}.php"; // <-- traversal reaches include, no validate_file()

Because page- is prepended, the attacker must first climb out of the theme's page-* directory and then walk the filesystem to a readable .php target. That constraint is why the second precondition — an active theme with a top-level directory whose name begins with page- (for example page-templates/) — matters: it gives the traversal a valid starting anchor.

02
The Fix — Two Overlapping Guards
Patch

WordPress 7.1.2 closes the hole two ways: it runs the missing validate_file() check against the pagename-derived candidate, and it introduces a new _wp_is_template_path_allowed() helper that validates every resolved template path against the allowed theme directories. Belt and braces — the second guard closes adjacent variants a single check might have missed.

What the patch enforces
  • pagename-derived template names now pass through validate_file() traversal rejection
  • _wp_is_template_path_allowed() confirms the resolved path resides under a permitted theme directory
  • Backported identically to 7.0.6, 6.9.9, 6.8.10 and every supported branch to 4.7
🚪

Initial Access: The pagename RFI

Phase 04

Reaching the vulnerable code path requires a specific request shape. The attacker needs WordPress to route the request into page-template resolution, which means supplying a valid page_id alongside a pagename loaded with double-encoded traversal.

01
Request Anatomy
Vector

The page_id forces WordPress to treat the request as a page query so template resolution runs. The pagename value carries the path traversal. Sequences are double-encoded (%252e%252e%252f decodes to ../) so they survive WordPress's own decoding and land as literal separators at the vulnerable line.

Reconnaissance probe — fingerprint vulnerable install
GET /?page_id=2&pagename=..%252f..%252f..%252fwp-config& # harmless core-file probe: does the traversal resolve? # observed as the first-stage behaviour before any write attempt
Weaponized inclusion target (PEAR present)
GET /?page_id=2&pagename=..%252f..%252f..%252f..%252f..%252f..%252fusr%252flocal%252flib%252fphp%252fpearcmd # traversal walks out of the theme dir to /usr/local/lib/php/pearcmd.php # the ".php" suffix is appended by get_page_template(), so no extension is supplied

The page- prefix and appended .php extension mean this is not arbitrary file read of any file — the target must be a readable .php file reachable by climbing out of a page-* theme directory. That is exactly what makes pearcmd.php at /usr/local/lib/php/ the payload of choice.

🔬

Deep Dive: LFI to RCE via pearcmd.php

Phase 05

Including a local .php file only runs its code — it does not, on its own, run attacker code. The escalation to RCE is a well-known LFI-to-RCE primitive that abuses PEAR's command-line utility, and it hinges entirely on one PHP setting: register_argc_argv.

01
Why register_argc_argv Is the Linchpin
Mechanics

When register_argc_argv is enabled, PHP populates $argv from the HTTP query string, splitting on +. A CLI script like pearcmd.php — never meant to be reached over the web — then parses the query string as if it were command-line arguments. This setting is on by default in the official PHP Docker images and in cPanel environments running PHP below 8.5, which is why so many hosts were immediately exploitable rather than merely vulnerable to file disclosure.

The dividing line between "information disclosure" and "remote code execution" for CVE-2026-87902 is literally one php.ini directive. Auditing register_argc_argv across your fleet tells you which hosts are RCE-exploitable versus which only leak file contents.

02
The pearcmd config-create Write Primitive
Mechanics

PEAR's config-create command takes a root directory and an output file, then writes a configuration file to that path. Because the command echoes supplied values into the written file, an attacker can smuggle a PHP tag into the "root" argument and have it persisted verbatim to a file of their choosing under /tmp or /var/tmp — directories that are world-writable and, crucially, readable back through the same inclusion bug.

Stage-by-stage (query string parsed as $argv via '+')
# 1. Include pearcmd.php through the pagename RFI (as in Phase 04) # 2. Query string after the include target becomes pearcmd's argv: &+config-create+/<?=`payload`?>+/tmp/poc87902.php # ^config-create ^root arg carries the PHP tag ^output file written to /tmp # 3. pearcmd writes /tmp/poc87902.php containing the attacker's PHP # 4. A second request includes /tmp/poc87902.php via the same RFI -> code executes

In observed attacks the written file is a small dropper. Patchstack and Previdian recorded stagers reaching out to raw.githubusercontent[.]com/MrG3P5/web-shell/refs/heads/main/uploader.php to pull a fuller file-upload webshell, then persisting it under the webroot.

Because the write lands in /tmp or /var/tmp before a webshell is planted in the docroot, IR teams that only inspect the WordPress directory will miss the first-stage artifact. Include /tmp and /var/tmp in your PHP-file sweep.

Figure 1 — Four-request path from unauthenticated RFI to persistent webshell.
💥

Post-Exploitation: Webshells & Payloads

Phase 06

Once code execution is achieved, the observed behaviour is characteristic of opportunistic, automated campaigns: fingerprint, prove exploitation, plant a webshell, move on. The filenames left behind are the clearest tell.

01
Observed Dropped Artifacts
Behaviour

Early payloads were proof-of-exploitation markers; later waves planted functional file-upload shells. Researchers catalogued a recurring set of filenames written to /tmp, /var/tmp, and the webroot.

FilenameRole
wp-pear-rce-flag.phpProof-of-exploitation marker confirming the PEAR chain worked
poc87902.phpPoC dropper named for the CVE; early-wave write test
luci_<random>.phpRandomized-suffix webshell dropped by one campaign cluster
zeta_<random>.phpRandomized-suffix webshell dropped by a second cluster
uploader.phpFuller file-upload webshell pulled from a GitHub raw URL
🕳️

Persistence

File-upload webshells give durable re-entry independent of the CMS patch level. Patching after compromise does not remove an already-planted shell.

🧰

Commodity Follow-on

Access consistent with mass exploitation typically feeds SEO spam injection, cryptominers, or resale to access brokers rather than hands-on-keyboard intrusion.

📤

Data at Risk

Code execution as the web user exposes wp-config.php secrets, database credentials, and customer PII stored in the WordPress database.

📊

Exposure & Scale

Phase 07

The blast radius is a function of two things: WordPress's install base, and how many of those installs meet the RCE preconditions. Both point to a very large exposed population.

Relative daily attack volume against CVE-2026-87902 from Sep 22 to Sep 25, 2026
Figure 2 — Relative attack volume: a tenfold jump between the Sep 22 recon wave and the Sep 23 file-write wave (Patchstack telemetry, indexed).
Exposure factorDetail
Install baseWordPress powers an estimated 40%+ of all websites (W3Techs) — the largest single CMS footprint on the internet
Version spanEvery release 4.7.0 – 7.1.1 is affected — nearly a decade of installs, including long-unmaintained sites
RCE precondition 1Active theme with a top-level directory named page-* (e.g. page-templates/)
RCE precondition 2register_argc_argv=On — default in official PHP Docker images and cPanel PHP < 8.5
Honeypot signalPrevidian recorded 68 distinct exploitation attempts across its sensor network in the first reporting window
CorroborationPatchstack, BleepingComputer, The Hacker News, Security Affairs, CSA Singapore (AL-2026-128), CISA KEV
🔎

Indicators of Compromise

Phase 08

IOCs below are drawn from Patchstack and Previdian telemetry. Treat source IPs as low-confidence and short-lived — the value is in the request patterns and dropped filenames, which are far more durable across the campaign.

Source IPs — observed exploitation
IndicatorTypeSource
169.58.48.193IPv4Patchstack
169.58.48.195IPv4Patchstack
2001:df1:e8c0::106bIPv6Patchstack
104.194.9.227IPv4 (New Jersey)Previdian honeypot
43.250.53.42IPv4Previdian honeypot
180.251.159.243IPv4 (Indonesia)Previdian honeypot
Host & network artifacts
IndicatorTypeNotes
/tmp/poc87902.phpFile pathFirst-stage write via pearcmd config-create
/var/tmp/*.phpFile pathAlternate write location for droppers
wp-pear-rce-flag.phpFilenameProof-of-exploitation marker
luci_<random>.php / zeta_<random>.phpFilenameRandomized-suffix webshells (docroot)
raw.githubusercontent[.]com/MrG3P5/web-shell/refs/heads/main/uploader.phpURLSecond-stage webshell source
pagename=..%252f / ..%252e%252e%252fRequest paramDouble-encoded traversal in pagename
pearcmd + config-create in query stringRequest patternPEAR RCE chain marker
📡

Detection & Hunt Queries

Phase 09

The most reliable detections target the request shape, not the source IP. Below are paired Microsoft Sentinel (KQL) and Splunk (SPL) queries against web access logs, a raw log grep for quick triage, and a YARA rule for the dropped artifacts. Adjust table and sourcetype names to your ingestion.

DETECTS: Requests carrying a pagename value with encoded traversal — the core exploitation signature.
KQL — Microsoft Sentinel (web access logs)
// Encoded traversal in the pagename query parameter WordPressAccess_CL | where RequestURI has "pagename=" | where RequestURI matches regex @"(?i)pagename=.*(%25?2e%25?2e%25?2f|\.\./)" | extend Suspicious = RequestURI has_any ("pearcmd", "config-create", "/tmp/", "/var/tmp/") | project TimeGenerated, SrcIP, RequestURI, Suspicious, ResponseCode | sort by TimeGenerated desc
SPL — Splunk equivalent
index=web sourcetype=nginx:access uri_query="*pagename=*" | regex uri_query="(?i)pagename=.*(%252e%252e%252f|%2e%2e%2f|\.\.\/)" | eval suspicious=if(match(uri_query,"(?i)pearcmd|config-create|/tmp/|/var/tmp/"),"yes","no") | table _time src_ip uri_path uri_query suspicious status | sort - _time
DETECTS: The PEAR RCE chain specifically — pearcmd reached over HTTP with config-create arguments.
KQL — PEAR config-create abuse
WordPressAccess_CL | where RequestURI has "pearcmd" and RequestURI has "config-create" | where RequestURI has_any ("/tmp/", "/var/tmp/", ".php") | summarize attempts=count(), paths=make_set(RequestURI, 20) by SrcIP, bin(TimeGenerated, 1h)
SPL — PEAR config-create abuse
index=web sourcetype=nginx:access uri_query="*pearcmd*" uri_query="*config-create*" | stats count as attempts values(uri_query) as queries by src_ip | where attempts > 0
DETECTS: Newly written PHP files in temp directories — the first-stage write artifact, hunted on the host.
Bash — host-side triage (Linux WordPress hosts)
$ # PHP files written to temp dirs in the last 3 days $ find /tmp /var/tmp -name "*.php" -mtime -3 -ls $ # known-bad markers anywhere under the webroot $ grep -RIl "pear-rce-flag\|poc87902\|MrG3P5" /var/www 2>/dev/null $ # access-log one-liner: encoded traversal in pagename $ grep -Ei "pagename=[^& ]*(%252e%252e%252f|%2e%2e%2f|\.\./)" /var/log/nginx/access.log
DETECTS: Dropped PoC/webshell files on disk by content and naming.
YARA — CVE-2026-87902 droppers
rule WP_CVE_2026_87902_pearcmd_dropper { meta: description = "WordPress CVE-2026-87902 pearcmd LFI-to-RCE artifacts" reference = "CVE-2026-87902" strings: $a = "pear-rce-flag" ascii nocase $b = "poc87902" ascii nocase $c = "MrG3P5/web-shell" ascii nocase $d = "config-create" ascii nocase $php = "<?php" ascii condition: $php and any of ($a,$b,$c,$d) }

Alert on HTTP 200 responses to pagename-traversal requests, not just the requests themselves. A 200 on a request that should have been a 404 is the strongest single signal that the inclusion resolved and the host is genuinely exploitable.

🎯

MITRE ATT&CK Mapping

Phase 10
TacticTechniqueIDApplication to CVE-2026-87902
ReconnaissanceActive Scanning: Vulnerability ScanningT1595.002Fingerprinting probes against core files via pagename traversal
Initial AccessExploit Public-Facing ApplicationT1190Unauthenticated RFI in WordPress core over the web
ExecutionCommand and Scripting Interpreter: PHPT1059RCE via included pearcmd.php + register_argc_argv
PersistenceServer Software Component: Web ShellT1505.003uploader.php and luci_/zeta_ webshells planted in docroot
Defense EvasionObfuscated/Encoded Files or InformationT1027Double URL-encoded traversal to bypass decoding
Command & ControlIngress Tool TransferT1105Second-stage webshell pulled from raw.githubusercontent
🩹

Mitigation & Hardening

Phase 11
01
Patch — the Only Complete Fix
Priority 1

Update to 7.1.2 or the backport matching your branch (7.0.6, 6.9.9, 6.8.10, or the fix on your supported branch to 4.7). WordPress auto-updates handle minor releases for most sites — verify it actually applied rather than assuming.

WP-CLI — verify and force the update
$ wp core version # confirm current version $ wp core update # pull the latest patched release $ wp core update --version=7.1.2 # or pin to your branch's backport $ wp core verify-checksums # confirm core files are unmodified
02
Break the RCE Chain — Disable register_argc_argv
Compensating

If you cannot patch instantly, neutralize the escalation path. Turning off register_argc_argv demotes the bug from RCE to (at worst) local file read, and removing PEAR eliminates the specific gadget entirely. Neither is a substitute for patching.

php.ini + PEAR removal
; php.ini — disable the argv-from-query behaviour register_argc_argv = Off $ # confirm the effective setting per SAPI $ php -i | grep register_argc_argv $ # if PEAR is not used, remove the reachable gadget $ rm -f /usr/local/lib/php/pearcmd.php
03
Virtual Patch & Post-Compromise Sweep
Defense in depth

Add a WAF rule blocking encoded traversal in the pagename parameter and any request combining pearcmd with config-create. Then assume-breach: if you were unpatched and internet-facing before Sep 25, hunt for the artifacts in Phase 08 before you trust the host.

Cleared only when
  • Core updated to 7.1.2 / matching backport and verify-checksums is clean
  • No PHP files with recent mtime in /tmp or /var/tmp
  • No pear-rce-flag / poc87902 / luci_ / zeta_ / uploader.php files under the webroot
  • Access logs reviewed for pagename-traversal requests that returned HTTP 200
  • wp-config.php secrets and DB credentials rotated if code execution is suspected

Patching does not remove a webshell that is already on disk. If exploitation predated your patch, credential rotation and a full artifact sweep are mandatory — otherwise attackers retain access through the planted shell regardless of core version.

📚

Sources & References

Phase 12
NVD — CVE-2026-87902 record (CVSS 8.1, CWE-98) CISA — Known Exploited Vulnerabilities Catalog (added 2026-09-25) BleepingComputer — Hackers start exploiting critical WordPress flaw for code execution The Hacker News — Attackers exploit WordPress CVE-2026-87902 within hours of disclosure Security Affairs — CVE-2026-87902: how close is your WordPress to RCE? CSA Singapore — AL-2026-128: Active exploitation of high-severity WordPress vulnerability

Run WordPress at scale? Feed the CVE-2026-87902 IOCs above into CyberHawk's IOC Scanner to sweep your estate for dropped webshells, and track live exploitation on the Threat Intel feed. For more n-day breakdowns and detection content, follow the CyberHawk Blog.

◈ Stay Connected

Follow CyberHawk Threat Intel for threat intelligence, deployment guides and hands-on SOC tooling content.

🌐 Website ▶️ YouTube ▶️ YouTube (2) 𝕏 Twitter / X ♪ TikTok ✈️ Telegram
🔍 IOC Scanner 🛠️ Live Tools 📚 Courses 🚨 Threat Intel 📝 Blog 📋 SOPs

"They can't exploit you if you are the Exploit."