Threat actors have escalated exploitation of a critical WordPress vulnerability, moving from reconnaissance activity to attempts to write attacker-controlled PHP files onto vulnerable servers.
The flaw, tracked as CVE-2026-87902, affects WordPress versions 4.7.0 through 7.1.1 and can lead to remote code execution under specific theme and PHP configurations.
WordPress fixed the issue in version 7.1.2 and released backported patches for supported branches down to 4.7.37.
Hackers Exploit Critical WordPress Flaw
The vulnerability stems from an unauthenticated path traversal issue in WordPress page-template resolution. An attacker can abuse the pagename parameter to make get_page_template() include a readable local PHP file outside the active theme directory.
The advisory rates the vulnerability Critical, with a CVSS 4.0 score of 9.2, and identifies it as CWE-98, improper control of a filename used in a PHP include operation.
Patchstack researchers first observed exploitation attempts on September 22, shortly after WordPress 7.1.2 was published. Initial requests focused on confirming whether vulnerable page-template inclusion was possible.
Attackers targeted legitimate WordPress core files, including wp-links-opml.php, RSS feed files, wp-cron.php, wp-login.php, and install.php, using encoded traversal sequences within pagename.
The attack activity has since progressed to a second stage targeting PEAR’s pearcmd.php, a known local-file-inclusion-to-RCE technique. When PHP’s register_argc_argv configuration is enabled, query-string arguments can be passed to pearcmd.php as command-line parameters.
Attackers use this behavior to determine whether PEAR is present and whether the environment can support the next stage of the exploit chain. WordPress’s advisory specifically notes pearcmd.php as a potential route to RCE when register_argc_argv is enabled.
In the final observed stage, threat actors attempt to invoke PEAR’s file-creation functionality to write PHP content into /tmp or /var/tmp. Researchers observed filenames such as wp-pear-rce-flag.php, poc87902.php, and randomized luci_ and zeta_ filenames.
Some payloads create harmless markers to identify exploitable hosts, while others contain short PHP tags designed to execute shell commands when the file is accessed. This indicates that exploitation is no longer limited to scanning and proof-of-concept validation.
Successful exploitation requires several conditions. The active or parent theme must contain a top-level directory beginning with page-, such as page-templates; the server must expose a readable PHP file suitable for inclusion; and the targeted site must have a publicly reachable WordPress Page.
PEAR’s pearcmd.php and an enabled register_argc_argv setting create the best-known path from file inclusion to code execution. Administrators should urgently update WordPress to 7.1.2 or the applicable backported release.
Until patching is complete, defenders should reject traversal sequences in pagename, disable register_argc_argv where feasible, and hunt web logs for encoded traversal strings, pearcmd, config-show, config-create, and suspicious combinations of pagename and page_id.
Any unexpected PHP file in /tmp or /var/tmp should be treated as a potential compromise indicator and investigated immediately.
Join 16,000+ SOC teams using ANY.RUN to streamline threat investigations and reduce manual effort. Explore for your team