02-347-7730  |  Saeree ERP - Complete ERP System for Thai Businesses Contact Us

What Is PHP2Shell? The Critical PHP Flaws That Took Websites Offline Worldwide: Who Is Affected and How to Fix It (2026)

What Is PHP2Shell? The Critical PHP Flaws That Took Websites Offline Worldwide: Who Is Affected and How to Fix It (2026)
  • 22
  • October

"What Is PHP2Shell? The Critical PHP Flaws That Took Websites Offline Worldwide: Who Is Affected and How to Fix It (2026)" — the short answer is PHP2Shell is the collective name for two vulnerabilities in the PHP language runtime itself (CVE-2026-109618 and CVE-2026-109619) that let an outsider run code on your server without logging in. The PHP team shipped fixed releases on 21 October 2026 and said plainly that "there are no complete mitigations, updating is the only safe choice". This article explains what the flaws are, who is affected, how serious they are, what to do in which order, and gives a checklist for IT teams in Thailand, where the NCSA website security standard already requires government agencies to manage exactly this kind of patch.

In one line: PHP2Shell = two flaws in the PHP runtime affecting every version from 5.4 to 8.5.11, both CVSS 9.2, allowing unauthenticated remote code execution. The only real fix is updating to PHP 8.5.12 / 8.4.27 / 8.3.36 / 8.2.35 and restarting every worker. PHP 8.1 and older get no official release and depend on Linux vendor backports or an upgrade.

Before you read: Facts in this article were checked on 22 October 2026 against the PHP team's announcements (php.net and the two GitHub advisories), government agencies (CISA in the US, NCSC in the UK, MHESI and NCSA in Thailand) and reports from Rapid7, Wiz, Google Cloud, AWS, Qualys and Cloudflare. The situation is still changing by the hour. Every attack figure is attributed to whoever reported it. Where sources disagree, php.net is the authority.

1. What happened: the three days that took websites offline

PHP runs 69.3% of all websites whose server-side language can be identified (W3Techs, 22 October 2026), from WordPress, Joomla and Drupal to countless custom internal systems. When the PHP team gave advance notice on the night of 20 October that it would ship patches for "two critical vulnerabilities", and the CVE identifiers (Common Vulnerabilities and Exposures, the global reference numbers for security flaws) leaked ahead of schedule, agencies in several countries chose to take sites offline rather than wait.

DateEventSource
2024PHP's first external security audit in years (Quarkslab via OSTIF). While fixing one finding, a core developer spotted the first signs of the out-of-memory bug. The team could not agree on a fix, and the work stalled for over a year.PHP Foundation
11 Aug 2026Calif (auditing PHP under OpenAI's Patch the Planet program) reports an unauthenticated remote code execution flaw with the same root cause as the 2024 bug · 24 Aug: Wiz independently reports the same root cause · 18 Sep: OpenAI reports additional attack vectorsPHP Foundation, Wiz
17 Oct 2026Amazon's MadPot honeypot records the first exploitation attempt, four days before public disclosure, from an IP address tied to a commercial anonymization service. How the attacker obtained exploit details is still unknown.AWS Security Blog
20 Oct 2026Around 15:00 UTC the two CVE IDs leak online with an incorrect score of 10.0 · 19:30 UTC the PHP team publishes its advance notice and moves the release from 22 to 21 October · Calif accidentally publishes a demo video; it is deleted but copies spreadPHP Foundation
21 Oct, 07:41 UTCChainguard publishes patched container images six hours before the coordinated release, letting anyone diff the changed codePHP Foundation
21 Oct, 14:00 UTCPHP 8.5.12 / 8.4.27 / 8.3.36 / 8.2.35 released with the warning that no complete mitigation exists · CISA and the UK NCSC issue alerts the same day; both say outright that systems which cannot be updated immediately should be taken offline (media report the NSA gave similar advice)php.net, CISA, NCSC
21–22 Oct 2026Government, hospital and port websites in Germany, France, the Netherlands, Finland, Belgium and Czechia, plus some Wikimedia services, go offline as a precaution · Japan's Ministry of Finance and the MUFG banking group suspend some online services · South Korea sends advisories to about 28,000 companies · China's MIIT orders audits, upgrades, and rotation of accounts, passwords and keysBangkok Biz News, MGR Online
22 Oct 2026Thailand: the MHESI minister orders a three-step response across the ministry · NCSA / ThaiCERT announce four measures · Rapid7 reports multiple public proof-of-concept (PoC) exploits, none of them broadly reliable yetBangkok Biz News, T-News, Rapid7

2. What the two flaws are, explained without reading code

Both flaws live in the PHP engine itself, not in a plugin, a theme or your own code. Wiz, one of the discoverers, summarized it this way: a bare Hello World application on an affected PHP version can be exploited, and the application does not even need to use sessions.

ID / advisory titleRoot causeConsequence
CVE-2026-109618
"RCE via OOM corruption"
When a request runs out of memory (OOM, Out of Memory) at a moment when PHP has not finished setting up the request's internal data, PHP bails out mid-task. The clean-up that runs at the end of the request then treats the half-built data as valid. An attacker can trigger OOM with a multipart request that looks within limits, for example by omitting a usable Content-Length or by stuffing each part with enough headers to exhaust memory_limit.Remote code execution (RCE) with the web worker's privileges, no login required. On Apache mod_php it takes one request per attempt. More workers mean more attempts, not safety.
CVE-2026-109619
"RCE via stale global state"
Some data from the previous request (error, session, object and extension state) remains in global variables after its memory has already been freed. The next request that lands on the same worker picks up that stale data before the runtime resets it (a use-after-free). The confirmed paths are session.upload_progress and the fatal_error_backtraces feature of PHP 8.5, both enabled by default.Remote code execution, plus disclosure of the worker's memory, such as database passwords or keys still sitting in it, via a malformed PHPSESSID cookie. Requires two requests that hit the same worker.

Both carry the same CVSS (Common Vulnerability Scoring System, the standard severity scale) v4.0 score of 9.2 out of 10, rated Critical. The vector says network-reachable, no privileges, no user interaction, but "high complexity" because the attacker must line up memory to match each PHP version, build and web server. Wiz notes that AI models now adapt exploit code to each version far faster than before, and that a single researcher finished in a week what used to take a world-class team months. watchTowr scored the flaws 10.0 on its own scale.

How serious is it? (status as of 22 October 2026)

  • PHP team: a working exploit exists against Apache mod_php with all default settings, triggered before a single line of application code runs, and RCE on PHP-FPM via the session path is confirmed.
  • AWS: saw exploitation attempts from 17 October, four days before disclosure, and now says the flaws are "being broadly exploited in the wild" · Cloudflare (CTO Dane Knecht): observed early attacks before the patches were released and shipped WAF rules to every plan including free · Cloudflare's CEO told the press that attempts grew from thousands before the announcement to hundreds of thousands within two hours and have passed one million (as reported by MGR Online, 22 October).
  • The cautious reading: Rapid7 (22 October) found several public PoCs, each working only for a specific OS + PHP + web server combination, "none appears to be broadly reliable", and Rapid7 itself has not observed successful exploitation in the wild · CISA (21 October) had not observed confirmed exploitation.
  • Bottom line: this is not yet "one click breaks every server", but every expert agrees it is a matter of when, not if, and unpatched machines next week are the first targets.

3. Who is affected

3.1 Every version in over a decade, every setup that serves web requests

The affected range runs from PHP 5.4 (released 2012) through 8.5.11. The PHP team states that the risk applies to "all PHP installations serving web requests", whatever the SAPI (Server API, the interface a web server uses to call PHP). The level of risk differs by setup.

How PHP runsWhere it is commonRisk level per the PHP advisory
Apache + mod_phpDefault LAMP installs, older hosting, some cPanel plansHighest. Exploits confirmed for both CVEs, triggered before application code runs, because mod_php always invokes request shutdown even when startup failed
PHP-FPM (FastCGI Process Manager) with nginx or ApacheMost modern installs, official Docker images109618: FPM kills the worker when startup fails, which closes one path, but it remains susceptible after startup (no complete exploit yet) · 109619: RCE via the session path confirmed
php-cgiLegacy systems, some Windows IIS setupsListed as affected
LiteSpeed / LSAPIWordPress hosting on LiteSpeedConditionally exposed; not validated in the default configuration
FrankenPHPNewer Go + PHP deploymentsLikely susceptible in the same way as mod_php, based on source analysis
CLI-only PHP (cron jobs, background scripts)Batch processingThe advisory covers web requests only, but update it anyway since it ships in the same packages

3.2 Software used by Thai organizations that has PHP inside

Many organizations say "we don't write PHP" while running it without knowing. This is the software written in PHP that shows up most often in Thai government agencies, universities and companies.

GroupExamplesNote
Public website (CMS, Content Management System)WordPress, Joomla, DrupalA large share of Thai government and university sites run one of these three. Updating plugins or themes does not help; the PHP runtime on the host must be updated
Learning management (LMS)MoodleUniversities and medical schools, exactly the student databases the MHESI minister ordered checked first
Admin toolsphpMyAdmin, the Zabbix web front end, GLPI, Nextcloud, Roundcube webmail, MediaWiki, LimeSurvey, MatomoUsually installed on the same server as something else; the entry point people forget most often
Online storesWooCommerce, Magento, PrestaShop, OpenCartMost SME shops sit on shared hosting; ask the provider
Custom internal appsLaravel, CodeIgniter, Yii, SymfonyThe contractor delivered and the contract ended; nobody owns the PHP version it runs on
Hosting control panelscPanel, Plesk, DirectAdminThe provider updates the PHP runtime, but your account may be pinned to an old version (for example in MultiPHP Manager)
Appliances and bundled productsPalo Alto Networks says all PAN-OS and Panorama versions are affected (no fixed release as of 22 October) · Fortinet is checking 12 products · Cisco is checking 31 products, none confirmed yetThe firewall that "protects" the network has PHP inside too. Follow vendor advisories and keep admin interfaces off the internet

3.3 The size of the problem in numbers

  • W3Techs (22 October 2026): PHP powers 69.3% of websites with a known language. Among PHP sites, PHP 7 still accounts for 26.9% and PHP 5 for 7.7%, so roughly one in three runs an end-of-life version with no official patch.
  • Qualys (data from 12,000 customers): 167 million PHP installations found, 73% on internet-facing assets, and 71% of those with a known version on end-of-life branches (5.4 to 8.1). In the first 12 hours after disclosure only 199,000 installations had been patched.
  • VirusTotal (via BleepingComputer): more than 5.1 million PHP hosts visible on the internet, about 3.8 million with at least one open port.

3.4 In Thailand

On 22 October 2026 Prof. Dr. Yodchanan Wongsawat, Deputy Prime Minister and Minister of Higher Education, Science, Research and Innovation (MHESI), ordered agencies under the ministry, especially universities, hospitals and medical schools, to act in three steps: (1) IT teams audit every website and system running PHP, starting with patient records and student databases, (2) enable interim protection such as a WAF (Web Application Firewall, a filter in front of the web server) and monitor for abnormal use, (3) test and upgrade PHP as soon as possible, because interim measures cannot replace fixing the software.

Paradorn Prisananantakul, Minister attached to the Prime Minister's Office and overseeing the NCSA (National Cyber Security Agency), directed ThaiCERT to act on four fronts: alert government agencies and critical infrastructure operators, assess the risk of internet-facing systems, monitor attack behaviour, and track remediation. No figures on affected Thai systems have been published, and no Thai agency has been confirmed breached.

For government agencies this follows directly from the NCSA Website Security standard in force since September 2026, which already requires software updates and vulnerability management, and it confirms the picture in our article on Thailand's above-average cyber threat level: anything internet-facing in Thailand is scanned around the clock.

Who is out of scope (but still has to check)

Static HTML sites have no PHP, and applications written in Java, .NET, Node.js, Python or Go are not affected in themselves. But if the same machine also hosts phpMyAdmin or a PHP CMS, that entry point is fully exposed. In our own company, grandlinux.com is static HTML on nginx and Saeree ERP is written in Java and runs on WildFly with no PHP component, so neither is in scope for this flaw. Customers that run a PHP CMS or PHP admin tools on other servers in the organization should work through the checklist at the end of this article.

4. How to fix it, in this order

Step 1: find every copy of PHP first

The command php -v only reports the PHP binary in your shell's PATH, which may not be the one serving web traffic (Qualys and Datadog both warn about this). Look at running processes, installed packages, and every container.

# Linux: which PHP processes are serving the web?
ps -eo pid,user,cmd | grep -E 'php-fpm|php-cgi|httpd|apache2|litespeed|frankenphp' | grep -v grep
# Is Apache loading mod_php?
apachectl -M 2>/dev/null | grep -i php
# Packages on Debian / Ubuntu
dpkg -l | grep -E '^ii\s+(php|libapache2-mod-php)'
# Packages on RHEL / Rocky / AlmaLinux
rpm -qa | grep -E '^php'
# Docker: images containing PHP
docker ps --format '{{.Names}} {{.Image}}' | grep -i php

Backported fixes from Linux vendors usually keep the old version number, for example 8.1.2 on Ubuntu 22.04. Check the package changelog for CVE-2026-109618 rather than trusting the version string alone.

apt changelog php8.1-fpm | head -30        # Debian / Ubuntu
rpm -q --changelog php-fpm | head -30      # RHEL family

Step 2: update, then restart every worker

EnvironmentWhat to do
PHP 8.2–8.5 from Linux packagesUpdate to 8.5.12 / 8.4.27 / 8.3.36 / 8.2.35 or to your vendor's patched package (Linux distributions and LTS vendors received the patches in advance), then restart php-fpm and Apache everywhere. Installing without restarting leaves the old code running in memory
Docker / KubernetesRebuild images on a fixed tag such as php:8.4.27-fpm or php:8.3.36-apache, redeploy, and remove every old container. Google says GKE users must update images and redeploy pods themselves, while Cloud Run services with automatic base image updates are patched automatically
Cloud PaaSCheck your provider's bulletin. Google App Engine standard patches PHP 8.2 and newer automatically; App Engine flexible must be redeployed
Shared hosting: cPanel / Plesk / DirectAdminThe provider updates the runtime, but check which PHP version your site is set to. If it is 7.4 or 8.0 / 8.1, switch to a fixed 8.2 or newer, and ask the provider in writing when they patched
Windows (IIS / XAMPP / WampServer)Download fresh binaries from windows.php.net, replace the PHP folder, restart IIS or Apache. For XAMPP / Wamp bundles, wait for a new bundle or swap the binaries yourself
PHP 7.4 / 8.0 / 8.1 (end of life)No official release. Options: (a) a vendor backport such as Ubuntu ESM or RHEL, (b) the minimal source backports the PHP team published for people who compile their own, (c) upgrade to 8.2 or newer, the only permanent fix. If none is possible right now, CISA and the NCSC recommend taking the system offline
Remi repository (rpms.remirepo.net)The PHP team warned that Remi had no updates on 21 October; switch to distribution packages or build from source
Appliances (firewalls, NAS, cameras, PBX)Follow the vendor advisory; meanwhile keep the admin web interface off the internet

PHP 8.2 itself reaches end of life on 31 December 2026, about two months away. If you are putting in the effort now, go straight to 8.3 or 8.4, which receive security fixes until the end of 2027 and 2028 respectively.

Step 3: if you cannot update this hour, the interim measures from the PHP team

The PHP team's own warning: "There are no complete mitigations, updating is the only safe choice." The measures below reduce exposure on the confirmed paths only; they do not close the flaw. Record when you applied them and set a hard deadline for the real update.

MeasureWhere to set itReducesCaveat
memory_limit = -1php_admin_value in the FPM pool or Apache config, so the application cannot override it109618Raises the risk of exhausting the whole machine; use a per-worker cgroup limit instead · never use RLIMIT_AS or RLIMIT_DATA, they re-trigger the vulnerable path
post_max_size = 8M (no uploads) or 32M · upload_max_filesize below post_max_size · lower max_input_nesting_level from the default 64 and max_file_uploadsphp.ini / pool, plus body-size limits at the reverse proxy109618Must also be enforced at the proxy for requests without a usable Content-Length
Block multipart/form-data at the proxy if the app does not use itnginx / Apache / WAFBothBreaks any upload form; assess first (AWS advises checking impact before doing this)
session.upload_progress.enabled = 0 then restart every workerphp.ini / FPM pool / server config only, not ini_set() or .user.ini, which apply too late109619 (session path)Can stay off permanently if you do not use upload progress bars; the PHP team suggests keeping it off even after patching
fatal_error_backtraces = 0 (PHP 8.5 only)Same as above109619 (backtrace path on mod_php)Closes the confirmed path only, not other state families
pm.max_requests = 1 in FPMFPM pool109619Spawns a new worker per request; costs performance, use if acceptable
Enable WAF rulesCloudflare (rules on every plan including free), Google Cloud Armor (File Upload + RFI categories), AWS WAFBothA compensating control only; Cloudflare reports attackers already trying to evade the rules
Remove invalid or deprecated per-request ini settings (php_value in .htaccess, FastCGI PHP_VALUE) and fix fatal errors or timeouts that outsiders can triggerApplication / server109619Hiding errors with error_reporting, display_errors or @ does not help, and clean logs do not prove safety
; Example for the FPM php.ini, or as php_admin_value[...] in the pool (e.g. /etc/php/8.3/fpm/pool.d/www.conf)
memory_limit = -1
post_max_size = 8M
upload_max_filesize = 4M
max_input_nesting_level = 16          ; tune to what the app needs; default is 64
session.upload_progress.enabled = 0
fatal_error_backtraces = 0            ; PHP 8.5 only
; then restart every worker
; systemctl restart php8.3-fpm apache2

Step 4: check whether you were already hit, back to 17 October

AWS advises starting the investigation from the first observed exploitation on 17 October, not from the patch date. These are the indicators published by Wiz, Datadog and AWS.

  • PHP logs containing Allowed memory size of … bytes exhausted followed by Unknown on line 0 (memory ran out before application code started), and Apache logs with unusually frequent AH00052 … Segmentation fault (11)
  • Upload-form POSTs containing the string PHP_SESSION_UPLOAD_PROGRESS at times when nobody was uploading files
  • Form-urlencoded requests with a field name around 3.5 MB long, or binary data in a field with an empty name (make sure your WAF or proxy does not truncate large bodies before logging)
  • Responses setting an unusually long or garbled PHPSESSID cookie, the signature of memory being read out
  • Bursts of multipart requests followed by HTTP 500s, or workers being recycled far more often than usual
  • The strongest signal: a PHP process (php-fpm, apache2 or httpd) spawning a shell (sh, bash), curl or wget, or new .php files appearing in the web root. A successful exploit may return HTTP 200 and leave the worker running, so status codes alone prove nothing

Memory exhaustion on its own does not mean you were attacked, and clean logs do not prove you were not (the PHP team says this outright). If you find the indicators above on a machine that was still unpatched, treat it as an incident: isolate the machine, rotate database passwords, API keys and any secret that lived in the worker's memory (the same advice China's MIIT gave its own agencies), and restore from a trusted backup. Our guide on rehearsing a restore so it actually works covers the mechanics.

5. Checklist for IT teams in Thailand

Compiled from CISA, the UK NCSC and the MHESI three-step order, in the order to do them.

#ItemStatus
1Inventory every system with PHP, including PHP embedded in other software and appliances; internet-facing systems first☐
2Record how each one runs PHP (mod_php / FPM / cgi / LiteSpeed); mod_php goes to the front of the queue☐
3Update systems on PHP 8.2–8.5 to the fixed releases and restart every worker☐
4Systems on 8.1 or older: get a vendor backport, upgrade, or take them offline. Decide today, not this week☐
5Shared hosting and cloud: ask the provider in writing when they patched, and change the PHP version selected in the control panel☐
6Systems that cannot be patched yet: apply the Step 3 mitigations and WAF rules, and record a deadline for them☐
7Appliances: follow vendor advisories (Palo Alto, Fortinet, Cisco and others) and keep admin interfaces off the internet☐
8Review logs back to 17 October for the Step 4 indicators☐
9If indicators are found: isolate, rotate passwords and keys, notify NCSA / ThaiCERT (government and critical infrastructure), restore from backup☐
10Verify after patching: confirm the version in the package changelog or phpinfo, and that session.upload_progress is off if unused☐
11Report to management as a table: system / old version / new version / patch time / outstanding items (MHESI agencies must report under the order)☐
12Plan ahead: PHP 8.2 is end of life on 31 December 2026, and set a rule that critical flaws on internet-facing systems get patched in hours, not 30 days (AWS guidance)☐

6. Lessons bigger than PHP

A bug "nobody has exploited yet" is not a safe bug. The first flaw was visible in the 2024 audit, but PHP's consensus-based security team could not pick a fix, and the work stalled for over a year. The PHP Foundation itself calls this "a structural failure" and has moved to majority decisions, after creating an Ecosystem Security Team in May 2026. Any organization sitting on a "known vulnerability we haven't fixed because nobody has exploited it" should treat this as a mirror.

AI finds flaws faster than people, on both sides. Both discoverers, Calif (using OpenAI's GPT-5.6 Sol in the Patch the Planet program) and Wiz (Gemini 4 Argon, GPT-5.6 Sol and its own Wiz Atlas), used AI models to find the bugs and to write the exploits. The PHP team says Alpha-Omega and Anthropic's Claude Mythos scanned PHP earlier in 2026, and that it added OpenAI's Daybreak Red after the incident. This continues the story in our piece on the cyber-focused AI models from three labs: this time the defenders found it about two months ahead, but Wiz also admits the same tools adapt exploits to each version faster. The gap between a patch and real attacks keeps shrinking, as with Langflow, exploited within 20 hours.

The organizations that get through this week are the ones that know what they have and where. Not the ones with the most expensive firewall (some of which have PHP inside too). A complete inventory and a rehearsed patch process are what let a team answer a minister's order the same day. See our patch management lessons from the SharePoint flaw and the principles in data security in ERP systems, which apply to every system in the organization.

Conclusion

  • PHP2Shell = CVE-2026-109618 (memory exhausted while the request is being set up) + CVE-2026-109619 (state left over between requests), both CVSS 9.2, unauthenticated remote code execution in the PHP runtime itself. Every application on PHP 5.4 through 8.5.11 is affected.
  • Fixed releases: 8.5.12 / 8.4.27 / 8.3.36 / 8.2.35 (21 October 2026) · 7.4 / 8.0 / 8.1 get no official release and depend on Linux vendor backports or an upgrade.
  • Highest risk is Apache mod_php (exploitable before application code runs), then PHP-FPM · firewalls and appliances with embedded PHP are affected too (Palo Alto PAN-OS confirmed).
  • No broadly reliable public exploit yet (Rapid7, 22 October), but attempts began before disclosure (AWS, 17 October) and Cloudflare saw attacks before the patches shipped.
  • Order of work: inventory → update and restart every worker → interim measures only where patching is impossible → review logs back to 17 October → report · PHP 8.2 is end of life on 31 December 2026, so plan to move to 8.3 or 8.4.

"A flaw at this level does not ask how well your code is written. It asks only two things: do you know where every copy of PHP is, and how many hours does it take you to update it?"

- Paitoon Butri, Network & Server Security Specialist, Grand Linux Solution

References

Need a team to keep your servers and ERP secure over the long run?

Grand Linux Solution has run Saeree ERP on Linux for Thai government agencies and private companies since 2002. Talk to us about deployment, patching, and backup.

Request a Free Demo

Tel 02-347-7730 | sale@grandlinux.com

Saeree ERP Author

About the Author

Paitoon Butri

Network & Server Security Specialist, Grand Linux Solution Co., Ltd.