Summary
CVE-2026-87902 is a Local File Inclusion vulnerability in WordPress core’s page-template resolution logic, affecting all WordPress installations from version 4.7.0 through 7.1.1. An unauthenticated remote attacker can abuse the get_page_template() function to force inclusion of an arbitrary readable local .php file located outside the active theme’s directories. Under specific server and theme conditions this can escalate to full remote code execution, and the flaw carries a NVD-reported CVSS v3.1 score of 8.1 (High).
Technical details
- Root cause: Improper restriction of the file path used by
get_page_template()when resolving page templates (CWE-98, PHP Remote/Local File Inclusion) allows path traversal outside the active theme directory. - Trigger conditions: Exploitation requires the active (child or parent) theme to contain a top-level directory whose name begins with
page-(e.g.page-templates), a pattern present in themes such as Twenty Twelve, Twenty Fourteen, Neve, Hestia, and Sydney. - Attack vector: Fully network-based and unauthenticated — no login, privileges, or user interaction are required to reach the vulnerable code path.
- Impact: At minimum, disclosure/inclusion of arbitrary readable PHP files on the server. Full remote code execution is possible when a suitable "gadget" PHP file is reachable and includable — the advisory specifically calls out
pearcmd.phpcombined with PHP’sregister_argc_argvsetting enabled (a default in some official PHP Docker images and certain older cPanel configurations) as a known RCE chain.
Affected software
- WordPress core, all versions from 4.7.0 up to and including 7.1.1
- Exploitability additionally depends on the active theme containing a
page--prefixed top-level directory and on server-side PHP configuration/file availability
Severity
- CVSS v3.1 Base Score: 8.1 (High)
- Vector:
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H - Attack Vector: Network, Attack Complexity: High, Privileges Required: None, User Interaction: None, Confidentiality/Integrity/Availability Impact: High
Mitigation and recommended actions
- Immediate: Update WordPress to the patched release for your branch — 7.1.2, 7.0.6, 6.9.9, 6.8.10, or the corresponding backported fix down through 4.7.37. Updates can be applied via the WordPress Dashboard, automatic background updates, or manual download from WordPress.org.
- If immediate patching is not possible:
- Review the active theme for any top-level directory beginning with
page-and rename or remove it if not required. - Check whether
register_argc_argvis enabled in the server’s PHP configuration and disable it if not needed. - Restrict or remove access to
pearcmd.phpand other unnecessary PHP files reachable on the filesystem. - Prioritize upgrading immediately regardless of interim mitigations, since only the latest supported version line receives full protection going forward.
- Review the active theme for any top-level directory beginning with

