Pular para o conteúdo
← Back to Skalablog

Published article

Sort the real PHP2Shell fix from the AI-made fake exploits

Software Engineering

PHP2Shell was a real remote code execution flaw in PHP, the scripting language behind WordPress, Drupal, and phpMyAdmin. The panic around it spread faster than any working exploit, because AI tools produced confident exploit code that mostly did not work while site owners pulled services offline. The bug needed a patch; the internet needed a reality check.

What is the PHP2Shell vulnerability?

PHP2Shell is a remote code execution vulnerability in PHP, the server-side scripting language that runs WordPress, Drupal, phpMyAdmin, Nextcloud, and Roundcube. An out-of-memory condition left memory handling in a bad state, and a carefully shaped request could turn that into attacker-controlled commands. Remote code execution is the serious grade, because it lets the attacker run code on the server itself rather than just read a page.

The mechanism the researcher write-up describes involves memory pointers that stop pointing at the value they should. In that condition, a command or value meant for one purpose can be replaced by another supplied by the attacker. The out-of-memory trigger matters because the failure only appears under memory pressure, which is why ordinary test traffic might not show it.

PHP is a general-purpose scripting language created by Rasmus Lerdorf in 1995. The original name stood for Personal Home Page; the language now carries a recursive acronym that the PHP project itself documents as a backronym, and it is maintained as an open-source project under the PHP Group. The PHP source and release notes are the canonical source for patched versions and the formal bug entry.

How the PHP2Shell panic spread before patches

The panic outran the patch. Exploit details circulated early, before the coordinated disclosure the researchers planned, and that leak made a compressed window in which defenders had to act on incomplete information. Site owners took services offline rather than wait, and some incidents described as hacks were routine outages caught up in the story.

A widely shared post from researcher Marcus Hutchins put the AI claims in context. He described himself as mediocre at exploit development and suggested that anyone claiming an easily AI-generated working PHP2Shell shell was either a world-class exploit developer with imposter syndrome or reading confident-sounding but wrong model output. The distinction matters because the people posting exploits often had no way to tell a working payload from a convincing one.

One structural reason the panic hit hard: PHP workloads are not a niche. Core PHP, WordPress, Drupal, phpMyAdmin, Nextcloud, and Roundcube all depend on the same runtime, so a runtime bug on shared hosting can reach many sites through one library.

AI-generated exploits and what actually worked

AI tools did help find and analyse the bug, and the researchers said so. They also made a flood of false positives. A language model can produce code that looks like an exploit, uses the right function names, and prints something convincing, while failing to reach the vulnerable memory state on a real server. Public posts often skipped the step of showing a reproducible result against a current, unpatched target.

The realistic signals of a working exploit are specific. It names the PHP version tested, shows the request payload, and includes output from the target showing command execution. Exploit write-ups that show none of those things are claims, not evidence. A screenshot of text in a terminal proves nothing unless the text is tied to the target's own output.

Some of the same model assistance that produced noise also shortened the research cycle. The write-up underlying the bug was produced with heavy AI assistance, which is a different use from generating attack scripts. The honest split: AI helps people read code and form hypotheses quickly, and it also helps people publish confident nonsense quickly.

Which PHP2Shell fixes and defences actually work

The fix is a patched PHP runtime. Upgrade to a PHP release that includes the upstream fix, and do it on every runtime that serves public traffic, including the CLI and FPM pools that sit behind nginx or Apache. Confirm the version after deployment; an overlay package on one host does not protect the others. The PHP release notes list the versions that contain the fix.

Application-side controls reduce exposure while you patch, but they are not a replacement for the runtime fix.

What this means for PHP's future in the AI era

The transcript's broader claim is that AI agents will find and exploit flaws across old software faster than defenders can react. That is a plausible concern and not yet a measured trend. The PHP2Shell case shows both directions: huge noise from AI-generated exploit claims, and a real bug that needed a real patch.

A generated PDF or a terminal screenshot is not evidence of compromise. The practical filter is reproducibility against a stated target. If a post cannot name the version, the request, and the observed result, treat it as a hypothesis.

The economic question matters more than the technology. Successful exploitation pays, so criminals do use AI tooling. Unknown flaws remain a research problem, and the barrier to a working exploit for those flaws is still high. The transcript's point stands: as AI tooling gets cheaper, the cost of a serious exploit attempt falls, even when most attempts fail.

Why did AI models seem to write PHP2Shell exploits?

  • They can produce plausible-looking code without explaining why it would work. A model may assemble the visible parts of an exploit while missing the memory state that makes it reachable.
  • People posted the output without testing it. That is the failure mode Hutchins described, and a confident post is indistinguishable from a confirmed exploit to readers.
  • Early leaks gave the models useful hints. Once fragmentary details circulated, prompts could be shaped around real function names and bug descriptions.
  • Verification is the missing step. A working shell against a current target is reproducible; an AI chat log is not.

FAQ about PHP2Shell

  • Was PHP2Shell a real vulnerability? Yes. It was a remote code execution issue in PHP reached through an out-of-memory condition, and the PHP project shipped fixes. The confusion came from the exploit claims around it, not from the bug's existence.
  • Did AI actually generate working exploits for it? Most of the widely shared AI-written exploit attempts were not reproducible, according to Hutchins and the researchers' public discussion. AI tools did assist the vulnerability research itself, which is a different activity from generating attack payloads.
  • Which websites were affected? The vulnerability affects PHP itself, so any deployment of an unpatched PHP version running a PHP application was exposed. WordPress, Drupal, phpMyAdmin, Nextcloud, and Roundcube all depend on that runtime. A patched PHP runtime removes the bug regardless of the application on top.
  • Should I take my site offline during an alert like this? Taking a site offline can be correct when an exploit is confirmed in the wild, but it is costly and should be driven by evidence. Patching the runtime and checking the version is faster and less disruptive than pulling every PHP-backed service.

Source video