Home/Blog/PHP2Shell patch installed? Restart PHP or old workers stay exposed
blog

PHP2Shell patch installed? Restart PHP or old workers stay exposed

October 25, 2026 · Security News

PHP2Shell patch restart: terminal restarting php-fpm so the fixed PHP binary replaces vulnerable running workers

A PHP2Shell patch does nothing until PHP restarts. Google Cloud’s guidance, expanded with input from Mandiant Consulting on 23 October 2026, warns that upgrading the package leaves the vulnerable libphp.so or php-fpm binary running in every worker that was already up. For payment, brokerage and gaming platforms built on PHP, “we updated” and “we are fixed” are two different statements, and only one of them will satisfy an auditor.

Key takeaways

  • CVE-2026-109618 and CVE-2026-109619 (PHP2Shell), disclosed 21 October 2026, are CVSS 9.2 flaws in the PHP runtime affecting every version from 5.4 through 8.5.11.
  • Fixed builds are PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35. PHP 8.1 and older will never be patched.
  • Installing the package is not enough: restart php-fpm, Apache/httpd, FrankenPHP, LiteSpeed and supervisor-managed workers, or roll containers.
  • Verify with the distro changelog and process start times, not the version string.
  • On a probed host, capture worker memory before restarting.
  • pm.max_requests = 1, edge filtering and Cloud Armor buy time; only the upgrade fixes it.

What does a PHP2Shell patch actually change on a live server?

On its own, very little that matters to an attacker. The update replaces files on disk, while the PHP code answering your customers keeps running from memory. On 21 October 2026 the PHP project and Wiz Research disclosed two flaws in the PHP runtime itself, CVE-2026-109618 and CVE-2026-109619, grouped under the name PHP2Shell.

Both are rated CVSS 9.2 Critical and linked to unauthenticated remote code execution and memory disclosure, so an attacker needs no account on your site to try them. Every PHP release from 5.4 through 8.5.11 is affected, a range that reaches back to 2012. The fixed builds are PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35.

The trap is in how PHP runs in production. A package upgrade writes new binaries to disk, but production PHP rarely starts fresh for each visitor:

  • PHP-FPM keeps a pool of worker processes alive and feeds them request after request.
  • Apache with mod_php loads libphp.so into its own processes at startup.

Those processes loaded the old code when they started and keep running it until they stop. Google’s guidance says it plainly: “Upgrading packages on disk leaves vulnerable libphp.so or php-fpm binaries resident in running worker processes.” It names the server APIs (SAPIs) to restart:

  • php8.x-fpm pools
  • apache2 or httpd, where PHP runs as an Apache module
  • FrankenPHP
  • LiteSpeed (lsws)
  • any of the above kept alive by supervisor or a similar process manager

Each needs its own restart. Restarting php-fpm does not reload a libphp.so loaded inside Apache, and a supervisor-managed PHP queue worker will keep the old runtime for weeks if nobody touches it.

Google draws the responsibility line in one sentence: “While Google Cloud itself is not vulnerable, users of PHP running on Google Cloud may be vulnerable.” The same split holds on AWS, Azure, a rented VPS or a colo rack anywhere. The provider runs the platform; the PHP on it is yours to fix.

How does PHP2Shell work, without the exploit detail?

Both bugs abuse the fact that PHP workers are reused, and both sit in plumbing that runs before your application code does.

CVE-2026-109618 (advisory GHSA-w8hw-w9fx-j79w) is a flaw in how PHP handles out-of-memory conditions. If PHP runs out of memory at the wrong moment, it can be interrupted while internal request data is only partly set up. The cleanup routine that runs afterward may then treat that half-built data as valid.

CVE-2026-109619 (GHSA-6wmf-4rv5-p3rp) belongs to the use-after-free family. State owned by one request survives after its memory has been freed, and the next request on the same worker can pick it up before normal initialization resets it. One request poisons the worker; a later request on that worker exploits it.

Two practical consequences follow:

  • Your application’s checks run too late. PHP parses multipart upload bodies, the format browsers use for file uploads, during request startup, before any login check, framework middleware or route rule runs. A portal that accepts uploads only from verified clients still parses anonymous multipart bodies at the runtime layer.
  • A leak can expose other people’s data. A memory-disclosure bug in a long-lived worker can return leftovers from earlier requests in that process: session data, configuration, credentials. What comes out depends on memory layout. On a platform holding KYC documents, card tokens or wallet balances, those leftovers turn a bug into a reportable incident.

Our earlier piece on what honeypot sensors recorded on PHP2Shell shows the traffic on the wire: staged multipart POSTs, an oversized PHPSESSID used for disclosure, and on 24 October, 35 shells whose parent was an Apache worker.

Google also credits its Gemini 4 Argon model with “an invaluable contribution to finding the vulnerability, exploit development, attack detection, and validation of the patch,” and says Wiz used a mix of models. Neither has said how the work split between models and people.

The defensive lesson does not depend on that split. If tooling keeps shrinking the time from discovery to working exploit, the window you actually control is the one between “fix available” and “fix running.”

How do you prove the fixed PHP is the one answering requests?

Check three things, because each one alone can mislead you:

  • the installed package contains the security fix;
  • the serving process started after that install;
  • the running workload is the patched one.

Start with the changelog, not the version string. Linux distributions often backport security fixes while keeping an older upstream version number. A Debian or RHEL host may report a version below 8.2.35 and still be fixed, or show a familiar number and not be. Google recommends searching the distribution changelog for both CVE IDs:

  • Debian and Ubuntu: run apt-get changelog php-fpm and look for CVE-2026-109618 and CVE-2026-109619.
  • RHEL, Rocky and Alma: run rpm -q –changelog php-fpm and filter the output for the same two IDs.

Pull the fix from your distribution’s official security repository or an official source build. The PHP security team warned that volunteer third-party mirrors may lag behind coordinated disclosure, so a community RPM mirror or your host’s own mirror may not carry the fix yet.

Then compare process start times with the install time. If the php-fpm master, the Apache parent, or the FrankenPHP or LiteSpeed process started before the package landed, it is still running the old code. This check also catches a restart that “succeeded” but reloaded the wrong service unit.

On Google Cloud, it depends on the product:

Platform Patched automatically? What you do
App Engine standard (PHP 8.2+) Yes Confirm the runtime is 8.2 or newer
App Engine flexible No Redeploy on 8.2 or newer
Cloud Run and Cloud Run functions Only with automatic base-image updates on Check the setting; otherwise rebuild and redeploy
Self-built images (GKE, Cloud Run, custom runtimes) No Rebuild on a patched base and roll out
Marketplace solutions Depends on the publisher Apply the publisher’s update or patch PHP directly

AWS, Azure and other clouds follow the same logic: managed runtimes move on the provider’s schedule, and anything you built yourself waits for you. A patched image in the registry changes nothing in running pods. Kubernetes serves the old container until you roll the deployment, and Cloud Run serves the old revision until a new one takes traffic.

From our engagements: when we retest after a runtime patch, the miss is rarely the main web server. It is a second FPM pool for an admin panel on a non-standard port, a cron host running PHP workers under supervisor, or a forgotten staging copy of the client portal left online for a partner demo. Build your inventory from listening ports and running processes, not from the asset register.

Track the result, not the ticket. A vulnerability management program that records the running PHP build per host and per image turns this scramble into a check you repeat after every runtime fix.

Google’s bottom line is blunt: upgrade to PHP 8.2 or newer and redeploy every service. Anything short of that is mitigation, not a fix.

What if you are still on PHP 8.1 or older?

No patch is coming. The PHP project is not backporting PHP2Shell fixes to end-of-life branches, and Google’s guidance names PHP 5.5, 7.2, 7.3, 7.4 and 8.1 as remaining vulnerable. Those applications must move to PHP 8.2 or newer.

Until then, you are running on compensating controls and a dated upgrade plan. Some long-term-support distributions and commercial vendors maintain their own backports for old PHP lines. If yours does, the changelog check above tells you whether this specific fix landed. Do not assume it did.

Expect the jump to break things. Deprecated dynamic properties, removed functions and stricter typing trip up older plugins, CRM connectors and payment-provider SDKs. Budget real test time, and keep the interim controls below switched on until the upgraded build is live.

Then look past your own servers. Google notes that edge, gateway, management, storage and security appliances often embed PHP in their admin interfaces or core OS modules. You cannot run apt upgrade on a firewall’s management plane. Those devices need firmware or an approved workaround from the manufacturer, and Google urges customers to contact vendors now.

What should you save before you restart a server that was probed?

Capture worker memory first if the host shows active probing or unusual PHPSESSID cookies. Google’s guidance is explicit: “capture worker memory before patching or rebooting, as restarting workers permanently destroys volatile heap evidence.”

This is the step small teams most often get wrong: they reboot first and ask afterward whether they were compromised. A memory-disclosure attack leaves its traces in the heap of the worker that was hit. Once that worker is recycled, you may never answer “what did they read?” — the question a regulator, bank partner or client will ask.

A workable sequence for a suspect host:

  1. Pull it out of the load balancer pool rather than shutting it down.
  2. Preserve edge, WAF and web server logs, plus process listings and open network connections.
  3. Capture memory from the PHP worker processes, or take a full VM memory snapshot on cloud hosts.
  4. Only then patch, restart and run the verification steps above.
  5. Look for shells or unexpected processes whose parent is the web server user.

Default access logs do not record cookies or request bodies, so a clean access log does not prove there were no oversized session cookies or multipart probes. Edge and WAF logs are more likely to hold that detail.

Turning off error output is not a fix. Google warns that setting display_errors = Off “does not fully block memory leak attacks,” because exploits “can extract sensitive memory directly through extra-large session cookies or specific error pages.” Keep errors hidden, but do not count it as protection.

How widely PHP2Shell is being exploited is not settled. Google’s guidance gives no attack volumes, attribution or indicator list. The Hacker News reported millions of exploit attempts, some trying to drop Mirai, the Linux DDoS botnet; Security Affairs reported millions of attacks but no confirmed successful exploitation. An attempt to drop malware does not prove it ever ran.

The CVSS 9.2 score justifies urgency but cannot say whether a given server was hit. Only evidence from that server can. If you find signs of a shell, this is no longer maintenance — it is incident response. Our compromised server recovery work starts from preserved evidence for exactly this reason.

What can you turn on while the upgrade is still queued?

Three layers buy time: worker recycling, edge filtering of multipart traffic, and detection. None of them replaces the upgrade. Google calls its Cloud Armor rules “solely” compensating controls.

Worker recycling

Setting pm.max_requests = 1 in the PHP-FPM pool file makes every worker exit after a single request. That breaks the cross-request state reuse behind CVE-2026-109619.

It is a blunt tool. Process churn rises and capacity can drop sharply, so load-test it, watch request queues and treat it as a short-term emergency setting. Google’s other prepatch hardening belongs in the master php.ini loaded at startup or the static FPM pool configuration, via php_admin_value and php_admin_flag, not in per-directory overrides. Restart all workers afterward.

Edge filtering

Because the multipart parser runs before your code, the edge is one of the few places that sees the attack before PHP does. Google’s guidance recommends:

  • blocking multipart/form-data on routes that never accept uploads;
  • rejecting POST requests sent with chunked transfer encoding;
  • capping request body size, since large payloads are used to force the out-of-memory condition;
  • limiting the number of headers per multipart part;
  • blocking deeply nested bracket field names;
  • enforcing a strict character set and length for PHPSESSID.

Test these rules against the upload flows your business depends on, such as KYC documents and proof-of-deposit forms, before switching to enforce mode.

On Google Cloud Armor, customers already running active managed rules need no change. Everyone else should enable the stable File Upload and RFI rule categories in enforce mode, and add a rule so no uninspected or oversized body reaches the backend.

Detection and tooling

  • Google Security Operations: 23 new curated detections in the Mandiant Frontline Threats rule pack. Enterprise Plus customers can search the Emerging Threat Center for GLOBAL.26.015, and run a hunt on it with the Threat Hunt Agent (Public Preview).
  • Security Command Center: the EXTERNALLY_EXPOSED_RCE_VULNERABILITY module covers Compute Engine, GKE and Cloud Run. Vulnerability Assessment, Container Threat Detection and Cloud Run Threat Detection add coverage, and the On-Demand Scanning API and Artifact Analysis flag affected images.
  • Wiz: patched WizOS PHP base images, in Alpine-hardened and FIPS builds, are offered at zero billable units for 60 days.

Google revised its guidance on 22 October, updating the Security Command Center and Cloud Armor sections, and on 23 October added Mandiant’s monitoring, patching and remediation advice. If you read it on day one, read it again.

Who owns the restart when PHP sits inside hosting, a vendor platform or a regulated stack?

Whoever runs the process owns the restart, and that is often not you.

  • Shared hosting and managed CMS platforms: the provider controls PHP-FPM. Ask in writing which PHP versions they run, when the pools were restarted, and whether 8.1 or older is still offered.
  • Marketplace images and white-label broker or casino platforms: the vendor ships the runtime. Ask for the patched image and a date, then redeploy.
  • Appliances: the manufacturer’s firmware is the only route to a fix.

Regulated firms carry an extra burden. For EU investment firms, e-money and payment institutions, the Digital Operational Resilience Act (DORA) has applied since January 2025. It expects timely handling of known vulnerabilities and testing that shows controls work. A ticket closed after apt upgrade is weak evidence if the php-fpm master still shows a start time from August.

DORA also keeps ICT third-party risk inside the financial entity’s own responsibility, so “our platform vendor handles it” needs a dated, written confirmation in your records. If a compromise exposes client data, DORA incident reporting and GDPR breach notification run from when you became aware, not from when patching finished.

iGaming operators sit outside DORA but face the same pressure from payment providers, game aggregators and licensing bodies. A leaked session store on a casino front end can mean account takeover at scale.

Leadership needs two written answers this week: who ran the three checks above across every production PHP process, and which systems still run 8.1 or older, with a committed upgrade date. An outside retest confirms the running version from the attacker’s side, and regulated firms can fold it into DORA penetration testing.

FAQ

Do I need to restart PHP after installing the PHP2Shell patch?

Yes. Running php-fpm, mod_php, FrankenPHP and LiteSpeed processes keep the old binary in memory until restarted, and containers keep it until redeployed.

Which PHP versions fix CVE-2026-109618 and CVE-2026-109619?

PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35. Distribution packages may backport the fix under an older version number, so check the changelog for both CVE IDs.

Is PHP 8.1 still vulnerable to PHP2Shell?

Yes. The PHP project is not releasing fixes for 8.1 or earlier. Upgrade to 8.2 or newer and use compensating controls until you do.

Does turning off display_errors stop PHP2Shell?

No. Google warns it does not fully block memory leak attacks, which can extract memory through oversized session cookies or specific error pages.

Is Google App Engine or Cloud Run patched for PHP2Shell automatically?

App Engine standard on PHP 8.2+ is. Cloud Run and Cloud Run functions are only with automatic base-image updates enabled. App Engine flexible and self-built images need a rebuild and redeploy.

Should I capture server memory before restarting PHP workers?

If the host shows probing or anomalous PHPSESSID cookies, yes. Restarting workers permanently destroys the heap evidence of what may have leaked.

If a PHP host was probed before you patched and you need someone to preserve evidence and confirm what was exposed, our emergency incident response retainer puts a responder on it the same day.


← All articles

get in touch

Tell us what you're running

Scoping is free. We reply within one business day, and under 30 minutes for active incidents.