
PHP2Shell (CVE-2026-109618 and CVE-2026-109619): What It Is and How to Patch
PHP2Shell is the name for two critical bugs in PHP itself: CVE-2026-109618 and CVE-2026-109619. They let an attacker run their own code on a web server that runs PHP. The attacker does not need a password or an account. PHP fixed both bugs on 21 October 2026, and attackers are already using them.
If you only read one line, read this one. Update PHP to 8.5.12, 8.4.27, 8.3.36 or 8.2.35 (or newer), then restart PHP. A new package does nothing until the PHP processes restart.

What PHP2Shell is, in plain English
PHP is the language behind a large share of websites. WordPress, Laravel, Drupal, Magento and phpBB all run on it. Most of these sites run on a server where PHP handles every page request.
PHP2Shell is not a bug in WordPress or in your own code. It is a bug in PHP, the engine underneath. So every PHP site on an unpatched server is exposed, even if the site's own code is perfect.
PHP rated both bugs 9.2 out of 10 (CVSS v4.0). That is the "critical" band. The name PHP2Shell comes from the result: a shell, which means the attacker can type commands on your server.
How PHP2Shell works, step by step
You need four facts about how PHP handles a web page first.
- A PHP server keeps a few PHP "workers" running. Each worker handles one web request, then the next one, and so on.
- For each request, PHP sets aside memory for that request's data. This includes form fields, cookies, uploaded files and session data.
- When the request ends, PHP cleans up that memory. The next request should start with nothing left over.
- Every request has a memory limit, set by
memory_limitinphp.ini. If a request goes over it, PHP stops the request.
Both PHP2Shell bugs are mistakes in steps 2 and 3. PHP mixes up which memory is valid.
Bug 1 (CVE-2026-109618): PHP runs out of memory halfway
- The attacker sends a request built to use a lot of memory.
- PHP hits its memory limit while it is still filling in the request's data. Some of that data is only half written.
- PHP stops the request and runs its cleanup.
- The cleanup treats the half-written data as complete. So PHP works with memory that holds junk, or data the attacker chose.
PHP's own workaround for this bug is to remove the memory limit and keep uploads small. That tells you the attack depends on hitting the limit with a large request.
Bug 2 (CVE-2026-109619): leftovers from an earlier request
- A request finishes, and PHP frees the memory it used.
- By mistake, PHP keeps a note that says where some of that freed memory was.
- The same worker picks up the next request. That request can come from the attacker.
- Before PHP resets the note, the new request follows it. It reads or writes memory that now holds something else.
Programmers call this a "use after free" bug. PHP lists one result as confirmed: the attacker can read memory they should not see. PHP's workaround turns off session upload progress. This is a feature that reports how far a file upload has got. It is switched on by default.
Why a memory mistake lets an attacker run code
A program's memory holds two kinds of things. One is data, such as text and numbers. The other is the location of the next instructions the program will run.
If an attacker can choose what PHP writes into memory it should not use, they can change those locations. PHP then runs the attacker's instructions instead of its own. This is called memory corruption. It is how both bugs turn into remote code execution (RCE): someone on the internet runs commands on your server.

PHP says the risk is highest on Apache with mod_php. There, the attack can start before any of your site's code runs. Your site does not need a bug of its own.
The two bugs side by side
| CVE-2026-109618 | CVE-2026-109619 | |
|---|---|---|
| PHP's name for it | RCE via OOM corruption | RCE via stale global state |
| What goes wrong | PHP runs out of memory mid-setup, then trusts half-built data | PHP reuses memory left over from an earlier request |
| What the attacker needs | One web request, no login | Requests to the same PHP worker, no login |
| Confirmed results | Remote code execution | Remote code execution, reading memory |
| Severity (CVSS v4.0) | 9.2 critical | 9.2 critical |
How it was found
The PHP Foundation credited several teams, including Calif, OpenAI and Wiz. Calif and Wiz said they used AI models in their research. PHP gave advance notice of the fix on 20 October and released it on 21 October.
Attackers were faster than the fix. Amazon saw an attempt to use the bug on 17 October, four days before the release.
What an attacker can do with PHP2Shell
Once the attacker runs code through PHP, they act as the account PHP runs as. On many Linux servers that account is www-data. That account can read and change your website's files.
| What the attacker can do | What it means for you |
|---|---|
| Run commands on the server | Read, change or delete your site's files. Put up fake pages. |
| Read secrets from memory | Wiz says leaked memory can expose passwords, tokens, API keys and certificates from other visitors' requests. |
| Read your config files | Files like wp-config.php and .env hold database passwords. With those, the attacker can copy customer data. |
| Plant a backdoor | A hidden PHP file lets them back in after you patch. The NCSC tells you to look for these. |
| Send spam and phishing from your server | Your domain and IP land on blacklists, and your real emails stop arriving. |
| Take over the whole machine | Dream Research reported attackers chaining PHP2Shell with a Linux kernel bug (CVE-2026-46300) to get full control of 24 firewalls. Tenable has not confirmed this report. |
Who is affected
PHP's advisory names every PHP setup that serves web requests:
- PHP-FPM (the most common setup with Nginx)
- Apache with mod_php
- php-cgi
- FrankenPHP
- LiteSpeed
The UK's National Cyber Security Centre (NCSC) goes further. It says any organisation running PHP should assume it is exposed, whatever the version. That includes PHP built into products you buy, such as appliances and hosted tools.
On 26 October, security firm Trail of Bits said working exploits hit unpatched PHP 8.2 to 8.5. It showed them against MediaWiki, Symfony, Laravel and phpBB.
Is anyone using it in real attacks?
Yes. This is not a theory.

- 17 October: Amazon's threat intelligence team saw an attempt to use the bug. That was four days before the fix came out.
- 21 October: PHP released the fixed versions. Cloudflare said it was seeing early attacks the same day.
- 26 October: CISA, the US cyber defence agency, added both bugs to its Known Exploited Vulnerabilities (KEV) catalog. That list only holds bugs with proof of real attacks.
- 29 October: The deadline CISA gave US federal agencies to patch.
Which PHP versions are safe
Find your PHP branch in the table. If your version is lower than the fixed version, you are exposed.
| Your PHP branch | Exposed if below | Fixed version | Notes |
|---|---|---|---|
| 8.5 | 8.5.12 | 8.5.12 | |
| 8.4 | 8.4.27 | 8.4.27 | |
| 8.3 | 8.3.36 | 8.3.36 | |
| 8.2 | 8.2.35 | 8.2.35 | 8.2 stops getting fixes on 31 December 2026 |
| 8.1, 8.0, 7.4 | all versions | no official release | PHP published small source patches. Your Linux vendor may have a fix. |
| 7.3 down to 5.4 | all versions | none | Out of support. Upgrade. |
Linux distributions use different version numbers. Debian, Ubuntu and Red Hat often add a fix to an older version without changing the number. So php -v can show an "old" number on a server that is already safe. On these systems, check your vendor's security notice for CVE-2026-109618, not just the number.
How to check your PHP version
Pick the method that matches your setup.
| Where your site runs | How to see the PHP version |
|---|---|
| Your own server (SSH) | Run php -v. For the version the website uses, check the PHP-FPM or Apache package too. |
| WordPress | Go to Tools, then Site Health, then Info, then Server. |
| cPanel hosting | Open MultiPHP Manager. It lists the PHP version for each domain. |
| Other shared hosting | Look in your hosting panel, or ask support. |
The command line and the website can use different PHP versions on the same server. Check the one that serves web pages.
How to patch
The fix is to install the new PHP version and restart PHP. PHP's own words: "There are no complete mitigations, updating is the only safe choice."
Shared hosting. Your host patches PHP for you. Ask support to confirm the server runs a fixed version. If your panel lets you pick a PHP version, pick a supported branch.
Debian or Ubuntu server.
sudo apt update
sudo apt upgrade
sudo systemctl restart php8.3-fpm # use your version number
sudo systemctl restart apache2 # only if you use Apache
Red Hat, AlmaLinux or Rocky Linux server.
sudo dnf upgrade 'php*'
sudo systemctl restart php-fpm
sudo systemctl restart httpd # only if you use Apache
Docker. Change your image to a fixed tag, for example php:8.4.27-fpm. Rebuild and redeploy every container. An old running container stays exposed.
After any of these, check again. Run php -v or reload the WordPress Site Health page. Confirm the new version, or confirm your vendor's fixed package.
If you cannot patch today
PHP lists a few settings that reduce the risk. PHP is clear that they do not make a server safe. Use them only while you prepare the update.
| Setting | Helps against | Where to set it |
|---|---|---|
memory_limit=-1 | CVE-2026-109618 | php.ini, in a way apps cannot override |
Low post_max_size | CVE-2026-109618 | php.ini |
session.upload_progress.enabled=0 | CVE-2026-109619 | php.ini or the FPM pool config. Not ini_set() or .user.ini |
fatal_error_backtraces=0 | CVE-2026-109619, PHP 8.5 only | php.ini |
Restart every PHP worker after you change these. PHP also warns not to use RLIMIT_AS or RLIMIT_DATA as a memory cap. They can trigger the bug.
The NCSC gives one more option. If you cannot update or reduce the risk quickly, take the system offline until you can.
Check whether you were already hacked
Attackers had a head start. The first attempt came four days before the fix. So a server that is patched now may have been broken into before.
The NCSC asks you to check unpatched systems for signs of a break-in and for backdoors. Common signs on a PHP server:
- New
.phpfiles you did not create, often in upload or cache folders. - New admin users in WordPress or your app.
- Unusual outgoing connections, or CPU use you cannot explain.
- A sudden rise in outgoing email from your server.
- Bounces that say your IP or domain is on a blacklist.
The last two matter even if your site looks fine. A hacked server is often used to send spam or phishing from your domain. That can put your domain on blacklists, and then your real emails stop reaching inboxes. Our guide on how to check if your email domain is blacklisted shows how to look up and fix a listing.
If you find signs of a break-in, patching is not enough. The attacker may have left a backdoor. Restore from a clean backup or bring in an incident response team.
Two related issues to know about
CVE-2026-115560. On 23 October, PHP published a separate advisory about session upload progress. PHP calls it unlikely to be used. The setting session.upload_progress.enabled=0 from the table above also covers it.
A SimpleXML problem in the fixed versions. PHP 8.4.27 and 8.5.12 can crash some apps that use SimpleXML (php-src issue #24488). The cause is a separate change, not the security fix. As of 26 October, a fix was merged but not yet released. Test your app after you update. Do not stay on the vulnerable version because of this.
Watch: how the PHP security team handled it
Quick answers
| Question | Answer |
|---|---|
| What is PHP2Shell? | Two critical PHP bugs, CVE-2026-109618 and CVE-2026-109619, that let attackers run code on a server. |
| Does it need a login? | No. An attacker on the internet can use it without an account. |
| Is it used in attacks? | Yes. CISA added both bugs to its KEV catalog on 26 October 2026. |
| Which versions fix it? | 8.5.12, 8.4.27, 8.3.36 and 8.2.35. |
| Is updating the package enough? | No. Restart PHP-FPM, Apache or your containers too. |
| Does a firewall fix it? | No. Web firewall rules can block some attacks, but only updating fixes the bug. |
Sources
- PHP news archive 2026: release notes and the security advisory
- NCSC: Critical security issue affecting PHP
- CISA Known Exploited Vulnerabilities catalog
- Tenable: PHP2Shell FAQ: exploitation reports from Amazon, Cloudflare and Trail of Bits
