Administrator checking a WordPress security update on a monitor, illustrating the CVE-2026-87902 fix. Administrator checking a WordPress security update on a monitor, illustrating the CVE-2026-87902 fix.

CVE-2026-87902: WordPress 7.1.2 patches critical RCE flaw

WordPress 7.1.2 fixes a critical flaw in page template resolution that could let an unauthenticated attacker include a local PHP file and, under specific conditions, run code. Update affected sites now.

WordPress 7.1.2, released on September 22, 2026, fixes CVE-2026-87902, a critical security flaw in page template resolution. Site owners should check their WordPress version and update immediately; the fix is backported to supported security branches as far back as 4.7.

The short version: An unauthenticated attacker could make WordPress include a chosen readable local PHP file outside the active theme directories. That file inclusion could lead to remote code execution if the server and active theme meet specific conditions. WordPress recommends installing 7.1.2 now, and sites with automatic background updates should receive the fix automatically.

What CVE-2026-87902 affects

The vulnerability sits in page template resolution, the process WordPress uses to find a template for a page. The official WordPress 7.1.2 release notice describes an unauthenticated attacker causing WordPress, under certain conditions, to include a chosen readable local PHP file outside the active theme directories. The release warns that this can lead to remote code execution when the required server and theme conditions are present.

Patchstack’s same-day analysis identifies the affected range as WordPress 4.7.0 through 7.1.1 and rates the issue CVSS 9.2. It classifies the flaw as CWE-98, improper control of a filename in an include statement. The vulnerability is tracked as CVE-2026-87902 and GHSA-7hp8-65ch-5whp.

The bug is in get_page_template() in wp-includes/template.php. In Patchstack’s account, the function built a candidate template filename from the pagename query parameter without applying validation used by another branch. That gap could allow a request to direct template resolution beyond the active theme’s directories.

When file inclusion can become code execution

File inclusion and arbitrary code execution are related, but they are not the same outcome. The flaw could make WordPress include a readable local PHP file; whether that leads to code execution depends on the contents of an available file and the server’s configuration.

Patchstack says exploitation requires no login, an active theme with a top-level directory whose name starts with page-, and PHP’s register_argc_argv setting enabled. Its analysis says that configuration is common in Docker and in cPanel environments running PHP below 8.5. These conditions make the issue conditional, not harmless: site owners should not assume their setup is safe without verifying it.

The theme requirement matters because the vulnerable lookup constructs a filename using the page name. An active theme with a qualifying directory can provide the necessary path context. The server setting is a separate condition associated with reaching code execution, so the risk can vary across hosting setups.

There is no need for site owners to reproduce the attack to respond. Checking the WordPress version and applying the security release is the practical step. Avoid testing exploit requests on a production site.

Update WordPress to 7.1.2

WordPress recommends updating immediately. From the dashboard, open Updates and choose Update Now, or install the release through the site’s normal update process. The WordPress release notice says the update process begins automatically on sites that support automatic background updates.

The fix was backported to every branch eligible for security fixes, through WordPress 4.7. WordPress also reminds users that only the newest release is actively supported. If an older branch is in use, confirm that its security update has been applied rather than assuming the site is protected because the release exists.

After updating, verify that the site reports version 7.1.2 or the applicable patched branch. If updates are managed by a host, agency, or deployment process, confirm completion with the person or system responsible. Keep a record of the updated version as part of the site’s security maintenance.

Who reported the flaw and who led the release

Robert Ressl reported the vulnerability. John Blackbourn led the 7.1.2 release, which the WordPress announcement credits to more than 30 contributors.

The affected range reaches back to 4.7.0, so this is relevant to sites running old installations as well as current releases. The patch’s availability across eligible branches gives owners of older sites an update path, but it does not replace the need to apply the update.

FAQ

Does CVE-2026-87902 require a WordPress login?

No. Patchstack describes the vulnerability as unauthenticated, meaning an attacker does not need a WordPress account to attempt exploitation. Remote code execution depends on additional server and theme conditions.

Which WordPress versions are affected?

Patchstack lists WordPress 4.7.0 through 7.1.1 as affected. WordPress says the fix was backported to security-supported branches through 4.7.

What should I do if automatic updates are enabled?

WordPress says sites that support automatic background updates should begin updating automatically. Check the site’s installed version to confirm the fix is in place, especially if updates are managed by a host or agency.

Next step: Check every WordPress installation you manage and apply 7.1.2 or its applicable security backport now.

Leave a Reply

Your email address will not be published. Required fields are marked *