zevafi

PHP2Shell: the critical PHP flaw AI helped uncover (and what to do with your site today)

Illustration: a PHP code window protected by a shield showing version 8.5.12

On 21 October 2026, PHP shipped an urgent update to fix two critical vulnerabilities that can let someone run code on your server without logging in. If your site runs WordPress, WooCommerce, Drupal, Joomla or any PHP application, this affects you.

What happened?

The PHP team released 8.5.12, 8.4.27, 8.3.36 and 8.2.35 with an unusual message on its home page: “critical remote code execution vulnerabilities, update now”. The two flaws, known together as PHP2Shell, are rated 9.2 out of 10 (CVSS v4.0).

  • CVE-2026-109618 — out-of-memory corruption. When PHP runs out of memory mid-operation, it can leave request data half-initialized; cleanup then treats it as valid.
  • CVE-2026-109619 — stale state across requests. Part of a request’s internal state can survive after its memory is freed, and a later request on the same worker may use it.

Put simply: with a carefully crafted request, an attacker could take over the PHP process. As php.net warns, there is no complete mitigation — updating is the only safe choice.

Who is affected?

According to php.net, every PHP installation serving web requests: PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed. Risk is highest on Apache with mod_php, where an attack was shown to trigger before any application code runs.

Wiz Research, one of the teams that reported the flaws, says every PHP version from the last decade is affected by at least one of them, and demonstrated unauthenticated attacks against WordPress, Drupal and Joomla images. Even when an attack fails to run code, the memory leak can expose passwords, tokens or API keys.

The role of artificial intelligence

This is what makes the story stand out. The PHP Foundation explains that security firm Calif began auditing PHP on 30 July and, on 11 August, reported a remote code execution. OpenAI independently reported the same root cause that day, and Wiz added new attack paths on 24 August. Wiz says it used AI models to discover, verify and adapt the attacks, and the foundation explicitly thanks OpenAI Codex Security.

On the other side, the PHP team also uses AI defensively — tools to validate reports and group those that share a root cause. Two nuances matter:

  • AI didn’t do it alone. The first signs of the problem were spotted in 2024 by a PHP core developer while fixing another finding from a human-led audit. AI helped prove it was truly exploitable.
  • AI also creates noise. The team worked through more than 100 reports that turned out invalid, duplicated or not reproducible. In the foundation’s words, AI helps validate, “but a person makes every call and works on every patch.”

The takeaway cuts both ways: AI speeds up defenders, and attackers too. Details leaked days before the coordinated release and, according to Fortune, Cloudflare had already seen early attack attempts. Reaction time matters.

What to do with your site today

  1. Check your PHP version. In WordPress: Tools → Site Health → Info → Server. It also appears in your hosting panel.
  2. Update to PHP 8.5.12, 8.4.27, 8.3.36 or 8.2.35, or to your distribution’s patched package. On shared hosting, ask your provider to confirm in writing that the patch is applied.
  3. Don’t forget staging sites and any old installation still online.
  4. On PHP 8.1 or older? PHP no longer updates them. Ask your provider about backported fixes or, better, move to a supported version. Note that PHP 8.2 reaches end of life on 31 December 2026.
  5. If you can’t update right away and you control the server: disable session.upload_progress.enabled, limit post_max_size and restart PHP workers. According to Patchstack, these changes do not work through ini_set() or .user.ini. They are temporary measures, not a fix.
  6. Don’t install unofficial “fix” plugins or paste code snippets from dubious sources.
  7. Watch for signs of attack: repeated memory-limit errors, many 500 errors, unusually large PHPSESSID cookies or unexplained worker restarts. If you see them, rotate passwords and API keys.

What this leaves us

PHP2Shell confirms something important: AI isn’t here to replace technical teams — it multiplies what they can do, for better and for worse. For anyone running websites and online stores, preventive maintenance is no longer optional: update on time, know what runs on your server, and have someone watching when an alert like this lands.

Sources

Let’s talk

Tell me about your website, integration or idea.