Skip to content
ChaiBytes

PHP2Shell: How to Patch the Critical PHP Flaws (8.5.12, 8.4.27, 8.3.36, 8.2.35) or Take Servers Offline Safely

PHP fixed two critical flaws (CVE-2026-109618 and CVE-2026-109619, CVSS 9.2) on 21 October 2026, and attackers started trying them within hours. Update to 8.5.12, 8.4.27, 8.3.36 or 8.2.35, restart every PHP process, reduce the risk if you cannot, and check for signs of a break-in.

By , Founder

Published Updated 5 min read

Share

Updated 24 October 2026: PHP released the fixes on 21 October. This guide now lists the fixed versions and the official advice, and notes that attackers are already trying the flaws. If you have not patched yet, do it now.

At a Glance

What Two critical flaws in PHP itself, CVE-2026-109618 and CVE-2026-109619, nicknamed “PHP2Shell”. Both rated CVSS v4.0 9.2. An attacker may run code on your server with a web request and no login
Fixed in PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35, released 21 October 2026
Who is at risk Every PHP install that serves web requests: PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed. PHP says the risk is highest for mod_php
Older PHP 8.1, 8.0 and 7.4 get no official release. PHP published minimal source backports for people who build from source; otherwise ask your vendor or upgrade
Attacks Exploit attempts started within hours of the release and reached millions of requests by 22 October. Reports differ on how many succeeded. Treat every unpatched server as at risk
What to do Update PHP now, restart every PHP process, then check for signs of a break-in

Patch Now

Update to the fixed release for your branch: 8.5.12, 8.4.27, 8.3.36 or 8.2.35. Linux distributions and long-term support vendors received the patches in advance, so their packages may use their own version numbers. Check your distribution’s security notice if the number looks different.

Debian and Ubuntu (replace 8.4 with your branch):

sudo apt update
apt policy php8.4-fpm                     # shows the version that will be installed
sudo apt install --only-upgrade $(dpkg-query -W -f='${Package}\n' 'php8.4*')
sudo systemctl restart php8.4-fpm
php-fpm8.4 -v

RHEL, AlmaLinux and Rocky:

sudo dnf clean metadata
sudo dnf upgrade 'php*'
sudo systemctl restart php-fpm
php -v

Docker and Kubernetes: a running container keeps the old PHP until you rebuild and redeploy it.

docker build --pull --no-cache -t my-app:php-security .
docker run --rm my-app:php-security php -v

Then redeploy every service that uses the image (web, workers, cron) and make sure no old containers or pods are still running.

Windows: download the new build from windows.php.net (match TS or NTS and x64), replace the install, keep your php.ini, and restart IIS or Apache.

Shared or managed hosting: you cannot patch PHP yourself. Ask your host to confirm your account runs a fixed version, and switch to PHP 8.4 or 8.5 in your control panel if you are on 8.1 or older.

Find Every PHP Install

Check the version that actually serves web requests. The command-line version and the PHP-FPM version can differ.

php -v                                     # command-line PHP
php-fpm8.4 -v                              # PHP-FPM on Debian and Ubuntu (use your branch)
php-fpm -v                                 # RHEL, AlmaLinux, Rocky, Alpine, official Docker images
dpkg -l | grep -E '^ii\s+php'              # every PHP package on Debian or Ubuntu
rpm -qa | grep -i php                      # every PHP package on RHEL, AlmaLinux or Rocky
docker exec <container-name> php -v        # inside a running container

Do not forget Docker images, queue workers and cron hosts, CI runners, control panels such as cPanel and Plesk, and appliances that bundle PHP. On WordPress, Tools > Site Health > Info > Server shows the PHP version.

Restart Everything and Check

Installing the package is only half the job. Any process that loaded the old PHP keeps running it.

  • Restart PHP-FPM, and Apache if you use mod_php.
  • Restart queue workers and supervisors (for example Laravel Horizon or Symfony Messenger), and app servers such as RoadRunner, FrankenPHP or Swoole.
  • Check the version where web requests are served, not only php -v.
  • Test the basics: log in, a form, a file upload, a background job.

Cannot Update Today? Reduce the Risk

PHP says only the update is a complete fix. Its advisory lists settings that reduce exposure to specific attack paths but do not make a server safe:

  • CVE-2026-109618: set memory_limit=-1 where applications cannot override it (for example php_admin_value in the FPM pool or Apache configuration), and set a low post_max_size (8M if you do not need uploads, 32M if you do, with upload_max_filesize below it).
  • CVE-2026-109619: set session.upload_progress.enabled=0 in php.ini or the FPM pool and restart every worker. On PHP 8.5, also set fatal_error_backtraces=0.

On 23 October PHP added an informational advisory (CVE-2026-115560) that recommends keeping session.upload_progress.enabled=0 until the next regular release. It only affects an unusual setup, but the setting is harmless for most sites.

The safest choice is to take a server you cannot update off the internet until you can.

Taking a Site Offline the Right Way

The maintenance mode built into WordPress or Laravel does not protect you. Those modes are PHP code, so every request still reaches PHP. Requests must stop before PHP runs.

Nginx with PHP-FPM. Create a plain HTML page, point Nginx’s error page at it, then stop PHP-FPM:

sudo mkdir -p /var/www/maintenance
echo '<!doctype html><title>Maintenance</title><h1>Back soon</h1><p>We are applying a security update.</p>' | sudo tee /var/www/maintenance/maintenance.html

Add this inside your site’s server { } block:

error_page 502 503 /maintenance.html;
location = /maintenance.html {
    root /var/www/maintenance;
}
sudo nginx -t && sudo systemctl reload nginx
sudo systemctl stop php8.4-fpm            # use your branch; PHP no longer runs

Visitors now see the maintenance page and no request reaches PHP. When you have patched, start PHP-FPM again (sudo systemctl start php8.4-fpm).

Apache with mod_php. PHP runs inside Apache, so stopping PHP means stopping Apache, or serving a static page from another server. Apache with PHP-FPM works like Nginx: stop PHP-FPM and set ErrorDocument 503 /maintenance.html.

Behind Cloudflare. A WAF custom rule can block everyone except you (Security > WAF > Custom rules, for example not ip.src in {your.ip.address} with the action Block). This only helps if your server also refuses traffic that does not come through Cloudflare, because attackers can reach an exposed origin IP directly.

Check for Signs of a Break-in

Because attacks started on release day, check every server that was unpatched after 21 October. Watch for PHP doing things it should not:

  • PHP worker processes (php-fpm, php-cgi, apache2, httpd) starting shells (sh, bash), interpreters (python, perl) or download tools (curl, wget, nc).
  • Commands containing /dev/tcp/, mkfifo or fsockopen, or whoami, id and uname -a run by the web server user.
  • New or changed .php files in the web root or upload folders, new cron jobs, new user accounts or SSH keys.
  • Unusual outgoing connections or a sudden rise in outbound traffic (one reported campaign tried to install Mirai botnet malware).
# PHP files changed since 20 October (adjust the path to your web root)
find /var/www -name '*.php' -newermt '2026-10-20' -ls

# What the web server user is running
ps -o pid,ppid,user,cmd -u www-data

If you find something, isolate the server and keep the web server and PHP logs. Updating PHP alone does not remove a web shell an attacker already planted.

Checklist

  • Every PHP install listed, with its version and how it runs
  • Fixed version (8.5.12, 8.4.27, 8.3.36 or 8.2.35, or your vendor’s patched package) installed
  • PHP-FPM, Apache, workers and app servers restarted
  • Version checked where requests are served
  • session.upload_progress.enabled=0 set until the next regular release
  • Servers that ran unpatched after 21 October checked for signs of a break-in
  • End-of-life PHP (8.1 or older) upgraded, patched from a vendor, or taken offline

About the author

, Founder

Sources

  1. Security advisory: Critical remote code execution vulnerabilities, update now (21 October 2026) — PHP Official source
  2. PHP 8 ChangeLog — PHP Official source
  3. PHP2Shell Exploit Attempts Hit Millions as Attackers Try to Deploy Mirai Malware — The Hacker News
  4. PHP2Shell Exploitation Attempt Detected Four Days Before Disclosure — Infosecurity Magazine
  5. Critical Vulnerabilities in PHP Require Immediate Patching — CISA
  6. Rapid Response: php2shell, Leaked Critical PHP Vulnerabilities (CVE-2026-109618 & CVE-2026-109619) — Huntress

Drafted with AI assistance from the reports above and checked automatically for sourcing. Always confirm dates, fees and requirements on the official website before acting. Report an error · How we correct mistakes

Was this helpful?

Questions or something to add?

Ask below. We read every comment and reply when we can.

Leave a comment

Be respectful. Comments with links are reviewed before they appear. Your email is used only to contact you about your comment, such as a reply from the editor.