php2shell: Assessing Elastic detection coverage relevant to CVE-2026-109618 and CVE-2026-109619
Two critical unauthenticated PHP core RCE flaws (CVE-2026-109618, CVE-2026-109619) enable remote attackers to execute code via web requests; patches exist but no in-the-wild exploitation observed yet. Both CVEs are unauthenticated PHP core RCEs rated CVSS v4.0 9.2, exploitable via crafted web requests before application code runs. Post-exploitation converges on web server processes spawning shells, downloading payloads, and dropping webshells — behavior covered by existing Elastic behavioral detections across process and file telemetry.
Authors: Ruben Groenewoud, Bryan Porras Blanch
Source:Elastic Security Labs
Detection / HunterZ.ai
Immediate Actions
- Patch all PHP installations to 8.5.12, 8.4.27, 8.3.36, or 8.2.35 immediately
- Inventory all PHP installs including bundled runtimes in vendor software and control panels
- Isolate unpatched internet-facing PHP systems behind VPN or WAF
- Apply partial php.ini mitigations (session.upload_progress.enabled=0, memory_limit, post_max_size) for unpatchable systems
Key Takeaways
- Patched versions are PHP 8.5.12, 8.4.27, 8.3.36, and 8.2.35; PHP 8.1 and older are EOL
- mod_php flagged highest risk because exploitation triggers before application code runs
- CVE-2026-109618 is OOM corruption; CVE-2026-109619 is stale global state after memory freed
- No complete php.ini mitigation exists; updating is the only safe choice
- Fix commit 31c0ea7d7ff1d1fccb6492e52dab544011628065 addresses both flaws
- Wiz Research identified the flaws using frontier AI models and coordinated disclosure
Attack Chain
- Initial Access: Unauthenticated web request triggers PHP core memory-safety bug (CVE-2026-109618 or CVE-2026-109619)
- Execution: PHP worker process spawns shell (bash, dash, sh) to run discovery commands
- Staging: Attacker pulls second-stage payload via curl/wget or decodes inline with base64
- Persistence: Webshell written to web root or cron/systemd/SSH key added for access survival
- Credential Access: .env files, AWS credentials, Kubernetes secrets, and cloud metadata harvested
- Command and Control: Reverse shell established via bash /dev/tcp, netcat, socat, or Python pty.spawn
Affected Systems
- PHP 8.5 prior to 8.5.12
- PHP 8.4 prior to 8.4.27
- PHP 8.3 prior to 8.3.36
- PHP 8.2 prior to 8.2.35
- PHP 8.1 and older (end of life)
- mod_php, PHP-FPM, php-cgi, FrankenPHP, LiteSpeed
Vulnerabilities (CVEs)
| CVE | Product | Severity | Description |
|---|---|---|---|
| CVE-2026-109618 | PHP core | Critical | Unauthenticated RCE via out-of-memory corruption when request data is partially initialized. |
| CVE-2026-109619 | PHP core | Critical | Unauthenticated RCE via stale global state surviving after backing memory freed. |
Detection Availability
- Published: KQL, EQL, Other detection logic
- Platforms: Elastic protections-artifacts (EDR), Elastic detection-rules (SIEM), Osquery
Elastic EDR and SIEM behavioral rules in public GitHub repos; KQL inventory queries and Osquery queries for PHP discovery.
Detection Engineering Assessment
Hunting Hypotheses
| Hypothesis | Telemetry | Stage | FP Risk |
|---|---|---|---|
| Web server process (apache2, httpd, nginx, php-fpm, php-cgi, lsphp) spawning shell with -c flag and discovery commands like id, whoami, hostname (T1059.004, T1082) | Process execution events | Execution | Low — web servers rarely spawn interactive shells with discovery commands |
| Web server process creating files with .php or .phtml extensions in web root directories (T1505.003) | File creation events | Persistence | Medium — legitimate deployments may write PHP files during updates |
| Web server process spawning curl or wget to download remote files or pipe into interpreter (T1105) | Process execution events | Staging | Low — web servers should not invoke curl/wget directly |
| Web server process accessing 169.254.169.254 metadata endpoint or reading .env and AWS credential files (T1552) | Network connection logs, file access events | Credential Access | Low — web server processes do not normally read credential stores |
Required Log Sources
- Process execution events (Sysmon/EDR)
- File creation events
- Web server access logs
- DNS resolution logs
- Network connection logs
- Package manager inventory
Control Gaps
- No reliable public PoC exists to validate detections end-to-end before exploitation begins
- Fileless PHP script execution may bypass file-creation-based detections
- Account creation by compromised web server may not be covered by existing rules
Recommendations
Infrastructure Hardening
- Set memory_limit=-1 via php_admin_value where applications cannot override
- Disable session.upload_progress.enabled and restart every PHP worker
- Enforce container or cgroup memory limits instead of RLIMIT_AS or RLIMIT_DATA
- Set fatal_error_backtraces=0 on PHP 8.5 deployments
User Protection
- Enable Elastic Defend with prevention on all PHP-serving hosts
- Enable web-server-to-shell behavioral detection rules in SIEM and EDR
- Verify file entropy detection requires Elastic Stack 9.3.0 or later
- Set linux.advanced.events.populate_file_data to true for high-entropy file detection
MITRE ATT&CK Mapping
- cveCVE-2026-109618Unauthenticated RCE via out-of-memory corruption when request data is partially initialized.
- cveCVE-2026-109619Unauthenticated RCE via stale global state surviving after backing memory freed.