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:
| Branch | Fixed in | Branch | Fixed in |
|---|---|---|---|
| 7.1 | 7.1.2 | 5.9 | 5.9.18 |
| 7.0 | 7.0.6 | 5.8 | 5.8.17 |
| 6.9 | 6.9.9 | 5.7 | 5.7.19 |
| 6.8 | 6.8.10 | 5.6 | 5.6.21 |
| 6.7 | 6.7.9 | 5.5 | 5.5.22 |
| 6.6 | 6.6.9 | 5.4 | 5.4.23 |
| 6.5 | 6.5.12 | 5.3 | 5.3.25 |
| 6.4 | 6.4.12 | 5.2 | 5.2.28 |
| 6.3 | 6.3.12 | 5.1 | 5.1.26 |
| 6.2 | 6.2.13 | 5.0 | 5.0.29 |
| 6.1 | 6.1.14 | 4.9 | 4.9.33 |
| 6.0 | 6.0.16 | 4.8 | 4.8.32 |
| 4.7 | 4.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 aspage-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
.phpfile exists that turns inclusion into execution. The advisory names the well knownpearcmd.phptechnique, which works whenregister_argc_argvisOn. It says the officialphpDocker 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
- 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.
- 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.
- Set
register_argc_argv = Offinphp.inifor 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. - Rebuild container images that were based on the official
phpimage. Pin the rebuilt tag so the next deploy doesn't roll back the core version. - If hunting turns up unexpected PHP files or
pearcmdrequests, take the site offline, preserve logs, rotate database credentials and the secret keys inwp-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.