Pular para o conteúdo
← Back to Skalablog

Published article

What is PHP2Shell and which PHP versions are safe now?

Software Engineering

PHP2Shell is a pair of PHP memory-cleanup vulnerabilities that were reported privately in August 2026, leaked publicly on October 20, 2026, and patched on October 21, 2026. The practical answer for site owners is to run PHP 8.5.12, 8.4.27, 8.3.36, 8.2.35 or newer and restart every PHP process afterward.

What is PHP2Shell and why did it matter?

PHP2Shell is a pair of vulnerabilities in PHP, the server-side scripting language, involving improper cleanup after a memory-exhaustion failure. The PHP project rated the flaws 9.2 out of 10 for severity, and the practical consequence is remote code execution: an attacker can read private server data and run their own commands without any login.

The mechanism follows a short sequence. A PHP worker process runs out of memory and aborts mid-request. PHP does not fully clean up the state it leaves behind. Whatever runs next treats that leftover state as valid, and a crafted request can steer execution. Researchers demonstrated that a plain Hello World page could be vulnerable, because the flaw sits below application code.

Two features raised the risk above a routine security advisory. No authentication is required, so any host on the internet can attempt exploitation. The flaw also affected every PHP branch going back to PHP 5.4, released in 2012, which is 14 years of deployed code.

The pair carry CVE identifiers CVE-2026-109618 and CVE-2026-109619, which map to PHP security advisories published with the October 21 releases. Treat any third-party exploit sample with suspicion. The PHP team states that no complete mitigation exists short of updating.

Why the timing mattered

The coordinated-disclosure plan set a public announcement for October 22, 2026. On October 17, Amazon's security team detected exploitation attempts against decoy servers, four days early. Details leaked on social media on October 20, and governments in the Netherlands, Finland and Austria took their own sites offline before a fix existed.

Which PHP versions are patched, and which are not?

Official PHP2Shell fixes exist only for PHP 8.2 and newer, shipped on October 21, 2026 at 14:00 UTC. The patched releases are PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35, and any later release on those branches includes the fix.

Older branches, including PHP 8.1 and everything below, receive no official patch from the PHP project. One analysis cited in the video estimated that around 59% of internet-facing PHP servers run versions that will not get an official fix, and exposure estimates ranged from over one million to more than 20 million machines. Treat those counts as estimates rather than a census.

The patch status table below is the decision point for most operators.

PHP2Shell patch status by branch

Patch status depends entirely on which PHP branch a server runs. The table groups branches by whether the PHP project published a fixed release on October 21, 2026.

PHP branchFixed releaseOfficial PHP fixRecommended action
8.58.5.12YesUpdate and restart PHP
8.48.4.27YesUpdate and restart PHP
8.38.3.36YesUpdate and restart PHP
8.28.2.35YesUpdate and restart PHP
8.1 and olderNoneNoUpgrade, obtain a host backport, or take offline

A backport from a hosting provider or Linux distribution can cover an older branch, but it is a vendor commitment, not a PHP project release. Confirm what your host actually installed before assuming a server is fixed.

How did AI-assisted research change the discovery timeline?

Two separate research teams found the flaws in August 2026, both with help from frontier AI models, and Wiz, a cloud security vendor, reported them privately to the PHP security team on August 24, 2026. Wiz characterised the effort as one researcher completing in about a week what previously took a world-class team months.

The bug itself was not new to PHP maintainers. A PHP developer had spotted the underlying problem back in 2024, and it went unfixed, partly because nobody had demonstrated that it could be exploited. That gap between a suspicious code path and a proven exploit is exactly what the AI-assisted work closed.

The same capability cuts both ways. If finding exploitable memory bugs is now cheap for defenders, it is comparably cheap for attackers, which shrinks the window between a quiet report and public exploitation. Cloudflare published emergency firewall rules before the official patch existed, an interim control that did not fix the underlying flaw.

Who reported and who shipped

The disclosure chain matters for attribution. Wiz found and reported the vulnerabilities. The PHP project, maintained largely by volunteers under the PHP Foundation, developed and released the fixes. Amazon's security team observed early exploitation attempts. Palo Alto Networks Unit 42 later reported an intrusion at a European government body in which attackers took password data and two-factor secrets within two hours.

What should site owners do about PHP2Shell?

Site owners should update to a patched PHP release and restart every PHP process, because the PHP project says updating is the only complete remedy. Restarting matters: opcode caches and long-running workers can keep serving a vulnerable binary until the processes are recycled.

Work through the following steps in order.

Update and restart PHP: the remediation steps

Remediation follows a short ordered checklist, and skipping the restart leaves the vulnerable process alive. Run these steps against every server that executes PHP, not just the primary web host.

  1. Identify the exact PHP version on each server with php -v and confirm the branch against the table above.
  2. Update to PHP 8.5.12, 8.4.27, 8.3.36, 8.2.35 or a later release on a supported branch.
  3. Restart PHP-FPM, the web server process manager, the application server and any queue workers, so no process keeps running the old binary.
  4. If the server is stuck on an unsupported branch, upgrade it, ask the host for a backported fix, or take the site offline until one is available.
  5. Avoid running exploit code found online. Some published samples are fake and carry malware.

Readers who only use websites have nothing to install. Unique passwords and two-factor authentication remain the useful protections when a server leaks credential data, because the stolen material in the Unit 42 case included exactly those secrets.

Why the underlying funding question persists

PHP runs most of the web through shared infrastructure maintained by a small foundation and volunteers. The PHP Foundation reported receiving about 680,000 dollars in donations in 2024, described in its 2024 report, for software that many organisations depend on without direct funding.

FAQ

  • Do I need to update if I use WordPress? Yes. WordPress runs on PHP, so the fix comes from the PHP runtime underneath it. Update PHP on the server, restart the PHP processes, then confirm the reported version with php -v.
  • Is restarting PHP really necessary after patching? It is. Long-running PHP workers and opcode caches can keep executing the previous binary after a package update, so recycle PHP-FPM, the web server and background workers before treating a host as fixed.
  • What if my host runs an end-of-life PHP version? Ask the provider whether it has backported the fix to the branch you run. If it has not, upgrade to a supported branch or take the site offline. No official PHP release covers branches older than 8.2.
  • How many servers were exposed? Published estimates range from over one million to more than 20 million internet-facing machines. Those figures come from third-party analysis rather than a complete scan, so treat them as order-of-magnitude guidance.
  • Can a web application firewall replace the patch? A firewall rule can reduce exposure while you schedule the update, and Cloudflare shipped such rules before the patch. The PHP project still describes updating as the only complete mitigation, so treat filtering as temporary.

Source video