Skip to content
Memory corruption Write-up Advanced

PHP2Shell: AI uncovers critical RCE vulnerabilities affecting 70% of the Internet

Multiple memory-safety bugs in PHP's core engine, triggered by fatal out-of-memory errors during request processing, leave stale internal state that a later request can reuse. An unauthenticated attacker could read sensitive process memory or execute code on servers running affected PHP versions, independent of the application.

Sagi Tzadik Follow

Published on wiz.io

In this post, we explain how frontier AI helped us find and fix vulnerabilities that had remained hidden in the PHP codebase for more than a decade. The issues described below all stem from key architecture decisions, some made over a decade ago, and were grouped under two CVEs, with severity reaching CVSS 9.2.

Sagi Tzadik, on wiz.io

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely: PHP does not fully reset global state (such as unserializer bookkeeping, session ID pointers, fatal-error backtraces and OPcache frontiers) when a request aborts with a fatal out-of-memory error, so a later request on the same worker reuses dangling pointers.

Impact

An unauthenticated attacker could read sensitive process memory (passwords, tokens, API keys) and, by chaining bugs, achieve remote code execution on WordPress, Drupal and Joomla deployments; the text notes the flaws are in PHP itself, so any affected PHP application may be vulnerable.

What the attacker needed

No authentication; target runs affected PHP version; attacker can send HTTP requests

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

PHP is the programming language that runs most websites. These bugs are in PHP itself, not in the website's own code, so even a simple site can be affected. When PHP runs out of memory while handling a request, it can leave behind broken internal pointers; a later request handled by the same worker process can then read or misuse that leftover memory, letting an attacker see secrets or run their own code.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More by Sagi Tzadik

View all

3 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.