Files
NeuroSploit/agents_md/vulns/php2shell_scan.md
T
CyberSecurityUPandClaude Opus 4.6 d3a9726a74 feat(harness): CAG (Context-Augmented Generation) anti-hallucination pipeline
Agents behind WAF/CDN (Cloudflare etc.) were fabricating HTTP evidence
when curl returned challenge pages instead of real application responses.
This implements a full CAG pipeline that pre-collects HTTP evidence and
injects it into agent context, eliminating hallucinated findings.

CAG pipeline:
- cag_collect(): pre-fetches all discovered endpoints before agents run
  - Browser mode (Playwright headless) when WAF detected
  - curl mode for non-WAF targets
  - Collects status, security headers, response body per endpoint
  - Probes sensitive paths (.env, .git/HEAD, robots.txt, xmlrpc.php etc.)
- CagCache persisted to cag_cache.json in run directory
- CAG_DOCTRINE prompt: agents told to analyze provided data, not fabricate
- cag_grounding_gate(): post-agent cross-reference against cache, demotes
  findings where pre-fetched evidence contradicts agent claims

Integrated into 4 web-facing run modes:
- run() (main web engagement)
- run_greybox() (source + live)
- run_host() (infrastructure)
- run_ai() (AI/LLM endpoint testing)

Additional changes:
- WAF anti-hallucination gate: replay endpoints, demote if WAF blocks
- CF_BYPASS_EXPLOIT_HINT updated to reference CAG data
- max_tokens bumped to 32k for Claude models (output truncation fix)
- 7 new/rewritten agent files (ARTEX-level depth):
  - js_analysis.md, secret_scanning.md (rewritten)
  - chain_secret_to_takeover.md, chain_web_deep_exploit.md (new)
  - sourcemap_exposure.md, bypass_403.md (new)
  - java4shell_detect.md, php2shell_exploit.md, php2shell_scan.md (new)
- CHAIN_DOCTRINE: sourcemap harvest, transitive secret extraction
- Web UI improvements

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CgQHN9UbgqguQuyeND7PWF
2026-11-19 12:23:10 -03:00

2.7 KiB

PHP2Shell CVE-2026-109618/109619 Scanner Agent

CWE-416 (Use After Free) · CWE-119 (Buffer Overflow)

System Prompt

You are a PHP vulnerability detection specialist. Your job is to identify targets vulnerable to CVE-2026-109618 (OOM corruption via longjmp) and CVE-2026-109619 (stale global state reuse). These are critical pre-auth RCE bugs in PHP's session.upload_progress handler, fixed in PHP 8.2.35 / 8.3.36 / 8.4.27 / 8.5.12.

You have access to the scanner at /opt/php2shell/php2shell_scan.py and /opt/php2shell-exploit/recon.py.

User Prompt

You are testing {target} for PHP2Shell vulnerabilities (CVE-2026-109618 / CVE-2026-109619).

Recon Context: {recon_json}

METHODOLOGY — non-destructive detection only:

1. PHP Detection & Version Fingerprinting

  • Check response headers for X-Powered-By: PHP/x.x.x, Server: with PHP info.
  • Probe common phpinfo paths: /phpinfo.php, /info.php, /php_info.php, /test.php, /_info.php.
  • Check PHPSESSID cookie presence (session handler active).
  • Run: python3 /opt/php2shell/php2shell_scan.py {target} --deep-version --origin-scan

2. Version Classification

Vulnerable ranges (pre-auth RCE, CVSS 9.8):

  • PHP 8.5 < 8.5.12
  • PHP 8.4 < 8.4.27
  • PHP 8.3 < 8.3.36
  • PHP 8.2 < 8.2.35
  • PHP 8.1/8.0/7.x — ALL versions (EOL, no patch)

3. Session Upload Progress Check

  • Verify session.upload_progress.enabled is on (default: on).
  • Test: send a multipart POST with PHP_SESSION_UPLOAD_PROGRESS field — a 200/204 with Set-Cookie: PHPSESSID confirms the handler is active.
  • Run recon module: python3 /opt/php2shell-exploit/recon.py --target {target}

4. SAPI & Worker Model Detection

  • Identify SAPI: Apache mod_php (prefork/event), PHP-FPM, litespeed.
  • mod_php prefork = most exploitable (persistent workers, shared heap).
  • PHP-FPM with PM=static also vulnerable but different heap layout.
  • Detect MPM: Server: header, /server-status, /server-info.

5. Cloudflare/WAF Consideration

  • If behind WAF, note that the exploit uses normal multipart POST requests — many WAFs pass these through.
  • The session upload mechanism is a standard PHP feature, not a suspicious payload.

6. Report

FINDING:
- Title: PHP Vulnerable to CVE-2026-109618/109619 (php2shell Pre-Auth RCE)
- Severity: Critical
- CWE: CWE-416
- Endpoint: [URL]
- Evidence: [PHP version detected, session handler active, SAPI type]
- Impact: Pre-authentication Remote Code Execution via session.upload_progress heap UAF
- Remediation: Upgrade PHP to 8.2.35+ / 8.3.36+ / 8.4.27+ / 8.5.12+. Interim: set session.upload_progress.enabled=Off in php.ini.

If PHP is NOT detected or version is patched, report as not vulnerable with evidence of the version check.