PHP2Shell is a pair of critical flaws in PHP itself, tracked as CVE-2026-109618 and CVE-2026-109619, that let an attacker run code on a web server with one unauthenticated request. PHP shipped fixes on 21 October 2026. By the next day, UK government websites had gone offline, the UK's NCSC was telling organisations to consider taking unpatched systems offline, and Cloudflare was counting exploit attempts in the millions.
The bug class behind it was first reported in 2004. What changed in 2026 is that AI-assisted researchers turned it into working exploits in days, and attackers caught up almost as fast.
This post explains what PHP2Shell is in plain English, how it works at a conceptual level, who's affected, and exactly how to patch, including the cases the headlines skip: distro packages that keep an old version number, PHP 8.1 and older, and the third bug PHP disclosed this morning. There's also a small read-only script that tells you whether each PHP on a server is patched.
TL;DR#
- PHP2Shell is two memory bugs in PHP's request handling, not in WordPress or Laravel. They're rated 9.2 on CVSS 4.0, and an exploit can fire before any application code runs.
- Safe versions: 8.5.12, 8.4.27, 8.3.36 and 8.2.35. PHP 8.1, 8.0 and 7.4 get no php.net release, only distro backports or PHP's minimal source backports. 7.3 and older get nothing.
- Check the package, not just
php -v. Ubuntu's fixed PHP 8.3 still reports 8.3.6. - Restart every PHP-FPM pool and Apache process after updating. A patched file on disk doesn't help a worker that's still running the old one.
- WAF rules and config changes only buy time. Exploitation started four days before disclosure, and an exploit that gets past ASLR already exists.
What is the PHP2Shell vulnerability?#
PHP runs a huge share of the web. Wiz, one of the teams that found these bugs, puts it at 70% of all websites; BleepingComputer says 75 to 80%. Every one of those sites runs on the PHP engine, and that engine is where PHP2Shell lives.
In plain English: when PHP receives a web request, it builds some internal bookkeeping for it before your code starts, and it tears that bookkeeping down when the request ends. PHP2Shell is two ways to make that setup and teardown go wrong, so that memory ends up in a state an attacker can control. Control of memory in a C program like PHP can turn into control of the program.
The two CVEs, as the PHP security team describes them:
- CVE-2026-109618, RCE via out-of-memory corruption. If PHP runs out of memory while a request's internal data is only partly built, the cleanup that follows can treat that half-built data as valid.
- CVE-2026-109619, RCE via stale global state. Some state that belongs to one request can survive after its memory is freed, and a later request on the same worker can use it before normal setup resets it.
Both give an attacker code execution with the web server's privileges, without logging in. That's the "2Shell" in the name: from a PHP request to a shell on your server.
How PHP2Shell works: the concept, not the exploit#
You don't need to understand exploitation to patch. But it helps to know why this bug is in a different class from the usual "plugin has an SQL injection" story, and why it went unfixed for so long. This section stays at the level of PHP's own advisory: no triggers, no payloads.
Memory corruption and use-after-free, briefly#
PHP is written in C, a language that leaves memory management to the programmer. Two classic mistakes:
- Trusting half-built data. If something is interrupted while it's being built, and later code assumes it was finished, that code works on garbage. CVE-2026-109618 is this mistake, triggered by running out of memory at the wrong moment.
- Use-after-free. A program frees some memory, but a pointer to it is still kept somewhere. If that memory is reused for something else, maybe something an attacker supplied, the old pointer now leads to attacker-controlled data. CVE-2026-109619 is this mistake, with the pointer surviving in global state from one request to the next.
Why the worker model matters#
Most PHP setups don't start a fresh process for each request. A PHP-FPM worker, or an Apache process running mod_php, serves request after request. That's good for speed. Here it means one bad request can leave memory in a broken state that the next request on the same worker then walks into.
Because all of this happens before or after your code runs, the framework doesn't matter. Wiz notes that exploitation doesn't depend on application code, so even a trivial app on an affected PHP version is exposed.
Why it was "impractical" until AI#
The out-of-memory problem wasn't secret. Calif's write-up traces the history: Stefan Esser found a remote memory-limit bug in PHP in 2004 and never released his exploit. In 2020, bug #78876 reported long variables causing out-of-memory errors, and it wasn't treated as serious. A 2024 audit by OSTIF and Quarkslab found the same issue again, but couldn't prove it was exploitable, so it stayed unfixed.
"Can't prove it's exploitable" is the key phrase. Turning a memory bug into reliable code execution means chaining several small primitives, and adapting the chain to each target's PHP version, configuration and memory layout. That's slow, specialist work, and for most bugs nobody does it.
AI changed the economics of that work:
- Calif, working inside OpenAI's "Patch the Planet" effort, used an LLM assistant to find ways past PHP's memory limit. An AI agent reviewing PHP's memory allocator flagged a suspicious ordering in a hash table function. The team then had the model generalise that pattern into a reusable skill file, which surfaced a further path in session upload-progress handling. Calif says it used no special harness or restricted model access.
- Wiz, working independently, used its own Wiz Atlas tooling with Gemini 4 Argon and GPT-5.6 Sol. Its models helped adapt exploits across PHP versions, configurations and memory layouts, analysing failures and iterating. Wiz said frontier models "substantially reduced that barrier, turning a longstanding flaw into an exploit," as Help Net Security reported.
So "AI found PHP2Shell" is true, with a caveat. Experienced human researchers pointed capable models at a known-suspicious area and used them to do in days what used to take weeks. That's more significant than a lucky find, and I come back to it at the end.
PHP2Shell timeline: from discovery to exploitation#
The coordinated part went by the book:
- 30 July: OpenAI invites Calif to Patch the Planet, and PHP is chosen as a target (Calif).
- 11 August: Calif reports the first bug to PHP. It shares a working proof of concept on 14 August, PHP confirms it on 15 August, and Calif reports the second bug on 21 August.
- 19–24 August: Wiz finds the bugs independently, confirms unauthenticated RCE against Drupal and then WordPress, and reports to PHP on 24 August (Wiz).
- 21 September: PHP acknowledges Wiz's reports and a single coordinated fix begins. Linux distributions and LTS vendors get the patches before release (Help Net Security).
Then the last week went sideways:
- 17 October: Amazon's MadPot honeypots record a PHP2Shell exploit attempt, four days before disclosure. Amazon says it's unclear how the actor got exploit details during the embargo (AWS).
- 20 October: PHP pre-announces a critical security release for the next day (php.net). CERT-EU tells EU bodies to prepare (CERT-EU 2026-018).
- 21 October, about 02:00 UTC: the first public proof of concept appears, roughly 12 hours before the patch (AWS).
- 21 October, 03:02 UTC: Cloudflare's WAF starts blocking exploit attempts for every plan, including Free (Cloudflare).
- 21 October, around 14:00 UTC: PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35 ship (php.net).
- 21–22 October: Cloudflare's CEO reports attempts rising from thousands before disclosure, to tens of thousands within 45 minutes, to millions (The Register). watchTowr confirms active exploitation from 21 October (watchTowr).
- 22 October: VulnCheck releases an exploit, to its customers, that works against ASLR-enabled x86-64 servers on PHP's recommended production settings (The Register).
- 23 October: PHP discloses a third, related bug, CVE-2026-115560 (php.net). More on that in the patch guide.
Who is affected by PHP2Shell?#
The short answer from PHP is every installation serving web requests: PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed. Every version back to PHP 5.4 is in scope (Wiz), and watchTowr confirms 7.3 and older, including PHP 5, are affected.
WordPress, Drupal, Joomla and Laravel#
Wiz demonstrated unauthenticated RCE against current WordPress, Drupal and Joomla images. Laravel, Symfony and custom apps aren't named in any advisory, but they don't need to be. The bugs sit below the framework, so any app on a vulnerable PHP build is exposed. As Cloudflare puts it, updating website code or plugins won't fix this. Only a new PHP build will.
Apache with mod_php: the highest risk#
With mod_php, PHP runs inside Apache's own processes. The PHP security team considers it the riskiest setup, because a demonstrated exploit works where "an unauthenticated request can trigger the attack before any application code runs" (BleepingComputer). If you still run mod_php on an internet-facing server, patch that box first.
PHP-FPM isn't safe either. It's just a less direct path. Moving from mod_php to FPM is a good change for other reasons, but it isn't a fix for this.
Shared hosting, panels and appliances#
On shared hosting, you can't patch PHP yourself; the host has to. Look at your control panel's PHP version selector (cPanel's MultiPHP Manager, Plesk, Hostinger's hPanel). If the site runs an end-of-life branch, switch to a supported one there and ask the host when the patched build lands.
PHP also hides inside products that don't look like "a PHP server". Palo Alto Networks confirmed all PAN-OS and Panorama versions are affected, with no fixed releases yet when Help Net Security reported it. That's why the NCSC's first step is to find all PHP installations, "including systems you didn't expect to run PHP".
How big is the exposure?#
On the day of the patch, VirusTotal counted about 5.1 million internet-facing IPs fingerprinted as PHP. Only about 1.1 million reveal their version, and of those, roughly 758,000 run end-of-life branches from 5.4 to 8.1, including about 187,000 on PHP 7.4. Those hosts will be exposed for a long time.
PHP2Shell patch guide#
Patched vs vulnerable PHP versions#
| Branch | Vulnerable | Safe | Notes |
|---|---|---|---|
| 8.5 | below 8.5.12 | 8.5.12+ | Also see CVE-2026-115560 below |
| 8.4 | below 8.4.27 | 8.4.27+ | |
| 8.3 | below 8.3.36 | 8.3.36+ | |
| 8.2 | below 8.2.35 | 8.2.35+ | End of life 31 Dec 2026 |
| 8.1, 8.0, 7.4 | all | no php.net release | Distro/LTS backport or source backports |
| 7.3 and older | all | none | Upgrade |
If you're testing 8.6, the 8.6.0 RC4 release includes both fixes, and earlier 8.6 builds should be replaced.
How to check your PHP version#
Check the PHP your web server actually runs, not just the one on your shell's PATH. They're often different.
php -v # the command-line PHP
php-fpm8.3 -v # Debian/Ubuntu name the FPM binary per version
/usr/sbin/php-fpm -v # RHEL, Alma, Rocky
ls /etc/php/ # Debian/Ubuntu: every installed branch
- WordPress: Tools → Site Health → Info → Server shows the PHP version the site runs.
- cPanel: MultiPHP Manager lists the version per domain, and EasyApache builds live under
/opt/cpanel/ea-php*/. - Docker:
docker run --rm your-image php -vshows what's inside the image, which is what's running in production.
Then check the package version on distro builds, because the number php -v prints may not change. Ubuntu lists the fixed builds on its CVE page: for example, php8.3 8.3.6-0ubuntu0.24.04.13 on 24.04 LTS, php8.1 8.1.2-1ubuntu2.28 on 22.04 LTS, and ESM builds through Ubuntu Pro for 20.04 and older.
dpkg -l 'php*' | grep ^ii # Debian/Ubuntu: installed package versions
rpm -qa 'php*' # RHEL family
Update with your distribution's packages#
Distributions got the patches before the public release, so start there.
# Debian / Ubuntu
sudo apt update && sudo apt upgrade
sudo systemctl restart php8.3-fpm # each FPM version you run
sudo systemctl restart apache2 # if you use mod_php
# RHEL / Alma / Rocky
sudo dnf upgrade 'php*'
sudo systemctl restart php-fpm httpd
For Debian itself, check the Debian security tracker entry for your release before assuming a fix is out. If you use the volunteer-run Remi repository (rpms.remirepo.net), CERT-EU advised switching to distribution packages or building from source, because Remi had no updates on release day.
For containers, rebuild on a base image that carries the fixed release (docker build --pull), then redeploy. An updated tag on Docker Hub doesn't change a container that's already running.
Restart everything. watchTowr's FAQ says it plainly: update, then restart all PHP workers. FPM pools and Apache keep the old code loaded until they restart.
What to do on PHP 8.1 and older#
PHP 8.1 and older no longer get php.net releases. For this bug, you have three options:
- Your vendor's backport. Ubuntu has fixed php8.1 on 22.04 LTS, and php7.4 and older through Ubuntu Pro ESM (Ubuntu). Other LTS vendors and hosting providers ship their own.
- PHP's minimal source backports for 7.4, 8.0 and 8.1, if you build PHP yourself.
- Upgrade to 8.3 or 8.4. This is the real fix. 8.2 also works for now, but it reaches end of life in ten weeks.
On 7.3 and older, only option 3 exists, unless a paid vendor covers you. Until then, follow CERT-EU's advice and take the server off the public internet.
Temporary mitigations, and why a WAF is only a stopgap#
If you truly can't patch today, PHP lists configuration changes that reduce exposure but don't make an installation safe. In summary:
- For CVE-2026-109618: set
memory_limit=-1in a way apps can't override (php_admin_valuein the FPM pool or Apache config), setpost_max_sizeto 8M (32M if you need uploads) withupload_max_filesizebelow it, and use a container or cgroup memory limit instead. - For CVE-2026-109619: set
session.upload_progress.enabled=0inphp.inior the pool config (notini_set()or.user.ini), and on PHP 8.5 alsofatal_error_backtraces=0. Then restart every worker.
A WAF is worth turning on. Cloudflare's rules have been live on every plan since before disclosure, and its new full-transaction detection checks the origin's response too. But it's a stopgap, for three reasons:
- Attackers adapt. Cloudflare itself reports payloads being mutated to get past its rules.
- It only sees traffic that goes through it. Anyone who finds your origin IP can skip the CDN entirely.
- The bug is still in the engine. Cloudflare's CTO called the protections temporary (BleepingComputer), and Cloudflare's own advice is to keep the WAF on while patching.
New on 23 October: CVE-2026-115560#
This morning PHP disclosed a third, related bug in session upload progress, CVE-2026-115560. It affects fully patched releases, including 8.5.12, but only applications with an unusual session setup: a php_binary or php_serialize serialize handler switched to php at runtime with upload progress enabled. PHP considers the risk unlikely and will fix it in the next regular release.
The mitigation is the same setting as above, session.upload_progress.enabled=0. If you set it this week, keep it until the next release.
A script to check your servers: PATCHED or VULNERABLE#
Checking by hand doesn't scale past a couple of servers, and it's easy to miss the FPM binary or the distro backport. So I wrote a small bash script. It's read-only: it runs each PHP binary with -v, compares the version to the fixed release for its branch, and, if that fails, looks for both CVE numbers in the installed package's changelog. It doesn't send anything or probe for the bug.
Download php2shell-check.sh, read it, then run it with bash php2shell-check.sh (or pass paths to panel PHPs).
#!/usr/bin/env bash
# php2shell-check.sh: is this server's PHP patched for PHP2Shell (CVE-2026-109618, CVE-2026-109619)?
#
# Read-only. It runs each PHP binary with -v, reads installed package changelogs, and prints
# PATCHED, VULNERABLE or UNKNOWN for each one. It sends nothing anywhere and never tests the bug.
# Exit code: 0 if nothing is vulnerable, 1 if something is, 2 if nothing could be checked.
#
# Usage: bash php2shell-check.sh # finds php, php-fpm and php-cgi on PATH
# bash php2shell-check.sh /opt/cpanel/ea-php83/root/usr/bin/php /opt/plesk/php/8.2/bin/php
#
# From https://www.huzaifaa.club/blog/php2shell-ai-php-vulnerability (fixed versions as of 23 October 2026)
set -u
PATH="$PATH:/usr/sbin:/usr/local/sbin:/sbin"
# The first fixed release on each branch php.net still patches.
fixed_for() {
case "$1" in
8.5) echo 8.5.12 ;;
8.4) echo 8.4.27 ;;
8.3) echo 8.3.36 ;;
8.2) echo 8.2.35 ;;
*) echo '' ;;
esac
}
# Is version $1 at least $2? Both are X.Y.Z.
version_ge() {
local IFS=. i
local -a a=($1) b=($2)
for i in 0 1 2; do
((${a[i]:-0} > ${b[i]:-0})) && return 0
((${a[i]:-0} < ${b[i]:-0})) && return 1
done
return 0
}
# Distros often backport the fix without changing the number php -v prints (Ubuntu 24.04's fixed
# build still says 8.3.6), so a package whose changelog names both CVEs counts as patched.
# Prints the package name when it finds one.
distro_fixed() {
local real pkg log
real=$(readlink -f "$1" 2>/dev/null || echo "$1")
if command -v dpkg >/dev/null 2>&1; then
pkg=$(dpkg -S "$real" 2>/dev/null | head -n1 | cut -d: -f1)
log="/usr/share/doc/$pkg/changelog.Debian.gz"
if [ -n "$pkg" ] && [ -r "$log" ] && zgrep -q CVE-2026-109618 "$log" && zgrep -q CVE-2026-109619 "$log"; then
echo "$pkg"
return 0
fi
fi
if command -v rpm >/dev/null 2>&1 && pkg=$(rpm -qf "$real" 2>/dev/null); then
log=$(rpm -q --changelog "$pkg" 2>/dev/null)
if grep -q CVE-2026-109618 <<<"$log" && grep -q CVE-2026-109619 <<<"$log"; then
echo "$pkg"
return 0
fi
fi
return 1
}
# The PHP binaries to check: the arguments, or every php, php-fpm and php-cgi on PATH.
bins=()
if [ "$#" -gt 0 ]; then
bins=("$@")
else
while read -r name; do
bins+=("$(command -v "$name")")
done < <(compgen -c | grep -E '^php(-fpm|-cgi)?[0-9.]*$' | sort -u)
fi
echo "PHP2Shell check (CVE-2026-109618, CVE-2026-109619) on $(hostname)"
echo
vulnerable=0
checked=0
for bin in "${bins[@]}"; do
[ -x "$bin" ] || { printf '%-32s %-9s %-11s %s\n' "$bin" '-' 'UNKNOWN' 'not an executable file'; continue; }
version=$("$bin" -v 2>/dev/null | head -n1 | sed -n 's/^PHP \([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p')
if [ -z "$version" ]; then
printf '%-32s %-9s %-11s %s\n' "$bin" '-' 'UNKNOWN' "couldn't read a version from -v"
continue
fi
checked=$((checked + 1))
branch=${version%.*}
fixed=$(fixed_for "$branch")
if [ -n "$fixed" ] && version_ge "$version" "$fixed"; then
status=PATCHED note="$branch branch is fixed from $fixed"
elif pkg=$(distro_fixed "$bin"); then
status=PATCHED note="distro backport: $pkg's changelog lists both CVEs"
elif [ -n "$fixed" ]; then
status=VULNERABLE note="update to $fixed+ (or your distro's patched package), then restart PHP"
elif [[ "$branch" =~ ^(7\.4|8\.0|8\.1)$ ]]; then
status=VULNERABLE note="no php.net release for $branch: distro/LTS backport, PHP's source backport, or upgrade"
else
status=VULNERABLE note="no php.net fix for $branch: a paid LTS/ESM backport or upgrade; keep it offline until then"
fi
[ "$status" = VULNERABLE ] && vulnerable=$((vulnerable + 1))
printf '%-32s %-9s %-11s %s\n' "$bin" "$version" "$status" "$note"
done
# Apache's mod_php can't be run on its own, so it's checked through its package only.
for mod in /usr/lib/apache2/modules/libphp*.so /usr/lib64/httpd/modules/libphp*.so /etc/httpd/modules/libphp*.so; do
[ -e "$mod" ] || continue
if pkg=$(distro_fixed "$mod"); then
printf '%-32s %-9s %-11s %s\n' "$mod" '-' 'PATCHED' "distro backport: $pkg's changelog lists both CVEs"
else
printf '%-32s %-9s %-11s %s\n' "$mod" '-' 'UNKNOWN' 'mod_php: make sure its package matches the patched php version above'
fi
done
echo
if [ "$checked" -eq 0 ]; then
echo 'No PHP binary found. Pass the path to yours, for example: bash php2shell-check.sh /usr/local/bin/php'
exit 2
fi
echo 'A patched binary only protects you after a restart: restart PHP-FPM, Apache or your containers.'
echo 'Also: CVE-2026-115560 (disclosed 23 October) is not fixed yet, even in 8.5.12. It only affects unusual'
echo 'session settings, but PHP advises session.upload_progress.enabled=0 in php.ini or the FPM pool until then.'
[ "$vulnerable" -eq 0 ]
On an Ubuntu server with a patched 8.3 and two older PHPs, the output looks like this (illustrative):
PHP2Shell check (CVE-2026-109618, CVE-2026-109619) on web-01
/usr/bin/php8.3 8.3.6 PATCHED distro backport: php8.3-cli's changelog lists both CVEs
/usr/sbin/php-fpm8.3 8.3.6 PATCHED distro backport: php8.3-fpm's changelog lists both CVEs
/usr/sbin/php-fpm8.1 8.1.31 VULNERABLE no php.net release for 8.1: distro/LTS backport, PHP's source backport, or upgrade
/usr/bin/php8.5 8.5.11 VULNERABLE update to 8.5.12+ (or your distro's patched package), then restart PHP
A few notes on the design:
- The exit code is the point. It returns 1 if anything is vulnerable, so you can run it across a fleet with Ansible or SSH and alert on failures.
- The changelog check works because distributions name the CVEs they fix in package changelogs. If yours doesn't, the script errs toward VULNERABLE, which is the safe direction.
- UNKNOWN means "look by hand", not "fine". The script can't run Apache's mod_php on its own, so it only checks mod_php through its package.
- It doesn't know what's running. A patched binary on disk with an unrestarted FPM pool still shows PATCHED. Restart, or check
systemctl status php*-fpmfor start times after the update.
PHP2Shell detection: did anyone get in?#
Patching closes the door. It doesn't tell you whether someone walked through it first. Amazon's advice is to start the investigation from 17 October, not from the disclosure date.
What to look for, from the people who've watched the attacks:
- Upload-progress abuse. Hadrian reports most observed attacks abuse the session upload-progress path. AWS suggests searching form-upload POST bodies for
PHP_SESSION_UPLOAD_PROGRESS. Your access logs won't have request bodies, so do this in WAF or request logs if you keep them. - The symptoms Wiz lists: unusual multipart requests followed by memory-limit errors or repeated 500s, unexpectedly large or malformed
PHPSESSIDresponse cookies, and unexplained PHP worker churn (Wiz). Expect thin application logs, because this all happens below the app. - What attackers leave behind: unexpected processes started by the web user, and new or modified files in the web root.
# PHP files created or changed in the web root since the first known attempt
sudo find /var/www -name '*.php' -newermt '2026-10-17' -ls
# Out-of-memory fatals in PHP, FPM and web server error logs (paths vary by distro)
sudo grep -rh 'Allowed memory size' /var/log/php* /var/log/nginx/error.log /var/log/apache2/error.log 2>/dev/null | tail -n 50
If you find something, treat the host as compromised: rotate every credential on it or reachable from it, and rebuild from a known-good image. The NCSC also recommends bringing in an incident response provider if you don't have the skills in-house (NCSC).
What PHP2Shell means for the future of vulnerability research#
I don't think the lesson is "AI is dangerous". It's that the time between a bug being findable and a bug being exploited is collapsing, for defenders and attackers at the same time.
Look at what happened here. A bug class known since 2004, which an expert audit couldn't prove exploitable in 2024, became working exploits in a few weeks once researchers pointed frontier models at it. Two teams got there independently. After disclosure, a different company produced an exploit that defeats ASLR within a day. VulnCheck's Spencer McIntyre put it well: "the technical difficulty of exploiting a vulnerability shouldn't be confused with protection against it" (The Register).
This isn't a one-off. Earlier this month, XBOW built a full Chrome exploit chain in six days with publicly available models, for about $40,000 in compute, and Google paid it $250,000 (XBOW). "Hard to exploit" used to buy you months. It now buys days.
What I'm changing in how I run servers:
- Patch in hours, not weekly windows. Amazon says it directly: measure patch timelines for critical internet-facing bugs in hours. That means automatic security updates where you can (my Ubuntu hardening checklist covers the setup), and a rehearsed manual path where you can't.
- Know your inventory before the advisory lands. The hardest part of this week for most teams was finding all their PHP. A list of every server, container image and runtime version, kept current, is boring until it's the only thing that matters.
- Get off end-of-life runtimes. Hundreds of thousands of hosts on PHP 7.4 and older have no upstream fix. "It still works" stopped being a reason to stay on an old runtime a while ago.
- Detect behaviour, not just signatures. Zero-days have no signature until someone writes one. A web worker starting a shell is suspicious whatever the CVE number.
The same tools that compressed the attacker's timeline are also why these bugs were found and fixed in a coordinated way at all. Defenders who use them, to audit their own code and to automate patching and detection, keep up. Teams that run on monthly maintenance windows will spend a lot more weeks like this one.
Key takeaways#
- PHP2Shell (CVE-2026-109618 and CVE-2026-109619) is a pair of memory bugs in PHP's own request handling. Every framework and every SAPI is exposed, and mod_php most of all.
- The fixed versions are 8.5.12, 8.4.27, 8.3.36 and 8.2.35, or your distribution's patched package, which may keep the old version number.
- PHP 8.1, 8.0 and 7.4 need a vendor backport, PHP's source backport or an upgrade. 7.3 and older need an upgrade.
- Restart PHP after patching, and keep
session.upload_progress.enabled=0until the next release fixes CVE-2026-115560. - WAF rules and config changes buy time. They are not a fix.
- Investigate from 17 October, not 21 October.
- AI didn't invent this bug class, but it shrank the time from "known weakness" to "working exploit" to days. Your patch process has to be faster than that.
Need a hand patching?#
I patch and harden Linux servers for teams that don't have a full-time ops person: finding every PHP runtime across servers and containers, updating and restarting them safely, and setting up automatic security updates and monitoring so the next critical release isn't a fire drill. Email mhuzaifaa.dev@gmail.com or see the projects I've shipped.
This is the first post in a short series on AI and security this week. Next: how Microsoft says a China-aligned group used the ARTEX agentic AI framework against Microsoft 365 tenants, and a developer's checklist for AI agents that hack and get hacked.
FAQ#
What is PHP2Shell?#
PHP2Shell is the name for two critical vulnerabilities in PHP itself, CVE-2026-109618 and CVE-2026-109619, disclosed on 21 October 2026. They're memory-safety bugs in how PHP sets up and cleans up web requests. They can let an unauthenticated attacker run code on the server with the web server's privileges.
Which PHP versions are vulnerable to PHP2Shell?#
Every PHP version that serves web requests, back to at least PHP 5.4, is vulnerable unless patched. The fixed releases are 8.5.12, 8.4.27, 8.3.36 and 8.2.35. PHP 8.1, 8.0 and 7.4 have no php.net release but can be fixed with vendor or source backports. PHP 7.3 and older have no fix.
Is WordPress affected by PHP2Shell?#
Yes. Wiz demonstrated unauthenticated remote code execution against WordPress, Drupal and Joomla. The flaws are in PHP, not in WordPress, so updating WordPress or its plugins doesn't help. The PHP version underneath has to be updated, which on shared hosting means your host or your panel's PHP selector.
How do I check my PHP version on Linux, cPanel or WordPress?#
On Linux, run php -v and the FPM binary's -v (for example php-fpm8.3 -v), then check the package version with dpkg -l 'php*' or rpm -qa 'php*', because distro fixes may keep the old number. In cPanel, use MultiPHP Manager. In WordPress, go to Tools → Site Health → Info → Server.
How do I fix PHP2Shell on PHP 8.1 or older?#
Install your distribution's or LTS vendor's backported package if one exists (Ubuntu fixed php8.1 on 22.04, and older branches through Ubuntu Pro). Or build from PHP's minimal source backports for 7.4, 8.0 and 8.1. The lasting fix is upgrading to PHP 8.3 or 8.4. For 7.3 and older, upgrade, and keep the server off the internet until you do.
Does a WAF protect against PHP2Shell?#
Partly, and only for a while. Cloudflare and other providers deployed rules that block known exploit patterns, but attackers are already mutating payloads to get past them, and traffic that reaches your origin directly bypasses the WAF. PHP says no configuration change fully fixes the issue, so patch PHP and keep the WAF as an extra layer.
Was PHP2Shell really found by AI?#
AI-assisted researchers found it. Calif used an LLM assistant and agent within OpenAI's Patch the Planet effort, and Wiz used Gemini 4 Argon and GPT-5.6 Sol, independently. The models flagged suspicious code paths and adapted exploits across versions. Experienced human researchers chose where to look and verified the results.

