
What Is PHP2Shell? The AI-Found PHP Flaws Explained
What to do today
- 1Update PHP to 8.5.12, 8.4.27, 8.3.36 or 8.2.35 (or your distro's patched package), then restart every PHP-FPM, Apache or LiteSpeed worker.
- 2Can't patch yet? Set session.upload_progress.enabled = 0 and lower post_max_size. These only narrow the attack paths; PHP says updating is the only complete fix.
- 3PHP 8.1 and older get no official release. Move to a supported branch, use a vendor build, or take the site offline.
On October 21, 2026, the PHP project shipped an emergency PHP security update for two critical flaws in the PHP engine itself: CVE-2026-109618 and CVE-2026-109619, nicknamed PHP2Shell. Both are rated 9.2 on CVSS v4.0 and both can let an unauthenticated attacker run code on a server that is serving PHP pages. Because the bugs sit below your application, an up-to-date WordPress, Laravel or Drupal install does not protect you. The story also became the biggest AI security news of the month. The researchers who found the bugs used AI models (OpenAI's GPT-5.6 Sol and Google's Gemini 4 Argon) to find them and to turn them into working exploits, and the code paths involved date back to PHP 5.4 from 2012. This post covers what is affected, how to check and patch your servers, the stopgap settings if you can't patch today, what to look for in your logs, and what the AI part actually means for developers.
What PHP2Shell Is
PHP2Shell is two memory-safety bugs in PHP's core, both triggered by forcing PHP into a fatal error (usually running out of memory) in the middle of handling a request.
Wiz, one of the teams that found the bugs, says every PHP version released in the last decade is affected by at least one of them. The PHP advisory says all installations serving web requests are at risk, naming PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed. It rates mod_php as the highest risk. The researchers demonstrated pre-authentication code execution against WordPress, Drupal and Joomla, and Calif reported the same for Magento.
- CVE-2026-109618 (out-of-memory corruption): if memory runs out while PHP is still setting up its internal request data, the cleanup code later treats that half-built data as valid. An attacker can shape that into memory corruption and code execution.
- CVE-2026-109619 (stale global state): after a fatal error, some state from one request survives on the worker and points at memory that has already been freed. A later request on the same worker can use it (a use-after-free). PHP lists memory disclosure as a confirmed impact as well as code execution.
- Both are reachable before your code runs. In the published attack path, PHP parses the malicious POST body before any script executes, so login checks, frameworks and application firewalls inside your app never see it.
PHP2Shell Fixed Versions
The October 2026 PHP security update covers four supported branches. Find yours in the table. Anything below the fixed version is vulnerable.
| branch | fixed in | status |
|---|---|---|
| PHP 8.5 | 8.5.12 | Supported. Update now. |
| PHP 8.4 | 8.4.27 | Supported. Update now. |
| PHP 8.3 | 8.3.36 | Security fixes only. Update now. |
| PHP 8.2 | 8.2.35 | Security fixes end 31 December 2026. Update now and plan a move to 8.4 or 8.5. |
| PHP 7.4, 8.0, 8.1 | No official release | End of life. PHP published source-only backport branches; cPanel, CloudLinux and TuxCare ship patched builds. |
| PHP 5.4 to 7.3 | None | End of life and unpatched. Upgrade or take offline. |
Check What Your Servers Actually Run
The PHP you run in a terminal is not always the PHP that serves web traffic. A server can have the CLI on one version and PHP-FPM on another, and containers bundle their own copy. Check the runtime that handles requests:
Check the web-facing runtime, not just the CLI. Swap 8.3 for your branch.
# CLI version (may differ from the web runtime) php -v # PHP-FPM version on Debian/Ubuntu-style installs php-fpm8.3 -v # Distro packages: confirm the fix is in the changelog apt changelog php8.3-fpm 2>/dev/null | grep -E "CVE-2026-10961[89]" # Debian/Ubuntu rpm -q --changelog php-fpm | grep -E "CVE-2026-10961[89]" # RHEL/Fedora/Alma # Docker: check the PHP inside each image you deploy docker run --rm --entrypoint php your-app-image:latest -v
- If the CVE IDs show up in your package changelog, the fix is in, whatever the version string says.
- Shared hosting and managed WordPress: your host controls PHP. Check their status page or ask support which build you are on. Many hosts patched on October 21 and 22.
- Don't leave a phpinfo() page online to check the version. It hands attackers your exact build and configuration.
Patch and Restart
Updating the package is only half the job. Running workers keep the old binary in memory until they restart.
Typical update paths. Restart every worker afterwards, or you are still running the old code.
# Debian/Ubuntu (distro or ondrej/php packages) sudo apt update && sudo apt install --only-upgrade 'php8.3*' sudo systemctl restart php8.3-fpm # PHP-FPM sudo systemctl restart apache2 # Apache with mod_php # RHEL/Alma/Rocky sudo dnf upgrade 'php*' && sudo systemctl restart php-fpm # Docker: pull the patched base image and rebuild, don't just restart docker pull php:8.3-fpm docker build --pull -t your-app-image:latest . # then redeploy so old containers are replaced
- In Kubernetes or any autoscaling setup, roll every pod or instance. One old replica left behind is still exploitable.
- After restarting, run the version or changelog check again on the live service to confirm.
If You Can't Patch Today: Interim Settings
PHP's advisory lists settings that block the known attack paths. They reduce exposure; they do not make a server safe. The advisory is explicit that only updating is a complete fix, and Datadog's analysis found that disabling upload progress alone does not fully protect you.
Other stopgaps, roughly in order of usefulness:
Stopgap settings from the PHP advisory. Put them in php.ini or the FPM pool, not in ini_set() or .user.ini.
; CVE-2026-109619: blocks the upload-progress path session.upload_progress.enabled = 0 ; PHP 8.5 only: blocks the fatal-error backtrace path fatal_error_backtraces = 0 ; CVE-2026-109618: keep request bodies small post_max_size = 8M ; 32M if the app takes uploads upload_max_filesize = 2M ; must stay below post_max_size ; CVE-2026-109618: PHP suggests removing the PHP memory limit and ; capping memory at the container/cgroup level instead. ; In an FPM pool, use php_admin_value so apps can't override it: ; php_admin_value[memory_limit] = -1
- Limit request size, multipart part count, field count and nesting depth at your reverse proxy or web server, including for requests without a Content-Length header.
- Turn on your CDN's emergency rules. Cloudflare deployed WAF rules for all plans, including free, and calls them a stopgap only. A WAF can miss bodies it truncates or parses differently.
- If you can't update, or the site runs PHP 8.1 or older, CISA's advice is to take it offline. Many European organizations, including government services, did exactly that on October 21.
Check Whether You Were Hit
Amazon's honeypots logged an exploitation attempt on October 17, four days before the patch, so look back to at least that date. Cloudflare reported attempts rising from tens of thousands to millions by October 22. Signs worth checking:
Starting points. Log paths vary by distro and host.
# Memory errors during request setup, before any script ran grep -E "Allowed memory size .* in Unknown on line 0" /var/log/php*fpm*.log /var/log/apache2/error.log # Crashing workers (failed exploit attempts often look like this) grep -E "Segmentation fault|SIGSEGV" /var/log/apache2/error.log /var/log/php*fpm*.log # Shells started by the web server user: a strong sign of compromise ps -eo user,pid,ppid,cmd | grep -E '^(www-data|apache|nginx) +[0-9]+ +[0-9]+ +(/bin/|/usr/bin/)?(ba|da)?sh( |$)'
- "in Unknown on line 0" means PHP ran out of memory before your code started. A few of these alone don't prove an attack, but a burst alongside unusually large POST requests is worth investigating.
- Unusual multipart requests: hundreds of parts, deeply nested field names like files[a][a][a][a], or PHPSESSID / PHP_SESSION_UPLOAD_PROGRESS fields on routes that don't use sessions.
- PHPSESSID cookies in responses that are much longer than normal or contain binary data. Wiz showed the memory leak returning heap contents through that cookie.
- A successful exploit can return HTTP 200 and leave the worker running, so a clean status-code graph is not proof of safety. Treat a web worker spawning a shell, new PHP files in upload or cache folders, or new cron entries as an incident.
The AI Part: What Actually Happened
PHP2Shell is the clearest case so far of AI models helping find, and weaponize, a bug in software that most of the web depends on. The public record, as reported on October 21 to 23:
That last point is the real news. Wiz's write-up says AI did a lot of the slow, specialist work: analyzing failed attempts and adapting the exploit to different PHP versions, configurations and memory layouts. People still chained the bugs together and did the testing, but Wiz says a single researcher finished in a week what would previously have taken a top team months. Bugs that were "too hard to exploit" to prioritize are now within reach, for defenders and attackers alike.
The disclosure didn't go to plan either. Details leaked on October 20, a day before the scheduled release, through a CVE listing on Hacker News, a post on X and an exploit video, and PHP moved the release up. Patched builds also appeared shortly before the announcement, which let attackers see what changed.
- Calif, an AI security firm, found a version of the bug in August while auditing PHP's source with OpenAI's GPT-5.6 Sol, as part of OpenAI's "Patch the Planet" program (Wall Street Journal). Reports differ on which Calif researcher gets individual credit.
- Wiz (now part of Google Cloud) found the bugs independently. Its timeline: first bug August 19, working exploits against Drupal and WordPress by August 21, reported to PHP on August 24. Its team used Gemini 4 Argon, GPT-5.6 Sol and its own Wiz Atlas tool.
- The PHP Foundation credited Calif, OpenAI and Wiz, among others, and OpenAI says it spent about two months coordinating the fix with maintainers and security vendors.
- The underlying out-of-memory problem had been spotted by a PHP developer during a 2024 audit. It wasn't fixed then because there was no agreed fix and no known way to exploit it.
What This Means for Developers
A few practical lessons that outlast this one CVE:
For how AI review works in practice, see what AI code review catches and misses, and for the supply-chain side of AI coding tools, slopsquatting and hallucinated packages.
- Know every place your runtime lives. Base images, CI runners, staging boxes, an old cPanel account: the PHP2Shell patch only protects the copies you actually updated.
- The time between disclosure and attacks is now hours. Fastly's Kelly Shortridge put the gap at hours to a few days. Have a tested way to patch and restart every server the same day.
- End-of-life versions are a security problem, not just a maintenance one. VirusTotal counted about 758,000 exposed servers on unsupported PHP branches (5.4 to 8.1), against 272,000 on supported ones.
- Use AI for your own review, carefully. The same models are available to you. They are good at spotting risky patterns, but they also suggest code and packages that don't exist, so verify what they tell you.
Also Watch: CVE-2026-115560
On October 23, PHP published an informational advisory for a related, lower-risk bug in session upload progress, CVE-2026-115560. It is not fixed in the October 21 releases and will be fixed in the next regular release. It only affects apps that set session.serialize_handler to php_binary or php_serialize in config and then switch it to php with ini_set() before session_start(), with upload progress still enabled. No exploitation has been reported. If you already set session.upload_progress.enabled = 0, keep it; PHP says no further action is needed.
Frequently Asked Questions
Strategic Summary
Final Thoughts
PHP2Shell is serious because it is in the runtime, not in an app: almost every PHP site needs the same fix, and the attack runs before your code does. Update to 8.5.12, 8.4.27, 8.3.36 or 8.2.35 (or a patched distro package), restart every worker, and check your logs back to October 17. If you're stuck on PHP 8.1 or older, this is the moment to upgrade or take the site offline. The AI side is the part that will keep coming up. Models are now helping researchers turn old, "impractical" bugs into working exploits in days. That raises the bar for how fast everyone, including small teams, needs to patch. --- Last reviewed: October 24, 2026. Facts are taken from PHP's advisories and the researchers' and vendors' reports listed below. This is a fast-moving story; check php.net for newer releases.
Running PHP in production? Tell me how fast your team got the PHP2Shell patch out, and what slowed it down.
Next Up
Continue your research
Sources & Research
PHP.net: Security advisory, critical remote code execution vulnerabilities (21 Oct 2026)
https://www.php.net/archive/2026.php#2026-10-21-5
PHP.net: Informational advisory, session upload progress, CVE-2026-115560 (23 Oct 2026)
https://www.php.net/archive/2026.php#2026-10-23-1
GitHub advisory GHSA-w8hw-w9fx-j79w (CVE-2026-109618)
https://github.com/php/php-src/security/advisories/GHSA-w8hw-w9fx-j79w
GitHub advisory GHSA-6wmf-4rv5-p3rp (CVE-2026-109619)
https://github.com/php/php-src/security/advisories/GHSA-6wmf-4rv5-p3rp
Wiz Research: PHP2Shell, AI uncovers critical RCE vulnerabilities
https://wiz.io/blog/php2shell-php-rce
Datadog Security Labs: PHP2Shell detection, analysis, and remediation
https://securitylabs.datadoghq.com/articles/php2shell-critical-vulnerabilities-in-php/
Tenable: PHP2Shell frequently asked questions
https://www.tenable.com/blog/php2shell-cve-2026-109618-cve-2026-109619-frequently-asked-questions-about-critical-php-remote
CyberScoop: PHP releases emergency fixes for 2 critical vulnerabilities
https://cyberscoop.com/php-emergency-patches-php2shell-vulnerabilities/
The Hacker News: PHP warns of another unpatched issue after PHP2Shell patches
https://thehackernews.com/2026/10/urgent-php-warns-of-another-unpatched.html
Wikipedia: PHP2Shell (timeline and reactions, with primary references)
https://en.wikipedia.org/wiki/PHP2Shell




