Skip to content

Analysis: PHP2Shell: AI found decade-old flaws, and attacks began before the patch

Four critical bugs, filed as two CVEs, sat in the PHP engine for a decade. AI helped find them, and exploit attempts arrived before the patch.

· 3 min read

By Track49

Yesterday, October 21, PHP shipped fixes for four bugs in its core engine, filed as two CVEs: CVE-2026-109618 and CVE-2026-109619, scored up to 9.2 out of 10. Wiz Research, which found them with help from Calif and OpenAI, says every PHP release of the last decade is affected, back to PHP 5.4. PHP runs, by Wiz’s count, about 70% of the world’s websites.

The bugs are old. What is new is how they were found, and how fast they were used.

What is broken

The flaws are in the C code of the PHP runtime, not in anyone’s application. They concern what happens when a request dies on a fatal error, typically out of memory, partway through its work. The request ends, but some internal state is left corrupted. A later request inherits it: in the same worker process or, through OPcache’s shared memory, in another one.

Wiz reports four bugs in this family:

  • A stale session-ID pointer in upload-progress handling. It leaks worker memory to a remote caller in a PHPSESSID response cookie: session tokens, passwords, API keys. No code execution is needed, and the application does not have to use sessions.
  • A use-after-free in the upload-progress unserializer. Combined with the leak, it was taken to remote code execution against WordPress, Drupal and Joomla.
  • A use-after-free in fatal-error backtraces. It crosses from one request into the next, and was taken to remote code execution against Drupal.
  • A type confusion in OPcache. It crosses between workers through shared memory, and was taken to remote code execution against WordPress.

These are memory-safety errors: use-after-free and type confusion. They are the classes that memory-safe languages rule out: garbage-collected languages at run time, and safe Rust at compile time.

Why it stayed hidden for ten years

Cross-request bugs are hard to see. A reviewer reads one request path at a time. A fuzzer rarely models request N+1 inheriting the wreckage of a failed request N. Even with the bug in hand, an exploit has to be adapted to each PHP version, configuration and heap layout. That is slow, expert, manual work, and that cost was the real defense.

AI removed most of it. Wiz used frontier models across discovery, exploit development, detection and patch validation, and writes that they “substantially reduced that barrier, turning a longstanding flaw into an exploit.” The models helped find the bugs, and did the tedious part: porting an exploit across versions and memory layouts. As Salil Kanhere of UNSW Sydney put it to the BBC: “The underlying bugs weren’t new; what changed was our ability to find them.”

The other side of the same tool

The capability does not belong only to the defenders. Details leaked before the planned disclosure. Cloudflare’s chief executive, Matthew Prince, reported thousands of exploit attempts on its network in the ten hours before the announcement, tens of thousands in the 45 minutes after, and hundreds of thousands within two hours. Amazon said it was targeted days before disclosure.

The response shows how seriously operators took it. Wikimedia took systems offline as a precaution. The Finnish government and the Netherlands’ national cybersecurity agency pulled their own sites. The US National Security Agency told organizations that cannot patch at once to take PHP systems offline, warning of a “direct path” to the database behind them.

What to take from it

  1. Age is now a priced risk. Large, old C codebases were protected partly by the cost of auditing them. That cost is falling for everyone, attackers included. Expect more findings like this one in mature runtimes.
  2. The window between disclosure and exploitation can now be zero. Attack traffic here arrived before the advisory, because details leaked. Measure your patch latency in hours, and keep a runbook for taking a service offline when you can’t patch in time.
  3. Know where the runtime lives. PHP is not only in websites. LRQA’s Daniel Stewart points to the management interfaces of network appliances, load balancers and embedded devices, which are “often overlooked during these incidents.”
  4. Watch the signals Wiz published: unusual multipart requests followed by memory-limit errors, repeated HTTP 500 responses, oversized or malformed PHPSESSID cookies in responses, and unexplained worker churn.
  5. Treat bug classes, not only bugs. Patching closes these two CVEs. The class they belong to remains a risk in any runtime written in memory-unsafe code.

Patch first. Wiz calls the update “the only complete remediation.” The longer question is how much of a business still runs on code where finding the next flaw has just become far less expensive.

Sources

  • security
  • ai
  • php
  • legacy