Exploit databaseDownload repository ZIP
GH-cc9bda364f58e8812196c41f89e05164
ampedwastaken/php2shell-cve-2026-109618-cve-2026-109619
Sources for CVE-2026-109618
411 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files14
ampedwastaken/php2shell-cve-2026-109618-cve-2026-109619Revision 57a871875d6d
- .github/
- agent/
- docs/
- tests/
- .gitignore
- README.md
- SECURITY.md
- blackbox.py
- local_php_audit.py
- passive_audit.py
- php2shell.py
- shell_canary.py
- targets.example.txt
- web_canary_client.py
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
blackbox.py
Python · 9,028 bytes"""Bounded non-exploit black-box observations for authorized PHP sites.
HTTP HEAD and GET only, against explicit user-supplied URLs. No crawling,
vulnerability payloads, shell commands, uploads, or response-body collection.
"""
from __future__ import annotations
import argparse
import csv
from concurrent.futures import ThreadPoolExecutor, as_completed
from datetime import datetime, timezone
from http.client import HTTPException
from pathlib import Path
import json
import secrets
import sys
from time import monotonic
from urllib.error import HTTPError, URLError
from urllib.request import HTTPRedirectHandler, Request, build_opener
from passive_audit import load_targets, MAX_WORKERS, VERSION
class NoRedirect(HTTPRedirectHandler):
def redirect_request(self, req, fp, code, msg, headers, newurl):
return None
def request_metadata(url: str, method: str, run_id: str, timeout: float) -> dict:
"""Perform exactly one request. Only keep selected response metadata."""
started = monotonic()
result = {
"method": method,
"status": None,
"elapsed_ms": 0,
"content_type": None,
"server": None,
"php_disclosure": None,
"php_version_disclosed": None,
"hsts": False,
"csp": False,
"nosniff": False,
"redirect_location": None,
"waf_challenge_or_denial": False,
"error": None,
}
req = Request(
url,
method=method,
headers={"User-Agent": "PHP2Shell-Blackbox-Observation/1.0",
"X-PHP2S-Audit-ID": run_id, "Cache-Control": "no-store"},
)
try:
opener = build_opener(NoRedirect())
try:
resp = opener.open(req, timeout=timeout)
except HTTPError as exc:
resp = exc
with resp:
headers = resp.headers
status = resp.status
result["status"] = status
result["content_type"] = (headers.get("Content-Type") or "")[:128] or None
result["server"] = (headers.get("Server") or "")[:128] or None
powered = (headers.get("X-Powered-By") or "")[:128]
result["php_disclosure"] = powered if "php" in powered.lower() else None
match = VERSION.search(powered) or VERSION.search(result["server"] or "")
if match:
result["php_version_disclosed"] = match.group(1)
result["hsts"] = bool(headers.get("Strict-Transport-Security"))
result["csp"] = bool(headers.get("Content-Security-Policy"))
result["nosniff"] = (headers.get("X-Content-Type-Options") or "").lower() == "nosniff"
if status in (301, 302, 303, 307, 308):
result["redirect_location"] = (headers.get("Location") or "")[:256] or None
result["waf_challenge_or_denial"] = status in (403, 406, 429)
# Deliberately do not read or retain any response body, cookies,
# or potentially sensitive application content.
except (URLError, HTTPException, OSError, ValueError) as exc:
result["error"] = f"{type(exc).__name__}: {str(exc)[:160]}"
finally:
result["elapsed_ms"] = int((monotonic() - started) * 1000)
return result
def summarize(head: dict, get: dict) -> dict:
version = get.get("php_version_disclosed") or head.get("php_version_disclosed")
banners = [x for x in (head.get("php_disclosure"), get.get("php_disclosure")) if x]
hints = []
if version:
hints.append("HTTP server disclosed a PHP version; this is not an attested installed build.")
try:
major, minor = (int(v) for v in version.split(".")[:2])
if major < 8 or (major == 8 and minor <= 1):
hints.append("Disclosed PHP branch has ended upstream security support; verify vendor backports.")
except (ValueError, IndexError):
pass
if head["status"] == 405 and get["status"] is not None:
hints.append("HEAD is unsupported; GET was tested separately.")
if head["waf_challenge_or_denial"] or get["waf_challenge_or_denial"]:
hints.append("An HTTP denial/challenge was seen; this does NOT establish CVE blocking.")
if not banners:
hints.append("No PHP version disclosed in response headers; actual technology is unknown.")
return {
"version_disclosed": version,
"observations": hints,
"cve_exploitability": "NOT_TESTED",
"rce_result": "NOT_TESTED",
"defender_blocked_exploit": "NOT_DETERMINED",
"evidence_level": "HTTP_METADATA_ONLY",
}
def inspect(url: str, timeout: float) -> dict:
run_id = secrets.token_hex(16)
head = request_metadata(url, "HEAD", run_id, timeout)
get = request_metadata(url, "GET", run_id, timeout)
return {
"url": url,
"audit_id": run_id,
"methods": [head, get],
"assessment": summarize(head, get),
}
def run_blackbox(*, url: str | None, targets: str | None, workers: int,
timeout: float, output: str, csv_output: str | None) -> tuple[dict, int]:
if not 1 <= workers <= MAX_WORKERS:
raise ValueError(f"workers must be 1..{MAX_WORKERS}")
if not 0.5 <= timeout <= 20:
raise ValueError("timeout must be 0.5..20 seconds")
urls = load_targets(targets, url)
by_url = {}
with ThreadPoolExecutor(max_workers=workers) as executor:
futures = {executor.submit(inspect, item, timeout): item for item in urls}
for future in as_completed(futures):
by_url[futures[future]] = future.result()
results = [by_url[item] for item in urls]
errors = sum(
all(method["status"] is None for method in result["methods"])
for result in results
)
report = {
"mode": "blackbox-http-observation",
"created_utc": datetime.now(timezone.utc).isoformat(),
"methodology": "Exactly one HEAD and one GET to each supplied URL, no redirects, no body retained",
"authorization": "Operator must own or have permission to audit each target",
"http_verification": "PERFORMED",
"cve_exploitability": "NOT_TESTED",
"rce_result": "NOT_TESTED",
"defender_blocked_exploit": "NOT_DETERMINED",
"scope_limit": "Cannot verify exploitability without an actual independently validated CVE check",
"targets_total": len(results),
"connection_failures": errors,
"results": results,
}
path = Path(output)
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
if csv_output:
dest = Path(csv_output)
dest.parent.mkdir(parents=True, exist_ok=True)
with dest.open("w", newline="", encoding="utf-8") as handle:
columns = ["url", "audit_id", "head_status", "get_status",
"php_version_disclosed", "cve_exploitability",
"defender_blocked_exploit"]
writer = csv.DictWriter(handle, fieldnames=columns)
writer.writeheader()
for row in results:
writer.writerow({
"url": row["url"], "audit_id": row["audit_id"],
"head_status": row["methods"][0]["status"],
"get_status": row["methods"][1]["status"],
"php_version_disclosed": row["assessment"]["version_disclosed"],
"cve_exploitability": row["assessment"]["cve_exploitability"],
"defender_blocked_exploit": row["assessment"]["defender_blocked_exploit"],
})
return report, (2 if errors else 0)
def main(argv: list[str] | None = None) -> int:
parser = argparse.ArgumentParser(
prog="php2shell.py blackbox",
description="Non-exploit external PHP website observations, no SSH or tokens.",
)
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument("--url", help="One owned/authorized URL")
group.add_argument("--targets", help="File of owned/authorized websites, one per line")
parser.add_argument("--workers", type=int, default=4)
parser.add_argument("--timeout", type=float, default=6)
parser.add_argument("--output", default="evidence/blackbox.json")
parser.add_argument("--csv")
args = parser.parse_args(argv)
try:
report, status = run_blackbox(
url=args.url, targets=args.targets, workers=args.workers,
timeout=args.timeout, output=args.output, csv_output=args.csv,
)
except (OSError, ValueError) as exc:
print(f"Blackbox audit error: {exc}", file=sys.stderr)
return 3
print(f"HTTP observations: {report['targets_total']} targets, "
f"{report['connection_failures']} with no HTTP response")
print("CVE exploitation: NOT_TESTED; exploit block: NOT_DETERMINED")
print(f"Evidence: {args.output}")
return status
if __name__ == "__main__":
raise SystemExit(main())