Pular para o conteúdo
← Back to Skalablog

Published article

What Are the PHP2Shell Vulnerabilities in PHP?

Software Engineering

PHP2Shell is the name given to two critical vulnerabilities in PHP itself, the server-side scripting language that powers a large share of the web. Attackers who can force PHP to run out of memory at the wrong moment may be able to execute their own code on an unpatched server, so updating PHP, not just the application on top of it, is the fix.

What PHP2Shell is and why it matters

PHP2Shell is the public name for two critical vulnerabilities in PHP, the server-side scripting language, that can allow remote code execution on affected servers. The flaws sit in the language runtime itself, so a fresh installation of WordPress, Drupal or Joomla does not protect a host, and patching the application alone leaves the code path open.

The short version published alongside the release describes a memory-exhaustion path. If a request drives PHP out of memory at a particular moment, the runtime can leave partially built data behind and later trust it. A crafted request then lets an outside party execute code without authenticating.

That description matters for scoping. The vulnerability class is a memory-safety problem in the interpreter, not a misconfiguration or a plugin flaw. Servers that run any affected PHP version are in scope regardless of what application sits on top, which is why advisories pointed at the runtime rather than at any one content management system.

What the early leak did to the disclosure timeline

An embargo broke before the scheduled release, and the released patches arrived with much of the detail already public. The plan was a coordinated publication, but CVE identifiers appeared on a public forum ahead of time, PHP moved its release forward, and a container image with the fix shipped hours before the official announcement.

The sequence compressed the window between disclosure and exploitation attempts. Once patched images are public, anyone can diff them against the previous build and locate the changed code. That is the practical cost of an early fix: defenders get the patch, but so does everyone studying for an exploit.

Vendors closer to the process were briefed in advance. Edge providers prepared filtering rules and enabled them broadly around the public release, and some reported watching attackers adjust payloads in an attempt to get past the new rules. That advance notice is the mechanism that kept the incident from being worse than it was.

Which PHP versions got official patches

Official releases covered newer PHP branches, while older versions received patches that maintainers or administrators have to build themselves. Coverage therefore depends on which branch a server runs, and the long tail of older installations is the population most likely to stay unpatched.

The picture is uneven. The PHP project supports a limited set of current branches with regular releases; versions outside that support window get best-effort or no official binaries. A scan cited in coverage found a majority of surveyed servers reporting an older branch, which puts a large installed base outside the easy upgrade path.

Distribution maintainers softened the gap. Some packagers backported fixes further back than the upstream project's own release window, so a Debian or Ubuntu administrator may receive a patched package for a version that no longer gets official binaries from the project. Checking the distribution's own security tracker is the reliable way to confirm local status.

Cyber security agencies in several countries advised organisations that could not patch quickly to take affected systems offline rather than leave them exposed. That advice produced a visible wave of shutdowns across public-facing services in Europe and beyond.

The organisations that disconnected included national login and parliamentary services, university sites and large community platforms. Some operators chose to take every server in a business offline until patched, and administrators described the move as the first deliberate shutdown of its kind in decades of operation.

No confirmed successful exploitation against a patched or protected target has been reported by the agencies tracking the incident. The visible damage was mostly self-inflicted downtime, chosen as the safer option while patches were applied.

Has PHP2Shell actually been exploited?

Public reporting has described exploitation attempts in the wild without confirming a successful compromise of a defended target as of the disclosures reviewed here. Attempts using tooling assembled with AI assistance were observed, which is consistent with the short time between patch and attack.

Agencies tracking the incident said they had not confirmed successful exploitation at the time of their statements. That absence is evidence of a limited observed impact so far, not proof that no server was breached; organisations with logging gaps would not necessarily know.

The practical reading is that perimeter filtering and prompt patching absorbed most of the pressure. Filters are a stopgap. A server still running an affected PHP version behind a filter remains one rule change or one bypass away from exposure.

Who found the bug, and the dispute over credit

Several organisations claimed a role in finding the vulnerabilities, and the accounts do not fully agree. One security firm published research describing exploitation against fresh installations of popular content management systems and stated that the flaw affects the language itself.

A second account credits a named researcher whose work began from a hypothesis about where the bugs were hiding, rather than from a specialised AI harness. That researcher had knowledge of prior audit findings that pointed at the same area without proving exploitability. A third organisation described an AI model's contribution to its own independent discovery.

The dispute is not resolvable from public statements alone. What the accounts share is the underlying technical history: a security audit had already flagged the sensitive code path, the fix had stalled, and the missing piece was proof that the condition could be turned into a working exploit.

How to check and patch a PHP server

Patch PHP itself, then confirm the running version, because an upgraded package on disk does not prove the running service was restarted. The following steps cover the common cases on a Linux host running PHP behind a web server.

  1. Find every installed PHP binary and version, including command-line interpreters that a web server may not use.
  2. Identify the packages that own those binaries so the distribution's patched version can be confirmed in its security tracker.
  3. Apply updates through the package manager and restart both the PHP-FPM service and the web server so the new runtime is loaded.
  4. Verify the reported version after restart, then re-check for leftover containers, images and long-running workers built on an older base.
  5. Where immediate patching is impossible, follow agency guidance and take the system offline until a patched build is in place.

The last step is the one organisations skip. Containers built on an old base image, background workers started before the upgrade and forgotten development servers all continue to run the vulnerable code path even after the primary host has been updated.

Why this will not be the last language-level incident

The PHP2Shell episode shows that the hard part of coordinated disclosure has changed. Finding the bug used to be the bottleneck. With capable tooling available to attackers and defenders alike, the hours between a leak and a working exploit are now the constraint, and disclosure processes built around a multi-day embargo are under strain.

A reasonable expectation is that similar incidents follow in other runtimes. The mechanism is general: an old bug class, a stalled fix, an audit that finds a symptom without proof, and tooling that shortens the path from theory to exploit. Nothing in the sequence is specific to one language.

For operators, the durable response is mechanical. Track the runtime separately from the application in inventory, watch the language project's own security releases as well as the application's advisories, and keep a rehearsed path for taking a service offline quickly when a patch cannot land in time.

FAQ

  • Does updating WordPress fix PHP2Shell? No. The vulnerabilities sit in the PHP runtime, so updating a content management system or plugin does not remove them. The PHP installation on the host has to be patched or replaced.
  • Which PHP versions are affected? Coverage depends on branch. Newer supported branches received official releases, and some older versions require a self-built patch. Distribution maintainers may backport fixes further back, so check the distribution's security tracker for the exact package version in use.
  • Is a web application firewall enough? A filter reduces exposure but does not patch the server. A WAF rule can be tuned around or bypassed, and vendors reported attackers adjusting payloads after rules went live. Treat filtering as temporary cover while the runtime is updated.
  • Was anyone actually breached? Public reporting describes exploitation attempts without confirmed successful compromise of a defended target at the time of the statements reviewed. Absence of confirmed breaches does not prove no server was affected, particularly where logging is incomplete.

Source video