Đọc bản tiếng Việt tại đây / Read the Vietnamese version
TL;DR
On October 21, 2026, the PHP security team shipped an emergency fix for two critical vulnerabilities in the core of the language, which the researchers jointly named php2shell. Both allow remote code execution (RCE) without authentication. With a default mod_php setup, a single malicious request is enough to take over the server, before any application code has had a chance to run. In other words, an application-layer firewall, a login page or a website’s maintenance mode will not stop it.
What makes this worrying is that PHP sits behind most of the web applications in the world, so the exposed surface is very wide.
If you run web applications on PHP, do the following now:
- Update PHP to 8.5.12 / 8.4.27 / 8.3.36 / 8.2.35 (or the matching fix from your distribution), then restart every worker (php-fpm, httpd/mod_php). Old workers keep running the vulnerable code until they are restarted.
- If you cannot patch right away, apply the temporary measures below and treat them as a stopgap, not a fix.
- Review logs and look for signs of exploitation going back to at least October 17, 2026, because attack attempts were recorded before the public disclosure.
Why is a bug in PHP so serious?
PHP is the most widely used server-side language on the web. According to W3Techs, about 69% of websites whose server-side language is known run PHP, and it powers WordPress, Magento, Laravel and countless internal systems. A flaw in the application layer affects one piece of software. php2shell lives in the core of the language itself, in the code that handles requests, which every PHP application goes through. So it does not care which CMS or framework you run.
PHP runs about 69% of public websites worldwide
To understand both bugs, you need one detail about how PHP works. For each HTTP request, PHP sets up an environment, parses the input (query string, body, file uploads), runs your script, then cleans up so it is ready for the next request. The trouble sits at the seam of that lifecycle: something goes wrong while the request is being set up, or the cleanup is incomplete when the next request arrives.
Figure 2: A simplified model of a web server handing a request to server-side code (a CGI diagram). PHP-FPM and Apache mod_php both perform this step in their own way.
Both CVEs come from one shared idea. When PHP hits a fatal error midway, especially running out of memory (OOM), it uses a shortcut jump (longjmp, which PHP calls a “bailout”) to leave the current context. That jump skips the code that would normally return internal data to a valid state. The result is half-built pieces of memory, or pointers that still reference freed memory, while the rest of PHP keeps treating them as valid. The two CVEs are two views of the same idea, which is why PHP fixed both in a single commit with a plain name: “Avoid state corruption via bailout”.
The name php2shell was coined by the research teams that found the bugs (Calif and Wiz). PHP itself does not use it.
CVE-2026-109618: memory corruption when RAM runs out
PHP titles this one “RCE via OOM corruption” in its report. When PHP parses a request, it allocates memory for many things: the array of parameters, the structure that stores headers, the buffer for upload data. If an allocation fails because the memory ceiling is reached, PHP bails out immediately. The problem is that in a few contexts, the request’s memory has already been “exposed” (treated as existing) but not fully initialized. After the bailout, request cleanup reads or branches on that half-built data. From an uninitialized variable mistaken for a valid object, an attacker can steer execution until it reaches a function pointer they control, and that is the door to code execution.
What makes this bug nasty is that forcing PHP to run out of memory at the right moment does not require a huge request. PHP’s report lists several ways to abuse multipart parsing (the request type used for file uploads) to push PHP to the edge of memory exhaustion while still passing default limits such as post_max_size. Beyond multipart, the Datadog team also reproduced the bug with an ordinary urlencoded request. So there is no single exploitation “recipe”. There are several entry points that lead to the same broken spot.
The report confirms the most severe case as unauthenticated RCE on mod_php with default memory and data limits. For PHP-FPM, source analysis shows the risk is still there, but no complete exploit has been demonstrated on that path, because FPM usually ends the child process when a request fails at the setup stage.
CVE-2026-109619: reusing old state that was already freed
PHP calls the second bug “RCE via stale global state”. PHP reuses worker processes for many requests in a row for performance. Between requests, it must reset global variables to a clean state. But if a fatal error (out of memory, execution timeout) interrupts the cleanup, some global pointers still reference memory that belonged to the finished request, memory that has already been handed back to the system. When the next request runs on the same worker, PHP uses that old pointer before the normal initialization has reset it. This is the classic use-after-free: a long-lived object holds a pointer into dead memory.
Figure 3: A general illustration of the use-after-free idea: a dangling pointer still references a deleted object. In php2shell, that role is played by the state left behind after an out-of-memory error.
To exploit it, an attacker needs two requests on the same worker: one request “plants the seed” that leaves a dangling state, and a later one “harvests” it by making PHP reuse the freed memory. PHP’s report names three groups of places that consume stale state, and notably, all of them are in features that are on by default:
- INI configuration diagnostics that run before request initialization. For example, warnings about deprecated options, raised through mod_php’s .htaccess or FPM’s environment variables. Turning off error display (display_errors, error_reporting, the @ operator) does not help here.
- Backtraces on fatal errors in PHP 8.5 (the fatal_error_backtraces option, new in 8.5.0 and on by default). This is the strongest case demonstrated, and the basis of the confirmed RCE exploit on mod_php.
- Session upload progress tracking (session.upload_progress). It is on by default and does not need the application to call session_start(), which means your website is affected even if it never uses the feature.
Why this is hard to stop
We usually assume an attack has to go through some page or feature of the application, so defenses such as requiring login, turning on maintenance mode, or installing a firewall plugin for WordPress would block it.
With php2shell on mod_php, they do not. Input parsing and the upload-progress handler run while PHP is still initializing the request, before the application module is loaded and before a single line of your code runs. On mod_php, cleanup even runs when initialization has failed. So an application that only prints “Hello World” can still be exploited, as long as it runs on a vulnerable PHP build with a default mod_php setup.
PHP-FPM is also affected, but it is harder. The confirmed exploit on FPM has to go through an application action after a successful initialization (for example, a piece of code that touches the session).
Figure 4: Where PHP sits in a typical web stack (LAMP), a general illustration that proves nothing about the two CVEs.
How severe are the two vulnerabilities?
You will see php2shell scored differently depending on the source:
- The PHP team (acting as CNA) scores both at CVSS v4.0 9.2 (Critical), noting high attack complexity.
- NVD scores CVSS v3.1 9.8 (Critical).
- Some distributors, such as Red Hat, SUSE and Amazon Linux, score 8.1 on CVSS v3.1 and rate it Important, because reliable exploitation needs heap manipulation and precise timing.
- Ubuntu labels it Critical.
The difference lies in how exploitation difficulty is judged, not in the nature of the bug. Whether you read 8.1 or 9.8, this is still unauthenticated RCE in the PHP core, so for prioritization you should treat it as the highest tier.
Timeline
- 2024: A PHP core developer noticed the first sign of the OOM bug while handling a report from an audit run by Quarkslab and OSTIF. No concrete exploitation vector was found at the time, and the fix was delayed for months.
- August 11, 2026: The Calif team reported RCE with this same root cause. OpenAI independently reported the same cause on the same day.
- August 24, 2026: Wiz reported additional attack vectors.
- October 17, 2026: AWS’s MadPot honeypot system recorded an attempt to exploit php2shell, four days before disclosure.
- October 20, 2026: The CVE IDs leaked publicly (with a wrong score of 10.0 and a wrong release time). The PHP team issued an early notice and moved the release up by one day.
- October 21, 2026: PHP 8.5.12 / 8.4.27 / 8.3.36 / 8.2.35 released, around 14:00 UTC (about 21:00 in Vietnam).
Real-world exploitation
At release time, the PHP team said it had not seen any complete working exploit, and CISA had not recorded exploitation either. Within hours, however, several vendors reported attack attempts: AWS (since October 17, through honeypots), Cloudflare (attack traffic with constantly changing payloads), and watchTowr (observed on a honeypot). AWS even described php2shell as “being widely exploited”, although it also said it is unclear whether those attempts succeeded on real systems.
As of October 22, 2026, no real-world intrusion has been publicly confirmed, and neither CVE is in CISA’s KEV catalog. But the gap between “attempted” and “successful” attacks is closing fast, and many PoCs have appeared on GitHub, including fake PoCs that carry malware.
Recommendations for organizations
1. Patch now, and restart your workers
The only complete fix is to update PHP to one of the patched versions: 8.5.12, 8.4.27, 8.3.36, 8.2.35, or the matching fix from your distribution. After updating, you must restart every process that runs PHP (php-fpm, httpd with mod_php, long-running background workers). Old workers stay in memory and keep running the vulnerable code until they are restarted.
A note on checking: many distributions (Ubuntu, Debian, RHEL, AlmaLinux, SUSE…) fix by backporting, which keeps the old upstream version number. So do not conclude anything from php -v alone. Check the package version with your operating system’s package manager (for example rpm -q php-common, dpkg -l php8.2) and compare it with the fixed version your distribution publishes.
2. If you cannot patch yet: temporary measures
PHP states clearly that the measures below only reduce the attack surface on some paths and do not make a system completely safe:
- For CVE-2026-109618 (OOM): set
memory_limit = -1at the admin level (php_admin_value) so applications cannot override it, combined with request size limits at the proxy or web server in front, and the cgroup memory limit so that only a single worker is taken down when needed. Warning: do not useRLIMIT_AS/RLIMIT_DATAto enforce limits, because they make memory allocation fail and trigger the very same bug path. Withmemory_limit = -1, a single request can eat all the server’s RAM, so monitor memory closely and restore the limit right after patching. - For CVE-2026-109619 (stale state): set
session.upload_progress.enabled = 0, and on PHP 8.5 alsofatal_error_backtraces = 0. Set them inphp.ini, a drop-in file inconf.d, or the FPM pool (php_admin_flag), not throughini_set()or.user.ini, which take effect too late. Restart every worker after changing them. This only blocks the confirmed paths, not every variant. - Block multipart at the edge: if the application does not use multipart/form-data uploads, block that request type at the web server before it reaches PHP. Note that this breaks file upload features (for example product image uploads on Magento) and some payment forms.
- Last resort: if you cannot do anything in time, consider taking public-facing PHP systems offline, or allowing only GET/HEAD methods until you patch. CISA, the UK NCSC and CERT-EU all recommend this for the worst case, especially for mod_php and PHP 8.1 and earlier.
On WAFs: a WAF is one layer and does not replace patching. A rule that blocks by size can reduce the OOM path (109618) but cannot block the very small upload-progress requests of 109619. If you already use a WAF from Cloudflare, AWS, Akamai and others, turn on the php2shell rule sets they have published, but still patch.
3. Hunt for signs of exploitation
A successful exploit may leave few traces (an HTTP 200 response, no worker crash, no application log), so seeing no errors does not mean you are safe. Some signs worth checking:
- In PHP logs: the error line
PHP Fatal error: Allowed memory size of N bytes exhausted ... in Unknown on line 0. The phrase “Unknown on line 0” shows the error happened during request initialization, before any script ran. Cross-check it against unusual POST requests, worker crashes, or Apache reporting “AH00052 … Segmentation fault”. - Post-exploitation signs (the most important): a PHP or web process (php-fpm, php-cgi, httpd, apache2) spawning a shell (sh, bash), especially with an outbound connection, or calling curl, wget or nc. Reconnaissance commands such as whoami, id and uname running as the web server user often follow. CISA also confirms that “a PHP process launching a shell or downloading tools” is a signal to watch.
- Because leaked worker memory may contain passwords, tokens and API keys, rotate these secrets after patching if you suspect exposure.
- Review window: start from at least October 17, 2026, because attack attempts were recorded before the public disclosure.
4. Inventory every place PHP runs
PHP can sit in containers, in prepackaged software, in PHP managed by a control panel (cPanel, Plesk, DirectAdmin…), or in a self-compiled build. List every PHP runtime that serves HTTP and patch each one. End-of-life versions (5.x, 7.x, 8.1 and earlier) are especially risky because they have almost no official fix.
Contact CyStack for support
For organizations that use CyStack services, our team can help review your exposed PHP attack surface, check configurations, and hunt for signs of exploitation in your systems. If you are not sure whether your infrastructure runs a vulnerable PHP version, contact us for a check.
References
- PHP advisory: php.net/archive/2026
- GHSA-w8hw-w9fx-j79w (CVE-2026-109618): github.com/php/php-src
- GHSA-6wmf-4rv5-p3rp (CVE-2026-109619): github.com/php/php-src
- PHP Foundation post on the incident and release process: thephp.foundation
- NVD CVE-2026-109618: nvd.nist.gov
- NVD CVE-2026-109619: nvd.nist.gov
- Calif analysis: calif.io/php2shell
- Wiz analysis: wiz.io
- Datadog Security Labs analysis: securitylabs.datadoghq.com
- CISA alert: cisa.gov
- CERT-EU advisory: cert.europa.eu