Welcome to HowToShipIt — practical how-to guides for developers: code, AI tools, and servers, explained step by step.

CVE-2026-87902: How to Check If Your WordPress Site Is Vulnerable and Patch It

Why this one is different

On September 22, 2026, WordPress released version 7.1.2 — a single-fix security release for CVE-2026-87902, an unauthenticated path-traversal flaw in page-template resolution. Within hours of the release, attackers were probing for it. This is now the default rhythm for critical WordPress core bugs: the patch itself tells attackers exactly where to look.

This post walks you through checking whether your site is vulnerable, patching it properly, verifying the fix actually landed, and hunting for signs that someone got in before you patched.

What CVE-2026-87902 actually is

When WordPress renders a page, it decides which theme file to use through a function called get_page_template(). That function builds a list of candidate template filenames — and one of those candidates came from the pagename value in the URL.

On affected versions, that value was never checked for ../ traversal sequences, even though WordPress already validated a neighboring template value. So an anonymous visitor could steer the template lookup to any readable .php file outside the active theme directory, and WordPress would include it. No account needed, no user interaction, reachable straight over the internet.

The file-inclusion portion is broadly reachable. Full remote code execution is conditional: it requires a theme with a suitable top-level page- directory, a readable target PHP file, and PHP’s register_argc_argv setting enabled — the documented chain uses PEAR’s pearcmd.php. That is why the WordPress advisory scores it 9.2 on CVSS 4.0 (Critical) while the NVD’s CVSS 3.1 record shows 8.1 (attack complexity marked high).

Security researcher Robert Ressl found the flaw and reported it privately through WordPress’s HackerOne program in July 2026. On September 25, 2026, CISA added it to the Known Exploited Vulnerabilities catalog, ordering US federal agencies to patch.

Which WordPress versions are affected

Every release from WordPress 4.7.0 through 7.1.1 is affected — nearly a decade of releases. WordPress fixed it in 7.1.2 and backported the fix to every still-supported branch, all the way down to 4.7.37. If you run an older branch, the latest point release on that branch is patched (e.g. 7.0.6, 6.9.9, 6.8.10, 6.7.9, 6.6.9, 6.5.12, 6.4.12, 6.3.12). WordPress 4.6 and older no longer receive security updates at all.

Step 1: Check whether you’re vulnerable

Pick whichever method fits your setup. They all answer the same question.

Method A: The admin dashboard

Log in and go to Dashboard → Updates. Your current version is shown at the top of that screen. Alternatively, scroll to the bottom-right of any admin page — the version number sits in the footer. If the number is anything in the 4.7.0–7.1.1 range, you’re vulnerable.

Method B: WP-CLI

SSH into your server and run this from the WordPress root:

wp core version

Method C: The authoritative API check

WordPress runs a public stable-check API. This one-liner tells you the status of any version:

curl -s https://api.wordpress.org/core/stable-check/1.0/ \
  | python3 -c "import json,sys; d=json.load(sys.stdin); v='6.4.7'; print(v, '→', d.get(v,'unknown'))"

insecure means affected, outdated means the patched tip of an old branch, latest means you’re current. Swap in your own version.

Step 2: Back up before you touch anything

Even routine security updates deserve a rollback path. Back up both files and the database, and keep a copy off the server. From the command line:

wp db export backup-before-security-patch.sql

Files can go through your hosting panel’s backup tool or a simple archive of the WordPress root (excluding the cache directory if it’s huge).

Step 3: Apply the update

Via the dashboard

Go to Dashboard → Updates and click Update Now. If you’re on the 7.1 branch you’ll land on 7.1.2. If you’re on an older branch, the Updates screen offers the appropriate backported security release — take it.

If your site has automatic background updates enabled (the WordPress default for minor releases), there’s a good chance the patch already installed itself. Check the version anyway — auto-updates fail silently more often than people realize, usually because of file permission problems.

Via WP-CLI

wp core update

This moves you to the newest release on your branch. To pin a specific version (useful on staging):

wp core update --version=7.1.2 --force

Step 4: Verify the patch actually landed

Don’t skip this. Revisit Dashboard → Updates and confirm the screen and the admin footer both report the patched version. From the command line:

wp core version
wp core verify-checksums

If verify-checksums flags modified core files, don’t ignore it — it can mean a failed partial update, or worse, that files were altered by someone else. Replace any unexpected files from a clean WordPress archive.

Can’t update right now? Temporary mitigations

These reduce exposure but are not substitutes for the update.

1. Disable register_argc_argv in PHP

This neutralizes the command-line argument injection leg of the documented RCE chain:

register_argc_argv = Off

Check the current value with php -i | grep -i register_argc_argv.

2. Block traversal attempts at the web server

Nginx:

if ( $query_string ~* "pagename=.*(\.\.|%2e%2e)" ) {
    return 403;
}

Apache (.htaccess or VirtualHost):

RewriteEngine On
RewriteCond %{QUERY_STRING} pagename=.*(\.\.|%2e%2e) [NC]
RewriteRule .* - [F,L]

One caution: a web-application firewall rule alone is not a fix. Wordfence, for example, pushed a rule to premium users the day of disclosure but free users don’t receive it until October 22, 2026 under their standard 30-day delay. Firewalls buy time; only the core update closes the flaw.

Was your site exposed before you patched? Hunt for footprints

Patching prevents new exploitation — it does not remove an attacker who already got in. If your site was unpatched at any point after September 22, 2026, check for these:

  • Unfamiliar administrator accounts under Users → All Users.
  • Plugins or themes you didn’t install.
  • Unexpected PHP files, especially in wp-content/uploads/. Filenames observed in live attacks include wp-pear-rce-flag.php, poc87902.php, and files matching luci_*.php / zeta_*.php.
  • Suspicious requests in your access logs — page names with encoded traversal sequences (..%2f, %252e) or requests probing for pearcmd.php.

If you find any of these, treat it as an active compromise: restore from a known-clean backup, rotate all credentials, and get professional incident-response help rather than just cleaning files.

What I did on this site

HowToShipIt itself runs WordPress 7.1.2 — verified on October 6, 2026 via Dashboard → Updates. So while this is timely for the wider WordPress ecosystem, this blog was patched before this post was written.

Further Reading & References

Leave a Comment