
In this article
On the evening of October 21, 2026, a PHP security release put much of Japan's web on alert. Prime Minister Sanae Takaichi asked site operators on X to be ready to patch that night, and services such as BASE, pixiv and niconico paused or went into emergency maintenance around the release, which was scheduled for about 23:00 Japan time. The cause was a pair of critical flaws, nicknamed php2shell, that can give an attacker code execution on a web server without a login.
This guide is for people who run PHP. It covers what the two bugs are, which setups are exposed, how to patch so the fix actually takes effect, and what the temporary measures can and cannot do. The technical details come from the PHP project's own advisories unless another source is named.
The short version
- Update to PHP 8.5.12, 8.4.27, 8.3.36 or 8.2.35 (or the matching package from your distribution or vendor), then restart Apache, PHP-FPM and any long-running PHP workers.
- If you run 8.1 or older, those branches no longer get upstream updates. Ask your vendor for a backport or move to a supported version.
- Updating WordPress, Drupal or any other application does not fix this. The flaws are in the PHP runtime itself, according to the researchers quoted by Rescana's write-up.
- If you cannot update yet, treat every setting below as a stopgap only. PHP's advisory says updating is the only reliable fix. CISA and the UK's NCSC say to take unfixable systems offline.
| PHP branch | Vulnerable before | Fixed in |
|---|---|---|
| 8.5 | 8.5.12 | 8.5.12 |
| 8.4 | 8.4.27 | 8.4.27 |
| 8.3 | 8.3.36 | 8.3.36 |
| 8.2 | 8.2.35 | 8.2.35 |
PHP 8.2 reaches end of life on December 31, 2026, per Rescana, so this is also a reminder to plan the next branch.
What the two bugs are
Both are rated 9.2 (critical) on CVSS 4.0 by PHP, with a network attack vector, no privileges and no user interaction. PHP scores attack complexity as high and notes that attack requirements must be present. NVD, according to Rescana, scores them 9.8 on CVSS 3.1 with low complexity. The scores differ mainly on how hard the attack is, not on how bad it is when it works.
CVE-2026-109618: code execution through out-of-memory corruption
When PHP runs out of memory it uses longjmp() to abandon the current operation. Some code paths expose request memory before it has been fully initialised, so a failed allocation can leave that memory in an invalid state. The request shutdown procedure then reads or branches on that invalid state. The allocation that failed does not have to be related to the memory that gets corrupted.
There are several ways to trigger an out-of-memory condition, including problems in multipart form parsing (a missing content length, unlimited headers per part, empty file controls, nested field names) and allocations made by the application itself.
The fix changes how PHP handles the condition. The longjmp() is replaced by a delayed "soft" out-of-memory stop at the next safe point in the engine, and an immediate _exit() "hard" stop at a higher threshold.
CVE-2026-109619: use-after-free through stale global state
PHP's worker-level globals (error, session, object and extension state) can keep pointers to memory that belonged to a request after that request ends. Normally the state is reset before the request's memory is freed. Fatal errors skip the reset: the advisory lists parse and compile failures, uncaught errors, failed require, "Maximum execution time exceeded" and out-of-memory conditions.
The next request handled by the same worker can then read that stale state before PHP has initialised the request properly, which is a use-after-free. The advisory confirms two concrete cases:
- Session upload progress. An upload can reach session handling before ordinary initialisation and consume state left by an interrupted request. This path is on by default and does not need the application to call
session_start(). Validated against mod_php and PHP-FPM; on FPM it depends on a suitable application operation. - PHP 8.5 fatal-error backtraces. With
fatal_error_backtracesenabled, the reset is always missed at shutdown. The advisory calls this the strongest demonstrated case and the basis of the confirmed mod_php exploit.
Other paths are conditional. The advisory lists configuration warnings raised while PHP applies INI settings before a request starts, and says that hiding or logging them does not help. The impact is memory disclosure and remote code execution with the web worker's privileges. Rescana reports that the researchers describe the leaked memory as possibly including passwords, tokens and API keys; PHP's own advisory confirms memory disclosure but does not list what it might contain.
Which setups are exposed
PHP says the flaws affect PHP serving web requests, and CISA says all such installations. The advisories grade the evidence differently by server type:
- Apache mod_php: confirmed exploitable with default settings. The highest risk.
- PHP-FPM: considered susceptible, and a session-based path has been validated, but for CVE-2026-109618 no complete exploit has been demonstrated. Some paths only open up if the front end passes
PHP_VALUEorPHP_ADMIN_VALUEparameters. - FrankenPHP: likely susceptible to the out-of-memory flaw. For the stale-state flaw, the advisory says no early consumer was established in the default configuration, and adds that this does not make it immune.
- LiteSpeed (LSAPI): likely susceptible, but not validated.
- php-cgi: named as affected by Help Net Security and ITmedia.
Do not assume your web server uses the same PHP as your terminal. Check the version the web server actually runs: php -v reports the command-line build, and php-fpm -v (or php-fpm8.4 -v, depending on how it is packaged) reports the FPM build.
How to patch so it takes effect
- Take an inventory. CISA points out that PHP is often embedded in other software and may not be obvious. List every host, container image and appliance that serves PHP.
- Install the fixed build. Distributions and long-term-support vendors received the patches before the public release, so look for their packages first. Help Net Security reports that users of the volunteer-run Remi repository (
rpms.remirepo.net) had no update at publication and should use distribution packages or build from source. - Rebuild container images from a fixed PHP version and redeploy. A container still running the old image is still vulnerable.
- Restart everything. Per the researchers cited by Rescana, Apache, PHP-FPM and long-running workers must be restarted so the fixed runtime loads.
- Check shared hosting. Several Japanese rental-server providers, including Sakura Internet, XServer and GMO Pepabo, performed emergency maintenance themselves, according to ITmedia. If you rent a server, ask what version you now run.
PHP also published minimal patched source for 7.4, 8.0 and 8.1, intended for source builds or people without an LTS vendor. Those are not official releases. Per Rescana, the researchers say the affected range reaches back to PHP 5.4, while PHP has not said whether versions older than 7.4 are affected. Old installations should not be assumed safe.
If you cannot update yet
PHP states that these measures reduce exposure to specific attack paths and do not make an installation safe. Use them only to buy time.
For CVE-2026-109619, switch off session upload progress, and on PHP 8.5 disable fatal-error backtraces. Set them in php.ini, the FPM pool or the server configuration, not with ini_set() or .user.ini, and restart every worker:
session.upload_progress.enabled = 0
; PHP 8.5 only
fatal_error_backtraces = 0
For CVE-2026-109618, PHP's advisory suggests removing the memory limit and enforcing that so applications cannot override it. In an FPM pool file, one way to do that is:
php_admin_value[memory_limit] = -1
That trades one risk for another: with no ceiling, a runaway script can exhaust the server's memory, and the researchers add that memory exhaustion may terminate workers. The advisory also says to:
- keep
post_max_sizelow and enforce request-size limits at the web server or proxy, and reducemax_input_nesting_level; - limit input variables, multipart parts, headers per part and uploads, or block multipart form data at the front end if your application does not use it;
- if performance allows, set
pm.max_requests = 1in FPM, so a worker never serves a second request (the advisory lists this as risk reduction, not a fix); - not use
RLIMIT_ASorRLIMIT_DATAas a substitute, because they can cause the very allocation failure that triggers the bug.
A web application firewall may help. Help Net Security reports that Cloudflare has deployed rules for known exploit vectors, available to all customers including the free plan, and CISA says a WAF may offer some protection until patching is done. If none of this is workable, CISA and the NCSC advise taking the system offline, and Japan's prime minister named a temporary suspension as an effective way to cut the risk.
How to look for signs of an attack
Absence of evidence is weak here. The advisory warns that clean logs do not prove safety. Signals the researchers mention, via Rescana, include unusually large or malformed PHPSESSID cookies, multipart requests followed by memory-limit errors or repeated HTTP 500 responses, and unexplained worker crashes or restarts. CISA suggests watching for PHP worker processes that launch shells or download tools. Amazon says investigations should start from at least October 17, not from the disclosure date.
Is it being exploited?
Sources disagree, and the picture is moving. CISA said it had not seen exploitation when it published its alert on October 21. Amazon Threat Intelligence reported that its decoy network recorded an exploitation attempt on October 17, four days before disclosure, and it is not known how the attacker got the details early. Rescana's roundup lists other security firms reporting probing or attack traffic of varying scale, and says the PHP Foundation found no functional exploits at release while proof-of-concept code circulated afterwards. Treat it as live.
Why Japan moved so fast
The unusual part of this story was the response, not the bug. Japan's Information-technology Promotion Agency and National Cyber Office issued warnings, and the prime minister posted a direct appeal at 21:55 on October 21, ahead of the release. Many companies paused services ahead of the release. According to Kyodo News, an unnamed European research organisation estimates that 69.3 percent of websites worldwide run PHP, which explains the scale.
The reports we read describe warnings and requests, not a new law or binding rule. Also, while INTERNET Watch reports that OpenAI says its GPT-5.6 Sol model found the flaws, we could not confirm that with a second outlet, so treat the attribution as unverified. PHP's advisory credits four reporters by handle and names no company.
What to do today
Update, restart, and verify the version your web server actually runs. If you cannot, switch on the stopgaps above and plan an outage window rather than waiting.
Sources
- PHP security advisory GHSA-w8hw-w9fx-j79w (CVE-2026-109618)
- PHP security advisory GHSA-6wmf-4rv5-p3rp (CVE-2026-109619)
- CISA: Critical vulnerabilities in PHP require immediate patching
- Help Net Security: PHP2Shell, critical PHP vulnerabilities patched
- Rescana: two critical PHP vulnerabilities fixed
- ITmedia NEWS (Japanese)
- INTERNET Watch (Japanese)
- Kyodo News via Yahoo! News Japan (Japanese)
The cover illustration is adapted from the official PHP logo by Colin Viebrock (php.net), licensed under CC BY-SA 4.0. The illustration is shared under the same licence.


