Latest

Cybersecurity

php2shell, the software flaw that slept for a decade in PHP

Four memory corruption primitives in the PHP engine allow remote code execution without credentials since 5.4. Patches and how to detect it.

php2shell, the software flaw that slept for a decade in PHP
php2shell, the software flaw that slept for a decade in PHP

A server with an up-to-date PHP, a current CMS and no custom code in the attack path. That was enough to execute commands in WordPress, Drupal or Joomla without credentials, according to the demonstration that Wiz Research published on October 21. The two flaws that allow it, CVE-2026-109618 and CVE-2026-109619, are in the language engine: the vulnerable code has been there for more than a decade and what changed was the ability to turn it into an exploit.

Wiz's analysis arrived the same day as the patches, PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35. The window was hours long because the secret broke the day before: the identifiers circulated on October 20 around 15:00 UTC with a fake CVSS score of 10.0, the project moved its advance notice to 19:30 and the coordinated disclosure, scheduled for the 22nd, moved to the 21st.

The consequence for those who administer systems is uncomfortable. An inventory by CMS or by framework falls short, because the flaw is underneath, in how PHP frees memory when a request dies due to the memory limit. It affects installations that never called session_start() and leaves little trace in application logs, which barely retain engine context.

A fatal error that does not end with the request

It is worth fixing the scale before entering the primitives. There is no configuration that turns off the flaw, no extension that covers it and no framework that abstracts it, because the state that is recycled is that of the interpreter itself.

PHP enforces its memory_limit with longjmp(), a jump that aborts the request without unwinding the call stack. The shortcut is very fast and has been in the engine for decades: instead of returning an error at every level, PHP jumps to shutdown and frees the requested memory in one go. CVE-2026-109618 shows that it also leaves loose ends. If the limit is reached when an internal structure is half-initialized, cleanup treats invalid data as valid and the freed memory retains what a previous allocation left behind.

A flaw without limits

The second flaw (CVE-2026-109619) does not need the limit. A fatal error at the wrong point leaves the worker's global state pointing to memory from the previous request and, since PHP handles requests in processes that survive, that orphaned pointer opens the door to the next visit. The project sums it up in its advisory: the state of one request can outlive the memory that backed it and a later request from the same worker can use it before normal initialization resets it.

The distinction matters for diagnosis. A 500 due to lack of memory is routine on any shared hosting, and what is anomalous is not the error but that the worker that handled it stays alive and serves the next request with memories of the previous one.

Both flaws share a root and severity, with CVSS 9.2 each, according to the CERT-EU advisory. They also share a property that makes them hard to dodge from outside: the requirement is not an application bug, but a request designed to die at the right moment. Any PHP code offers that surface, however small.

Four ways to inherit someone else's memory

Wiz described four exploitable instances, grouped under those two identifiers and with different impacts. The first is a use-after-free in the upload progress unserializer: the decoder keeps its accounting in a global variable and an allocation failure leaves it published while the request's memory is destroyed. The second does not seek to execute code, but to read. The session identifier lives in PS(id) and, if shutdown is interrupted, PHP trusts a stale pointer and returns recycled memory in the PHPSESSID cookie.

Primitive CVE Impact Demonstrated chain
upload progress unserializer, use-after-free 109618 corruption and code execution preauth RCE in WordPress, Drupal and Joomla
PHPSESSID cookie, disclosure of worker memory 109618 reading memory from other requests without authentication and without session_start()
backtrace of the last fatal error, use-after-free 109619 corruption between requests preauth RCE in Drupal
type confusion in OPcache 109619 shared corruption between workers preauth RCE in WordPress

The other two live in the error and in the cache. The backtrace of the last fatal error is kept in EG(last_fatal_error_backtrace) and, if the request dies without clearing it, the worker drags a pointer to freed memory that can be read in the next one. The fourth is subtler: OPcache persists compiled structures in shared memory and advances a local counter before publishing the shared one, so an allocation failure leaves objects half-persisted in slots that other workers assume are free. If another process reuses them for an object of another type, the metadata resolves a wrong pointer.

Those four do not exhaust the problem: there are tracked variants and probably untracked ones, with different requirements and under the same two CVEs. The patch attacks the root and not each symptom, although no one can claim that the four were the worst.

Everything falls before the attack

The highest-risk scenario is not the most modern one. PHP considers mod_php the most exposed configuration because the trigger occurs before application code runs: the engine parses the multipart request during startup, when many of the modules have not yet been initialized. With PHP-FPM startup is different, although the project confirmed remote execution through that route as well via application paths.

Wiz chose three well-known targets for the public demonstration: the most recent container images of WordPress, Drupal and Joomla at the time of testing. They were not old installations with abandoned plugins, but the state of the art of three CMSs that support much of the web. Exploitation did not depend on any of them: even a program that only prints a greeting falls on an unpatched version.

That detail separates this case from a plugin advisory. The surface is not defined by what the administrator installs, but by the interpreter version, and that version is imposed by the hosting or the base image.

The second half of the finding looks more like Heartbleed than a credential theft. Without going as far as executing code, the attacker reads a region of the worker's memory of the size they choose, with passwords and tokens from other requests, as well as API keys and server certificates. Wiz compares the flaw to the 2014 OpenSSL incident, when the serious thing was not the encryption, but what leaked into the responses.

From the 2024 audit to the broken embargo

The story of the flaw begins in an audit and ends in a leak, with two and a half years between the two. The timeline published by the PHP Foundation allows it to be reconstructed with times at almost every milestone.

Date What happened
2024 Quarkslab audit funded by the Sovereign Tech Agency via OSTIF; while fixing another finding, the first hint appears
30 Jul 2026 Calif begins its PHP audit in the Patch the Planet program
11 Aug 2026 Calif reports an unconditional remote code execution with the same root cause; OpenAI, the same that day
19 to 24 Aug 2026 Wiz finds the flaw, confirms RCE against Drupal and WordPress and reports it
18 to 21 Sep 2026 OpenAI contributes additional vectors; PHP acknowledges the reports and begins the coordinated patch
20 Oct, 15:00 UTC The two CVEs leak with a fake time and a CVSS 10.0
20 Oct, 19:30 UTC Advance notice moved up and release moved from the 22nd to the 21st
21 Oct, 07:41 UTC Chainguard breaks the embargo with already patched images
21 Oct, 13:30 to 14:00 UTC 8.5.12, 8.4.27, 8.3.36 and 8.2.35 are released; CERT-EU records 13:30, the project set 14:00

The video that Calif published by mistake around 20:00 UTC showed the proof working against real targets and accelerated the development of others' PoCs. Chainguard had received the patch in advance, so studying the fix in binary was possible six hours earlier than for the rest. The oldest attempt was already recorded: Amazon Threat Intelligence dated it October 17, four days before the announcement, from an address on a commercial anonymization network. Between 02:00 and 08:00 UTC on the 21st, PoCs and more attempts against its honeypot network appeared, with different payloads and several actors.

Cloudflare moved before everyone else. Its WAF rules took effect at 03:02 UTC on the 21st for all plans, including the free one, some nine hours before the announcement, and the company documented attempts to mutate the payload to evade the signature. Its statement admits that per-request filtering was not enough: it was also necessary to look at the origin's response in the same HTTP transaction, a capability they debuted here.

What AI changed in the economics of the exploit

Wiz found the flaw on August 19 and had remote execution against Drupal and WordPress in two days. It did so with its Atlas platform and with two frontier models, Gemini 4 Argon and GPT-5.6 Sol, and attributes to Argon a decisive contribution in discovery, the exploit and patch validation. The sentence with which they summarize the change of scale is the most uncomfortable of the episode: one researcher completed in a week what would previously have demanded months from a top-tier team.

The calendar helps measure the leap. Between the finding and the remote execution, 48 hours passed, and between that and the patch, two months of coordinated work with the PHP project and with two other teams.

Exploiting these flaws required chaining several primitives and tuning the exploit to how each version of PHP and each application distributes memory. An attack that worked in one deployment broke in another and demanded new debugging. That work, reproducing the same error in a hundred different configurations, was the real filter, and the models made it cheaper.

The other side is that the same effect applies to the other side. The PHP Foundation uses AI tools to validate reports and group those that share a root cause, and since July 1 it has published 15 CVEs and discarded more than a hundred duplicate or non-reproducible reports. AWS adds the part that breaks schedules: turning a patch's diff into an exploit has also become cheap, so seven- or thirty-day windows no longer describe reality.

Update versions and protect yourself

The version map is short and does not allow interpretation. The project advisory on php.net sets the four supported branches, leaves out everything earlier and recalls that distributions received the patch before the release.

Branch Version with the fix Status
PHP 8.5 8.5.12 supported
PHP 8.4 8.4.27 supported
PHP 8.3 8.3.36 supported
PHP 8.2 8.2.35 supported
PHP 8.1 and earlier no project release end of life; there are minimal code backports for 7.4, 8.0 and 8.1

Those who depend on third-party repositories have an extra problem. The project warns that rpms.remirepo.net, maintained by volunteers, would not have updates on the day of the release and recommends switching to the distribution's packages or compiling. CISA, in its October 21 alert, asks to inventory all PHP in the organization, including embedded, and to take offline systems that remain on 8.1 or earlier.

Mitigations exist and none closes the problem. The project proposes setting memory_limit to -1 via php_admin_value to remove the limit-controllable flaw from the equation, lowering post_max_size to 8M or 32M and disabling session.upload_progress.enabled; in PHP 8.5 fatal_error_backtraces must also be turned off, and in all cases workers must be restarted. Its conclusion is that updating is the only safe option, and AWS says it in other words: there is no configuration workaround that covers both CVEs.

Signals an attack leaves in the logs

The flaws execute below the application layer, where WordPress or Symfony logs see nothing. Wiz proposes three patterns that do remain on the web server: anomalous multipart requests followed by memory limit errors or series of 500s on the same path, malformed PHPSESSID cookies or ones of unexpected size, which are the fingerprint of the disclosure, and a rotation of workers that no one explains by load or deployment.

  • Look for the PHP_SESSION_UPLOAD_PROGRESS string in the body of POSTs and see if it appears in forms that upload nothing.
  • Cross-reference the spikes of 500s with PHP processes that launch shells or download tools, the behavior CISA asks to monitor.
  • Review the addresses AWS published as indicators, knowing that they are shared anonymization and that they serve to investigate, not to block.
  • Inventory third-party software that embeds PHP with the list from the Dutch NCSC on GitHub, because the problem reaches appliance panels, network appliances and management consoles.

Forrester analyst Madelein van der Hout recalled in TechTarget 's coverage that patching does not eliminate access an attacker may already have obtained. That coverage includes Palo Alto Networks' estimate of 22.6 million exposed instances, a scanning figure and not a census. To size the market, the W3Techs count of October 22 places PHP on 69.3% of sites whose server language is known, hence the rounded 70% in the statements.

An engine fixed by hand and against the clock

The part of the episode that will be least remembered is the one that should weigh most. The PHP security team took months to choose between incompatible solutions: breaking backward compatibility, opening a new denial-of-service path or demanding changes from extensions that no one could coordinate. The foundation describes it bluntly: the delay was a structural failure, caused by the decision process and by the lack of resources.

That diagnosis coexists with a regulatory context that no longer accepts the excuse of scale. Since September 11, 2026, manufacturers of products with digital elements must notify exploited vulnerabilities through the CRA's single platform, as ENISA recalled in its joint statement with the European Commission, CERT-EU, Europol and the CSIRT network. An engine written in C, sustained by a handful of funded people and with twenty years of design decisions on top, fits poorly if the money keeps coming per project.

Complexity stopped being a defense. For a decade, these flaws were not exploited at scale because chaining them demanded disproportionate human effort; in August one researcher with two frontier models and a week was enough.

José Maldonado

Author

José Maldonado

Activist and blogger on technology, free software and blockchain.

The latest
From Huang to Botín, from Zara to Byron: corporate responsibility in global capitalism

Keep reading