Skip to content
Introducing AI OS for Business & School — our most powerful products yet.Explore →
App Corp iconApp Corp
Security
PHP2Shell
AI security
legacy modernization

AI Found PHP2Shell: Legacy Code Is High-Risk

AI Found PHP2Shell, and It Will Find the Next One: Why Legacy Codebases Just Became High-Risk

AE

App Corp Engineering

Editorial Team

October 23, 202611 mins read
11 mins readRead time
1,030Words
Oct 2026Published

This free scan includes a PHP2Shell runtime check

Fixed in 8.5.12, 8.4.27, 8.3.36, 8.2.35. Reviewed 27 October 2026.

What to do now
App Corp Engineering·Editorial Team
Last updated 2026-10-23

What is AI Found PHP2Shell?

AI-discovered vulnerabilities are security flaws located or weaponised with help from frontier AI models, as happened with PHP2Shell, where Wiz Research working with Calif and OpenAI used AI to find memory-corruption bugs in PHP's C source and chain them into exploits that run before any application code.

PHP2Shell was found with AI: Wiz Research worked with Calif and OpenAI, and says frontier models helped discover the memory-safety bugs in PHP and chain them into working exploits. Some of the weaknesses had been hiding in plain sight for over a decade, because session upload progress dates back to PHP 5.4.0. The economics of vulnerability research have changed, and finding bugs in old code is now cheaper and faster for defenders and attackers alike, which puts large, old, poorly tested and widely deployed legacy PHP and WordPress estates at the top of the target list. The sensible response is to shrink and modernise the attack surface, not simply patch faster next time.

How AI helped find PHP2Shell

On 19 August 2026, Wiz Research found the first in a series of memory-safety bugs in how PHP handles fatal errors, especially out-of-memory conditions in the middle of a request. Within two days they had confirmed unauthenticated remote code execution against Drupal on 20 August and WordPress on 21 August. Wiz's write-up, titled PHP2Shell: AI uncovers critical RCE vulnerabilities affecting 70% of the Internet, credits frontier AI models with helping to find the underlying memory-corruption bugs in PHP's C source code and chain them into a reliable exploit that runs before any application code. Mainstream outlets led with the AI angle: Axios wrote about bugs discovered by OpenAI tech creating a cyber emergency, while CNN and RTE framed the story as AI exposing critical flaws. One part stands out. PHP's out-of-memory handling showed warning signs during a 2024 audit by OSTIF and Quarkslab, but no exploitation path was proven and the fix stalled. Human auditors noticed the smell; AI-assisted research turned it into a working weapon within days. The technical anatomy of the two CVEs is in PHP2Shell Explained.

Note

AI does not just find more bugs. It closes the gap between suspicious and exploitable.

Why this changes the threat model

For twenty years the security of most business software quietly relied on a few assumptions that AI breaks. Automated agents can audit thousands of obscure repositories and plugins in parallel, so being obscure no longer protects you. Models can reason through heap layouts and exploit chains, which lowers the skill needed to turn a memory bug into a working exploit. Age now means more time for latent bugs to pile up, and AI is good at finding latent bugs, so old code is no longer battle-tested by default. The window between disclosure and attack has collapsed: a leaked archive reached VirusTotal at 02:29 UTC on 21 October, Patchstack reported active exploitation incidents at 07:34 UTC, and PHP's fix landed at 13:52 UTC, giving attackers a head start of several hours. Public proof-of-concept repositories multiplied after the leak, some wrong and some later withdrawn, but all showing how quickly people move to weaponise a disclosure.

mermaid
flowchart LR
    subgraph Before[Pre-AI era]
      A1[Bug exists] -->|years| A2[Expert finds it] -->|weeks| A3[Exploit built] -->|weeks| A4[Mass exploitation]
    end
    subgraph After[AI-assisted era]
      B1[Bug exists] -->|days| B2[AI-assisted discovery] -->|days| B3[Exploit chain] -->|hours| B4[Mass exploitation]
    end

Why legacy codebases are first in line

If you were an attacker with an AI research assistant, you would choose targets that are widely deployed, so one exploit pays off across millions of sites; PHP runs on 70.8% of websites with a known server-side language. You would choose code that is old and full of C-level or untyped language written before modern memory-safety practices, and systems that are rarely updated: about 79% of versioned PHP services seen by Modat run unsupported branches, and PHP 7.4 alone accounts for 878,761 services. You would target software extended by third parties, because a typical WordPress site runs dozens of plugins from independent developers and Patchstack research consistently finds that most WordPress vulnerabilities sit in plugins. And you would target code built without tests, because many custom PHP applications from the 2010s have little or no automated test coverage, making them easy for AI to reason about and hard for owners to patch safely. The same features that made PHP and WordPress easy to adopt now make them the most economical targets for AI-assisted offence.

The defender's paradox

AI helps defenders too. Wiz found PHP2Shell and Datadog independently reproduced it, which sped up validation, while Cloudflare shipped WAF rules within hours. The catch is that defence only helps if you can apply it. An AI can find a bug in your 2014 Laravel 4 application, but someone still has to fix it, test it and deploy it without breaking billing. A patch for PHP 8.4 does nothing for a server stuck on PHP 7.3, which received no fix at all. A WAF rule blocks today's exploit but not tomorrow's variant. The organizations that benefit most from AI-era security are those whose software is easy to change: typed, tested, containerised and continuously deployed. Those with brittle legacy estates absorb the risk without the benefit.

Pro Tip

Defensive AI only pays off where the software is easy to change. On a brittle legacy estate you absorb the risk without the benefit.

What AI-resilient software looks like

No stack is immune. Node.js, Python and Go all ship security releases, so resilience is about how quickly and safely you can respond and how much code is exposed in the first place. Typical legacy PHP and WordPress estates send every page request to a live PHP process, run dozens of plugins with full database access, rely on dynamic typing where errors appear at runtime, often ship with no tests, and are patched through manual server upgrades where branch jumps break things, with secrets sitting in wp-config.php or an .env file on disk. A modern TypeScript stack with Next.js, Payload and PostgreSQL statically generates most pages and serves them from a CDN, uses curated npm dependencies scanned automatically by Dependabot, Snyk or npm audit, catches whole classes of bugs at compile time with TypeScript, runs unit, integration and end-to-end tests in CI, and patches by bumping a dependency and redeploying an immutable build in minutes. This is the reasoning behind App Corp's stack: Next.js for static and edge rendering, Payload CMS for typed content, Supabase and PostgreSQL for row-level security, and TypeScript end to end. The goal is not zero vulnerabilities; it is a smaller blast radius and a faster, safer fix.

Sources and references

Wiz Research published PHP2Shell: AI uncovers critical RCE vulnerabilities affecting 70% of the Internet at wiz.io/blog/php2shell-php-rce, and Recorded Future explained the exploitation timeline at recordedfuture.com/blog/php2shell-vulnerability-exploitation. Axios covered the OpenAI angle at axios.com/2026/10/22/php-vulnerability-security-update-websites, CNN reported the global shutdowns at cnn.com/2026/10/21/tech/php2shell-vulnerability-ai-intl, and RTE covered the outages at rte.ie/news/world/2026/1021/1596231-eu-cybersecurity. SOCRadar listed affected versions and fixes at socradar.io/blog/php2shell-cve-2026-109618-cve-2026-109619, tbreak covered the audit history at tbreak.com/php2shell-php-vulnerability, SentinelOne published defensive guidance at sentinelone.com/blog/stopping-php2shell-how-sentinelone-protects-customers-from-this-attack-technique, W3Techs published PHP usage statistics at w3techs.com/technologies/comparison/pl-php, and Patchstack's State of WordPress Security sits at patchstack.com/whitepaper/state-of-wordpress-security-in-2025.

Legacy PHP estate versus modern TypeScript stack

PropertyLegacy PHP / WordPressModern TypeScript stack
Public attack surfaceEvery page request reaches a live PHP processMost pages are statically generated and served from a CDN
Third-party codeDozens of plugins with full database accessCurated npm dependencies, scanned automatically with Dependabot, Snyk or npm audit
Type safetyMostly dynamic; errors appear at runtimeTypeScript catches whole classes of bugs at compile time
TestsOften noneUnit, integration and end-to-end tests run in CI
PatchingManual server upgrades; branch jumps break thingsBump a dependency, CI runs, immutable redeploy in minutes
InfrastructureHand-configured serversInfrastructure as code; ephemeral containers or serverless
SecretsOften in wp-config.php or .env on diskManaged secret stores, scoped per environment

The goal is not zero vulnerabilities; it is less exposed code, fewer unvetted third parties, and a fix-and-redeploy cycle measured in minutes.

A practical 90-day plan

  1. 1

    Stabilise (days 0-7)

    Patch PHP to 8.5.12, 8.4.27, 8.3.36 or 8.2.35 everywhere, rotate secrets that may have been in worker memory, and put a WAF and CDN in front of every PHP origin.

  2. 2

    Inventory and triage (days 8-30)

    List every PHP application with its PHP version, owner and business criticality. Flag anything on end-of-life PHP, count plugins and dependencies, identify abandoned ones, and score each system on exposure, data sensitivity and difficulty to patch.

  3. 3

    Retire and upgrade (days 31-90)

    Retire what nobody uses, then upgrade the healthy systems that sit on supported branches so they stop drifting toward end of life.

  4. 4

    Re-platform and rebuild (days 31-90)

    Move WordPress sites to Payload CMS and custom PHP apps to TypeScript and Node.js, ideally with a strangler-fig approach that avoids a risky big-bang rewrite.

A patched and inventoried estate in the first month, with a prioritised retire, upgrade, re-platform or rebuild roadmap completed by day 90.

Legacy PHP runs most of the web According to W3Techs, 70.8% of websites with a known server-side language run PHP. About 79% of versioned PHP services run unsupported branches and PHP 7.4 alone accounts for 878,761 services, so a large share of that exposure never gets an official patch.

Conclusion

The next critical flaw in legacy software may be found in hours, not years, so make sure your business can change its software as fast as attackers can study it. Patch PHP now, inventory every PHP system, and start shrinking the attack surface with typed, tested, continuously deployed code. App Corp uses the same class of AI tooling that found PHP2Shell on your side, combining AI-assisted code audits with senior engineering review to produce a fixed-price modernisation plan.

Frequently Asked Questions

Key Takeaways

  • PHP2Shell was found with AI: Wiz Research worked with Calif and OpenAI, and frontier models helped discover the bugs and chain them into working exploits
  • Some of the weaknesses had been hiding in plain sight for over a decade, since session upload progress dates back to PHP 5.4.0
  • Finding bugs in old code is now cheaper and faster, for defenders and attackers alike
  • Legacy PHP and WordPress estates are large, old, poorly tested and widely deployed, exactly the profile AI-assisted attackers will target next
  • The sensible response is to shrink and modernise the attack surface, not just patch faster
Ready to migrate?

Order a WordPress to Payload CMS migration

If this series convinced you to move off WordPress, order the migration directly on Contra. A fixed-scope engagement covering the site rebuild, content and media migration, technical SEO foundations, testing, and handover — delivered by the same engineering team that wrote these guides.

$250 fixed priceUp to 3 weeks deliveryUp to 10 pages migrated
Order on Contra

We value your privacy

We use strictly necessary cookies to keep our site secure and functional. With your consent, we also use performance cookies to understand how you interact with our site, and functional cookies to remember your preferences. Read our full Cookie Policy