Case Studies

PHP2Shell: How Effective Is AI at Finding Bugs?

Wiz says AI helped uncover a remote code execution flaw in PHP CGI parameter handling. The vulnerability's PoC is public, revealing both where AI accelerated the research and what defenders need to verify in production deployments.

Font size

Wiz says AI helped uncover a vulnerability in PHP CGI parameter handling. The proof-of-concept is now public. This analysis examines what AI actually contributed and which configurations developers should inspect.

The short answer is clear: AI cannot yet replace security researchers. It is more like a fast, tireless intern who still needs human direction. AI is good at enumerating unusual inputs, validating hypotheses in bulk, and reducing repetitive work.

The issue here is specific enough to merit a closer look.

What PHP2Shell Is

This is not a vague claim that a vulnerability “might exist.” PHP2Shell is a remote code execution vulnerability in PHP CGI parameter handling. According to Wiz, an attacker can craft malformed parameters that cause the server to execute unintended code while processing a request.

The vulnerability details and proof-of-concept are available at php2shell.com, with the full technical analysis in the Wiz blog post.

The Hacker News post's score of 393 and 146 comments do not appear in the supplied source material, so this article does not use those figures or claim that the post reached the front page.

The key term is CGI, or Common Gateway Interface. In traditional web deployments, PHP does not always run as a standalone process. Many older systems launch PHP through CGI. The server configuration, startup method, and parameter parsing all determine the final behavior.

The trouble with vulnerabilities like this is that exposure depends on the deployment model. The same PHP version may present different attack surfaces under different server configurations. Developer machines, containers, reverse proxy environments, and legacy shared hosting cannot be treated as equivalent.

For defenders, a PoC is more useful than an instruction to “upgrade immediately.” Operations teams can compare it with their own request-handling stack to determine whether the same flaw is present. For specific affected versions and the scope of the fix, consult the original Wiz report and PHP's official advisories.

What AI Did in This Research

According to public information from Wiz, AI assisted with the research process. The available draft does not identify the model used or fully explain which steps AI handled. It therefore would be inaccurate to say that AI independently discovered a 0day.

Security audits generally involve several layers:

  • Reading code to trace paths that carry parameters into the interpreter.
  • Enumerating encodings, escapes, boundary values, and malformed inputs.
  • Building minimal requests to determine whether behavior changes.
  • Verifying whether code execution can be obtained reliably rather than merely triggering a crash or error.

AI can test large numbers of candidate inputs. It can also identify combinations that are easy to overlook during manual review. A parameter may behave normally under ordinary input, yet a specific encoding, repeated character, or boundary value could alter the parsing path.

Locating an anomalous input and understanding why it creates a vulnerability are different capabilities.

A system generating one million malformed requests and a researcher explaining why one request executes code are performing fundamentally different tasks. The former is enumeration; the latter is modeling. AI is currently most valuable in enumeration and validation. Whether it can consistently originate new attack primitives will require more public evidence.

The most notable aspect of this case is that AI scaled up trial and error. Determining the size of that improvement still depends on the sample size, runtime environment, and amount of human effort involved.

Reproduction Costs: Human Research vs. AI

The available material includes no publicly verified comparison of time spent with and without AI. It is also necessary to check whether Wiz's report provides such data. The current information does not support precise claims such as “researchers needed 40 hours, while AI completed the task in five minutes.”

No artificially precise number is warranted here.

Traditional manual research requires familiarity with the historical behavior of PHP CGI, server startup arguments, and differences in request parsing. Researchers must also build the environment and test encodings, parameter positions, and malformed inputs. Much of the time goes into confirming that a behavior reproduces consistently rather than simply reading code.

With AI assistance, a pipeline can expand candidate inputs, execute requests automatically, and inspect responses and environment changes. It does not handle every analytical task, but it can take on a large volume of repetitive testing.

The shift resembles the evolution of software testing from manually clicking a few buttons to automatically generating a test matrix.

Judging whether AI improved productivity requires more than asking whether it eventually found the vulnerability. Evaluators also need to know:

  • Whether the number of candidate inputs increased substantially.
  • Whether results can be reproduced in the same environment.
  • Whether humans needed to understand every failed sample.
  • Whether the root cause can be explained independently.
  • Whether defenders can reproduce the result.

If only the final result is available without the underlying process data, the case shows that AI was useful, but not that it can replace researchers.

Why the PHP Ecosystem Is Vulnerable Again

This does not mean that PHP itself has suddenly become exceptionally fragile.

PHP deployments carry significant legacy complexity. Many websites still run old versions, outdated CGI configurations, or compatibility layers. They may have gone live long before modern PHP applications became common. Documentation, container images, and deployment scripts may also have fallen out of date.

Shared hosting and small VPS environments are particularly prone to these conditions. Users may know they can upload PHP files without understanding how the web server launches PHP. Whether the vulnerability is reachable depends on external configuration, not only application code.

For a CGI vulnerability like this, scanning solely by PHP version may not be enough. Defenders need to verify:

  • Whether the affected CGI path is currently enabled.
  • Whether the server runs PHP with legacy arguments or in compatibility mode.
  • Whether an upstream reverse proxy, WAF, or container configuration changes request behavior.
  • Whether logs contain unusual parameters or unexpected processes.

Security advisories are also easy to misread. A scanner reporting that “PHP is at risk” does not mean every server is directly exploitable with the same PoC. It also does not mean the issue can safely be ignored.

What Developers Should Do

Start by confirming exposure, then follow official upgrade guidance.

  1. Check the PHP version and execution model. Do not stop at php -v; identify which PHP binary the web server actually invokes and which execution mode it uses.
  2. Compare the environment with the vulnerability details and PoC at php2shell.com to determine whether it exposes the corresponding CGI request path.
  3. Obtain the fixed version through vendor and official PHP channels. Do not copy commands from blog posts without verifying them. First determine whether the distribution already provides a patch and whether its package manager still supports the affected release.
  4. If upgrading is not immediately possible, review and tighten the CGI configuration, restricting unnecessary parameter parsing and malformed requests. Follow the official vulnerability guidance and vendor recommendations for specific mitigations.
  5. Review web access logs, PHP processes, and system processes. Focus on unusual request parameters, abnormal exits, suspicious child processes, and temporary files. Preserve raw logs and a timeline when suspicious activity appears.
  6. Perform an independent reproduction, but do not run the PoC as a public scan against production systems. A safer approach is to validate the configuration in an isolated environment with operations, application, and infrastructure owners involved.

What security teams fear most is not the phrase “the system has a vulnerability.” It is having a vague vulnerability description that does not prompt a serious deployment review until attacks begin.

Editorial Perspective

PHP2Shell matters because it places AI-assisted vulnerability discovery in a real deployment environment involving legacy servers, CGI parameter parsing, configuration differences, and exploit validation. A single case, however, does not prove that AI can independently complete 0day research.

In the near term, AI's most practical value is not inventing vulnerabilities from nothing. Its value is expanding the scale of enumeration and validation. Humans still need to define the problem, explain the root cause, and decide whether an anomaly is worth reporting.

This differs from earlier code-audit assistants. Models are now entering the trial-and-error stage before a vulnerability emerges, reducing testing costs. It remains unclear whether the efficiency gains come from the models themselves or from more mature CGI testing environments. Without data on the model, sample size, execution count, and human effort, claims about a specific speed-up factor would be premature.

Source: https://www.wiz.io/blog/php2shell-php-rce