Safeguard
Vulnerability Analysis•

WordPress CVE-2026-87902: Page Template Path Traversal in CISA KEV

An unauthenticated path traversal in WordPress core page template resolution can lead to RCE. Fixed in 7.1.2 and backported to 4.7. CISA added it to KEV on 25 September.

Safeguard Security Team
5 min read

On 22 September 2026 WordPress released 7.1.2, a security release with one critical fix. CVE-2026-87902 lets an unauthenticated attacker make page template resolution include a chosen readable local PHP file outside the active theme directories. Three days later, on 25 September, CISA added it to the Known Exploited Vulnerabilities catalog with a federal due date of 28 September.

Core vulnerabilities in WordPress are rare, and core bugs that lead to code execution without a login are rarer still. This one has preconditions, but the common ones are met by stock Docker images and some popular themes.

What's affected

The advisory, GHSA-7hp8-65ch-5whp, credits Robert Ressl and rates it 9.2 under CVSS 4.0. The fix shipped in 7.1.2 and was backported to every branch back to 4.7. Each branch's fixed release:

BranchFixed inBranchFixed in
7.17.1.25.95.9.18
7.07.0.65.85.8.17
6.96.9.95.75.7.19
6.86.8.105.65.6.21
6.76.7.95.55.5.22
6.66.6.95.45.4.23
6.56.5.125.35.3.25
6.46.4.125.25.2.28
6.36.3.125.15.1.26
6.26.2.135.05.0.29
6.16.1.144.94.9.33
6.06.0.164.84.8.32
4.74.7.37

Remote code execution needs two conditions, according to the advisory:

  • Theme condition. The active child or parent theme has a top level directory whose name starts with page-, such as page-templates. That includes the legacy Twenty Twelve and Twenty Fourteen themes and third party themes such as Neve, Hestia and Sydney.
  • Server condition. A readable local .php file exists that turns inclusion into execution. The advisory names the well known pearcmd.php technique, which works when register_argc_argv is On. It says the official php Docker image is affected, as is the default cPanel configuration with PHP older than 8.5.

Without both, the bug is a file inclusion with limited impact. With both, it is unauthenticated RCE.

How to check if you're exposed

Check the core version on every site:

wp core version --allow-root
# or without WP-CLI
grep "wp_version =" wp-includes/version.php

Check whether the active theme meets the theme condition:

THEME=$(wp option get stylesheet --allow-root)
PARENT=$(wp option get template --allow-root)
ls -d wp-content/themes/$THEME/page-*/ wp-content/themes/$PARENT/page-*/ 2>/dev/null

Check the server condition:

php -r 'var_dump(ini_get("register_argc_argv"));'
find / -name pearcmd.php -readable 2>/dev/null

For hunting, the advisory does not publish request patterns. Look for requests in web server logs that mention pearcmd, and for PHP files that appeared recently in directories the web server can write to:

grep -i "pearcmd" /var/log/nginx/access.log* /var/log/apache2/access.log* 2>/dev/null
find /var/www /tmp -name "*.php" -newermt "2026-09-20" -type f 2>/dev/null

What to do now

  1. Update to 7.1.2 or later. 7.1.3, released 6 October, adds seven more security fixes, so go straight to it if you are on the 7.1 branch. Sites with automatic background updates should already have the fix, but verify rather than assume.
  2. If a site can't leave an older branch, install that branch's fixed release from the table. WordPress notes that only the most recent version is actively supported.
  3. Set register_argc_argv = Off in php.ini for web PHP, and remove PEAR from production images if nothing uses it. That breaks the known escalation path even if another inclusion bug turns up.
  4. Rebuild container images that were based on the official php image. Pin the rebuilt tag so the next deploy doesn't roll back the core version.
  5. If hunting turns up unexpected PHP files or pearcmd requests, take the site offline, preserve logs, rotate database credentials and the secret keys in wp-config.php, and reset admin passwords.

Why it matters

The fix itself is small. The exposure comes from where WordPress lives: forgotten marketing microsites, agency built sites on shared hosting, and containers built once and never rebuilt. Background updates help, but a pinned Docker image or a host with updates disabled stays on the vulnerable build until someone notices.

It also shows how environment defaults decide severity. The same core bug is low impact on one host and critical on another, depending on a PHP setting and an unused PEAR install. Hardening those defaults pays off across many future bugs, not just this one.

Try it yourself

Pick one WordPress container image you run and check two things: the WordPress core version baked into it, and whether pearcmd.php is present. If the image ships PEAR and register_argc_argv is on, you have found a hardening task worth doing regardless of this CVE.

This demo walks through scanning a container image for vulnerable components:

Click through it at your own pace, or open it full screen.

Quick check

Is every WordPress site vulnerable to RCE through CVE-2026-87902?

No. RCE needs a theme with a top level directory starting with page- and a readable local PHP file that turns inclusion into execution, such as pearcmd.php with register_argc_argv on. Every unpatched site is still affected by the underlying path traversal, so patch regardless.

I run WordPress 6.4. Do I have to jump to 7.1?

Not for this CVE. The fix was backported to 6.4.12. WordPress only actively supports the latest version, though, so plan the upgrade.

Which release fixed it?

WordPress 7.1.2, released on 22 September 2026, with backports to all branches back to 4.7.

Sources

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.