← writing

Emre Yazar

PHP2Shell: the AI-discovered PHP vulnerability and what to do on your servers

PHP2Shell (CVE-2026-109618, CVE-2026-109619) is a critical PHP RCE patched on Oct 21, 2026 and found with AI. Safe versions, mitigations, Laravel steps.

PHP2Shell cover: CVE-2026-109618 and CVE-2026-109619, CVSS 9.2 critical, a timeline from August to October 26, and the patched PHP versions

PHP2Shell is the name for two critical PHP vulnerabilities, CVE-2026-109618 and CVE-2026-109619 (CVSS 9.2), patched on October 21, 2026. Together they let an attacker run code on a server without logging in. Security teams working with AI models found them, and within hours of the announcement the internet was full of exploit attempts.

The name sounds dramatic, but it fits. We’re talking about an attacker running their own commands on your server without a session, without a password, and in some setups before a single line of your application runs. According to Fortune, PHP sits behind roughly 70% of websites.

All three of my products, Masada, Ne Zaman and Kısacık, run on PHP and Laravel. The minute we saw the announcement on October 21, we patched our own servers; I’ve written up exactly how below. Once that was done, I sat down and read every advisory I could find. This post pulls it together: what happened, what’s inside the bugs, and what to check on your own servers. Plus the part I find most interesting: who found these bugs, and how.

PHP2Shell at a glance

The PHP2Shell timeline

Dates get mixed up across news reports. Here’s the order as best I can piece it together from the sources:

Forty-five minutes. Some CI pipelines take longer than that to get a deploy out.

The scale is not small. Palo Alto Networks counted 22.6 million potentially vulnerable instances. Al Jazeera reported that some government agencies in the Netherlands and Finland took their sites offline until patching was done.

Coordinated disclosure, and the leak

The people who found the bugs didn’t go public on day one. From August to October they worked with the PHP team, Linux distributions and hosting providers. That’s coordinated disclosure, and the goal is simple: on announcement day the patch is already in everyone’s hands, so defenders and attackers start at the same time.

The leak broke that. AWS said it saw exploit attempts in the days before the announcement, so some attackers were already moving before the fix existed. My takeaway: patch day shouldn’t be treated as the start of the race. More likely, it’s the day you find out you’re already halfway through it.

How AI found the PHP vulnerability

Calif had been invited into OpenAI’s “Patch the Planet” program, which uses AI models to hunt for bugs in widely used open source projects. Calif picked PHP because the impact would be huge, and found the first issue using OpenAI’s GPT-5.6 Sol model. When OpenAI looked into it, it found the problem was more serious than Calif had realized.

Wiz got there on its own path, combining Google’s Gemini 4 Argon, GPT-5.6 Sol and its own tool, Wiz Atlas.

Saying “AI found a bug by itself” would be inaccurate. From what I can tell, the models were tools used alongside people. Humans verified the findings, judged how serious they were and worked with the PHP team on the fix. But the most tedious part, patiently reading twenty-year-old C code and flagging the suspicious spots, went to the machines.

The age of the bug makes the point. Laravel Forge’s advisory says affected versions go back to 2004. That’s a bug from the PHP 5 days, carried forward with every release. A limited form of it was noticed in 2024 and not considered significant.

Wiz called this an “AI inflection point.” OpenAI’s warning matters too: the same capability that finds a bug can help an attacker turn it into a working exploit.

What CVE-2026-109618 and CVE-2026-109619 actually are

Both bugs live in PHP’s memory handling. What follows is simplified; for the full picture, Rapid7’s technical analysis is excellent.

CVE-2026-109618: cleanup after running out of memory

When PHP runs out of memory while handling a request, it abandons the request. Partly initialized data can be left behind, and the cleanup step then touches that broken data. An attacker can craft multipart (form and file upload) requests that exhaust memory even while staying inside configured size limits.

With Apache mod_php, this can happen before your application runs at all. The demonstrated sequence doesn’t work on PHP-FPM, but the analysis suggests FPM may be reachable another way.

CVE-2026-109619: memory left over from the previous request

PHP reuses the same FPM worker across requests. Think of a waiter seating new guests without clearing the table. If a request dies on a fatal error, such as running out of memory or hitting a timeout, some internal state can be left uncleaned. The next request on the same worker can reach memory that was already freed. The technical name is use-after-free.

Two exploit paths are confirmed. One is session upload progress (session.upload_progress), which is on by default and reachable even if your app never calls session_start(). The other is fatal_error_backtraces, on by default in PHP 8.5.

Which PHP setups are at risk?

Short answer: nearly every one that serves web requests. Rapid7 lists PHP-FPM, Apache mod_php, php-cgi, FrankenPHP and LiteSpeed.

Is my site affected? How to check

If you’re below the versions in the table, yes. Checking takes a few minutes.

First, find out which PHP is serving web requests. php -v shows the CLI binary, which may not be what your web server uses. Check FPM instead:

ls /etc/php          # every PHP version on the server, including unused ones
php-fpm8.4 -v        # swap 8.4 for your version

Compare the output with this table:

Branch Lowest safe version
PHP 8.5 8.5.12
PHP 8.4 8.4.27
PHP 8.3 8.3.36
PHP 8.2 8.2.35

PHP 8.1 and older no longer get official releases. Fixes for them shipped as package revisions, so the version number doesn’t change, and php -v can look the same before and after. On Ubuntu you can check the package revision like this; Forge’s advisory lists the expected revision for each version:

dpkg -l 'php8.1*' | awk '/^ii/ {print $2, $3}'

Sites still on those versions need to move to a supported branch regardless of this patch.

WordPress and shared hosting

If your site runs on WordPress with a hosting provider, you most likely can’t update PHP yourself; that’s your host’s job. Updating plugins won’t fix this either, because the bug sits in the layer below WordPress.

What you can do is ask. Send something like this to your host’s support:

Has the PHP patch for CVE-2026-109618 and CVE-2026-109619 (PHP2Shell) been applied on the server my site runs on? Which PHP version am I on?

One caveat: according to Codeable, some hosting platforms, such as CloudLinux, which many shared hosts run on, backported the fix without changing the version number. A patched site can still report something like 8.5.11. So asking your host is more reliable than reading the number.

If your control panel lets you pick a PHP version and you see 8.1 or older, treat that as a warning sign on its own and ask about moving to 8.2 or later.

What we did on our own servers on October 21

As soon as we saw the announcement, we logged into the servers that run Masada, Ne Zaman and Kısacık and updated PHP to the patched version. Then we restarted the parts that run continuously behind the sites, such as the service that sends real-time notifications. That step is easy to forget: you think you’ve updated, but the old version keeps quietly running in the background.

Last, we checked that the new version was actually live. It was all done within minutes of the announcement. If you want the technical steps, they’re below.

Steps for Laravel and Laravel Forge

If you use Forge, here’s the easiest thing to miss, in my view: Forge’s automatic security updates don’t patch PHP. Forge installs PHP from a separate package source, and Ubuntu’s unattended upgrades only cover Ubuntu’s own security repository. You need to update every installed PHP version on every server, unused ones included, from the dashboard or by hand.

Second, long-running processes. The update restarts PHP-FPM, but queue workers, Horizon, Octane and Reverb keep running the old PHP until you restart them:

php artisan queue:restart
php artisan horizon:terminate
php artisan octane:reload
php artisan reverb:restart

Finally, confirm the fix is live. php -v isn’t enough; check the process serving web requests: php-fpm8.4 -v.

Can’t patch right away? Temporary mitigations

PHP’s recommended mitigations narrow the known attack paths. They don’t close the bugs:

Don’t relax because display_errors is off or your logs look clean. The attack can land before your application runs a single line, so nothing may ever reach your Laravel log.

One more: CVE-2026-115560

On October 23 the PHP team announced another bug, CVE-2026-115560. It depends on non-standard configuration. As of October 27, when I’m writing this, there’s a mitigation but no patch yet. These announcements land first on php.net’s news archive.

What stays with me as a product owner

The bugs were announced on October 21 and there were millions of attempts the same day. We patched our servers the minute we saw the news; looking back, a “we’ll get to it tonight” window would have been more than enough for attackers.

Ten businesses use Masada today. They don’t need to know what PHP is, but they deserve to know the server behind their menus is up to date. How many minutes it takes us to patch a server is, in my view, now their problem too. Seeing which PHP version runs on which server with one command, and rolling out an update in minutes, matters as much as any feature.

Two smaller notes. The cost of staying on an unsupported PHP version just went up; to anyone scanning with AI, that server is an easy target. And these bugs were found by good-faith teams using AI for defense. Using the same tools to scan our own code before it ships is, I think, now within reach for small teams too.

If a server came to mind while you were reading, type php-fpm -v now. It takes two minutes.

FAQ

What is PHP2Shell?

PHP2Shell is the name for two critical PHP vulnerabilities, CVE-2026-109618 and CVE-2026-109619, patched on October 21, 2026. Both allow unauthenticated remote code execution, and both are scored CVSS 9.2.

Which PHP versions are safe?

PHP 8.5.12, 8.4.27, 8.3.36, 8.2.35 and anything newer. For PHP 8.1 and older, fixes shipped as package revisions, so the version number stays the same.

I’m on PHP 8.1. What should I do?

Check that the package revision was updated, but treat it as a stopgap. PHP 8.1 is out of official support; move to a supported version, 8.2 at minimum.

Do Laravel Forge’s automatic updates cover this?

No. Forge’s automatic security updates don’t patch PHP. Update PHP on each server separately, then restart queue workers, Horizon, Octane and Reverb.

Do the mitigations fix the vulnerability?

No. Settings like session.upload_progress.enabled=0 and fatal_error_backtraces=0 close known attack paths, not the bugs themselves. Updating is the only complete fix.

Was it really found by AI?

AI tools played a key role. Calif used OpenAI’s GPT-5.6 Sol; Wiz used Gemini 4 Argon, GPT-5.6 Sol and its own Wiz Atlas. People verified the findings and built the fix.

Sources