Murat BekgiPenetration tester
Subscribe
Write-ups

Week 43: PHP2Shell is two unauthenticated RCEs in PHP itself. Find every PHP you run

CVE-2026-109618 and CVE-2026-109619 let anyone run code on PHP web servers. Patched in 8.5.12, 8.4.27, 8.3.36, 8.2.35. How to find, patch and restart them all.

Published
Reading time
3 min
Topic
Weekly

October 14 to 20, plus this morning, because it couldn’t wait. Yesterday the PHP project posted an advance warning: one release, two critical vulnerabilities. Today the release is out, and the bugs have a name, PHP2Shell.

What happened

PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35 shipped on October 21 to fix CVE-2026-109618 and CVE-2026-109619 (BleepingComputer, php.net). Both are rated 9.2 under CVSS v4 and both allow unauthenticated remote code execution on servers that use PHP to handle web requests (Rescana).

They share a root cause. PHP can leave memory in a corrupted state when a request ends abnormally, and the next request handled by the same worker can trip over it. One bug gets there through out-of-memory corruption, the other through stale global state that outlives the memory behind it (BleepingComputer, Field Effect). The bugs sit in PHP’s own request handling, not in a framework or an extension you might not use.

PHP says full remote code execution was confirmed over HTTP against Apache’s mod_php, and that PHP-FPM looks susceptible from reading the source, though nobody has shown a complete FPM exploit yet (Rescana). Don’t treat that as a reason to wait. PHP’s release notes say there are no complete mitigations and updating is the only safe choice. WAF rules can reduce exposure but don’t replace the patch (braindetox, Neoteo).

Two research teams found these independently in August, Calif and Wiz (Neoteo). When two teams find the same thing, assume others have too.

Because this is a fresh RCE in a huge share of the web, there’s no exploit walkthrough here. What actually protects you is knowing where all your PHP lives, so that’s the walkthrough.

Walkthrough: find every PHP, patch it, prove it’s running

1. The CLI version isn’t the whole answer. php -v tells you about the command-line binary. Your web server might run a different build through mod_php or PHP-FPM. Check all of them:

php -v
for f in /usr/sbin/php-fpm*; do [ -x "$f" ] && "$f" -v | head -1; done
apache2ctl -M 2>/dev/null | grep -i php     # Debian, Ubuntu
httpd -M 2>/dev/null | grep -i php          # RHEL family

If Apache lists php_module or php8_module, you’re on mod_php, the setup where RCE was confirmed.

2. Compare against the fixed versions.

Branch Fixed in
8.5 8.5.12
8.4 8.4.27
8.3 8.3.36
8.2 8.2.35

On 8.1 or older, there’s no upstream fix. Those branches are out of support. Your distribution or LTS vendor may backport one, otherwise you need to upgrade (Help Net Security). And note that 8.2’s security support ends on December 31, 2026 (AICybr).

3. Distro packages often backport without changing the version number. A package can carry today’s fix while its version number still looks old. Check the package changelog for the CVE instead of trusting the version string:

apt changelog php8.3-fpm 2>/dev/null | grep -m1 CVE-2026-109618    # Debian, Ubuntu
rpm -q --changelog php-fpm 2>/dev/null | grep -m1 CVE-2026-109618   # RHEL family

No match means your distro hasn’t shipped it yet, or you’re on a version it doesn’t cover.

4. Patch, then restart the thing that actually runs PHP. Updating the package doesn’t reload the code inside workers that are already running:

sudo apt update && sudo apt install --only-upgrade 'php8.3*'
sudo systemctl restart php8.3-fpm     # if you use PHP-FPM
sudo systemctl restart apache2        # if you use mod_php

Change 8.3 to your version, and use dnf and httpd on the RHEL family.

5. Prove the restart happened. Check when the oldest FPM process started. It should be after you patched:

ps -o lstart= -p "$(pgrep -o php-fpm)"

6. Containers. Find the PHP images you build and run:

grep -rnE '^FROM +php:' --include='Dockerfile*' .
docker ps --format '{{.Names}}\t{{.Image}}' | grep -i php
docker exec CONTAINER_NAME php -v

Pull the updated base image, rebuild, redeploy. Pin the patched version, for example php:8.3.36-fpm, so a cached old layer can’t sneak back in.

7. Don’t forget the PHP you don’t think about. Old WordPress installs, a forgotten admin panel on a subdomain, a vendor appliance with a web UI. Those are what attackers will scan for first. If you keep an asset inventory, today is the day to use it. If you don’t, start with a list of every host that answers on port 80 or 443 and work out what each one runs.

8. Look for signs someone got there first. Watch the web server error log for PHP workers crashing or segfaulting in bursts, and look for new .php files that appeared in web-writable folders recently:

find /var/www -name '*.php' -newermt '2026-10-14' -ls 2>/dev/null

A web shell is usually a small PHP file in an uploads or cache folder with a name that tries to look boring.


New write-ups and both weekly posts land in the inbox — subscribe, or grab the RSS feed.