PHP2Shell: How It Was Found, What It Is, and How to Fix It
Learn how researchers found PHP2Shell, how the PHP vulnerabilities work, which versions are affected, and how to patch your servers.
By Shaykh Farhan
- PHP2Shell
- PHP Security
- Remote Code Execution
- CVE-2026-109618
- CVE-2026-109619

PHP2Shell is the name given to CVE-2026-109618 and CVE-2026-109619, two critical PHP vulnerabilities that can allow an unauthenticated attacker to run code on a server. Their discovery connects an old memory-handling concern, an external security audit, and AI-assisted research. PHP released fixes on October 21, 2026.
If you run PHP, the immediate action is to update the PHP runtime serving your site and restart its workers. Updating an application or framework alone does not patch the runtime.
This article is dated to the patch release. Its guidance also includes developments checked on November 15, 2026, including a later session upload progress advisory.
How was PHP2Shell found?
The path to PHP2Shell began before its 2026 disclosure. According to the PHP Foundation, a PHP core developer found early signs of the out-of-memory problem while fixing an issue from a 2024 security audit conducted by Quarkslab and organized through OSTIF. A potential exploit was theorized, but the team had not found a concrete attack path. Fixing the underlying behavior involved difficult compatibility and denial-of-service tradeoffs, and work stalled and restarted.
On July 30, 2026, security firm Calif began auditing PHP through OpenAI’s Patch the Planet initiative. Calif says its researchers revisited earlier PHP memory-limit research and used an AI assistant to examine how fatal errors could interrupt the interpreter. They found a way to combine an out-of-memory condition with interrupted request handling and demonstrate remote code execution. Calif describes the investigation in its technical write-up.
The PHP Foundation says Calif researcher Ryan A reported remote code execution on August 11. OpenAI independently reported the same root cause, and Wiz and OpenAI reported additional attack paths. Those reports made the impact clear and gave PHP’s security team concrete cases to address. AI assisted the research; researchers and PHP maintainers still had to validate the findings and develop the fixes.
The coordinated release was originally planned for October 22. After the CVE identifiers circulated on October 20, PHP moved the release forward to October 21. Amazon Threat Intelligence later reported an exploitation attempt against its honeypot on October 17. An observed attempt does not mean every exposed system was compromised.
What is PHP2Shell?
PHP2Shell covers two related memory-safety vulnerabilities in PHP itself. Both are rated 9.2 critical under CVSS v4.0 by PHP. Depending on the deployment and attack path, an unauthenticated attacker can execute code with the web worker’s privileges.
CVE-2026-109618: out-of-memory corruption. PHP can hit its memory limit while internal request data is only partly initialized. If error handling interrupts initialization at the wrong point, request cleanup may treat the incomplete data as valid. PHP demonstrated remote code execution against Apache mod_php; other server interfaces can also be susceptible under different conditions. See PHP’s advisory.
CVE-2026-109619: stale global state. A PHP worker can retain a reference to memory belonging to a completed request. If a later request reaches that stale state before it is reset, PHP can use freed memory. PHP confirmed memory disclosure and remote code execution, with validated paths against mod_php and PHP-FPM under specific conditions. See PHP’s advisory.
PHP installations serving web requests are at risk, including Apache mod_php, PHP-FPM, php-cgi, FrankenPHP and LiteSpeed. The exact attack paths depend on the server, configuration and application. With mod_php, the out-of-memory issue can be triggered before application code runs, so application authentication alone cannot be assumed to stop it.
Which PHP versions are affected?
PHP released the following fixes on October 21. These are the first upstream releases fixing both PHP2Shell CVEs, not a guarantee that they address later security issues. Use the latest supported release available to you.
| PHP branch | First upstream release fixing both CVEs |
|---|---|
| 8.5 | 8.5.12 |
| 8.4 | 8.4.27 |
| 8.3 | 8.3.36 |
| 8.2 | 8.2.35 |
| 8.1 and older | No official patched release; check your distribution or extended-support vendor |
PHP published minimal source-only backports for PHP 7.4, 8.0 and 8.1, rather than official binary releases. Upgrade end-of-life branches where possible. Distribution packages can include backported fixes without matching the upstream version number, so verify the vendor’s advisory and package version. NCSC-NL’s operational guidance tracks vendor and product information.
How to fix PHP2Shell
- Inventory the web-serving runtime. List internet-facing sites, PHP-FPM pools, Apache modules, containers, hosting accounts and appliances. A host can run several PHP versions at once.
- Check the actual deployment.
php -vreports the command-line interpreter, which may differ from the PHP version serving a site. Check the running service, container image and package manager, or ask the hosting provider. Avoid exposing a publicphpinfo()page; if needed, use a temporary access-restricted diagnostic and remove it afterward. - Apply the upstream or vendor fix. Check the table above against your branch, or verify the vendor’s advisory and fixed package version. Rebuild and redeploy container images; check bundled software and appliances separately.
- Restart every affected worker. Updating files on disk does not replace code already loaded in PHP-FPM or Apache processes. Restart the relevant services or roll out new containers, following your normal availability procedures.
- Verify the live service and investigate exposure. Confirm the running deployment uses the fixed package, not just the CLI binary. Review logs and vendor guidance for the exposure window.
For managed WordPress, Drupal, Laravel or other PHP applications, the application and PHP runtime can be maintained by different parties. Confirm who patches the runtime. NCSC-NL maintains a vendor and product status list, but the product vendor remains the source for the exact build to install.
What if you cannot patch immediately?
Patching is the only complete mitigation. Restrict access to affected services at the network edge or take them offline until patched. A web application firewall can reduce exposure to known patterns, but should not be treated as a fix.
PHP’s advisories list temporary configuration measures for specific paths, including disabling session.upload_progress.enabled and, for PHP 8.5, fatal_error_backtraces. PHP also describes an administrative memory_limit=-1 mitigation for the confirmed out-of-memory path. That setting removes PHP’s per-request memory limit and has availability implications; it is incomplete and must be evaluated alongside resource controls. Follow the CVE-2026-109618 advisory and CVE-2026-109619 advisory, enforce settings where applications cannot override them, restart workers, and verify the live web configuration.
On October 23, PHP separately advised disabling session.upload_progress.enabled until the next regular bugfix release to address an unlikely additional RCE vector, CVE-2026-115560, subject to the conditions described in its advisory. This is separate from the two original PHP2Shell fixes. Consult the PHP informational advisory and your vendor for current guidance.
How to investigate possible compromise
Patching stops the vulnerable code path; it does not remove an attacker who already gained access. Preserve relevant evidence before restarting when your incident-response process requires it. Sophos recommends reviewing exposed systems from August 1, 2026 as a precaution, earlier than the first publicly reported October 17 attempt.
Look for unexpected multipart requests, especially at endpoints that do not normally accept uploads; memory-exhaustion errors or worker crashes; suspicious child processes spawned by PHP or the web server; new or modified PHP files; unusual outbound connections; and unexpected administrator logins. Access logs often omit request bodies, so absence of a particular form field in those logs does not rule out an attempt. These are investigation leads, not definitive indicators of compromise.
If you find suspicious activity, follow your incident-response plan: isolate the system, preserve logs and other evidence, assess credentials accessible to the web worker, and restore from a trusted source where appropriate.
Frequently asked questions
Does PHP2Shell affect WordPress sites?
A WordPress site can be exposed if the PHP runtime serving it is vulnerable. The same applies to other PHP applications. Updating WordPress plugins or core does not by itself update PHP; check with the host or server administrator.
Does PHP-FPM protect against PHP2Shell?
No. PHP-FPM changes the conditions for particular exploit paths, but PHP validated a CVE-2026-109619 session lifecycle path against FPM with a suitable application operation. Patch the runtime instead of assuming the server interface makes it safe.
Is a WAF enough?
No. A WAF may block known requests, but rules and bypasses change. Keep it as a temporary layer while updating PHP and verifying the running workers.
Sources
- PHP Foundation: how the vulnerabilities were found and fixed
- Calif: PHP2Shell research and technical write-up
- PHP: CVE-2026-109618, RCE via out-of-memory corruption
- PHP: CVE-2026-109619, RCE via stale global state
- NCSC-NL: PHP2Shell operational information
- Sophos: PHP2Shell advisory and investigation guidance
- PHP: October 23 session upload progress advisory
