Security

PHP2Shell Checker

Paste the output of php -v or phpinfo() to see if your PHP is patched against PHP2Shell (CVE-2026-109618 and CVE-2026-109619).

How to get itphp -vphp -i | grep -E "PHP Version|Server API|upload_progress.enabled|memory_limit"

The command line can use a different PHP from your website. For the version that serves web pages, open a phpinfo() page on the site (then delete it) or check the package your web server uses.

Paste your PHP version

No PHP version found yet. Paste the first line of php -v or the top of a phpinfo() page.

Fixed PHP versions (October 21, 2026)
PHP 8.28.2.35
PHP 8.38.3.36
PHP 8.48.4.27
PHP 8.58.5.12
PHP 7.4 – 8.1No release: distribution build or source backport
PHP 7.3 and olderNo fix: upgrade

Checked in your browser. What you paste is never uploaded.

A server rack with a PHP elephant badge behind a shield, a patch being applied and a magnifying glass checking a log file

How to use

  1. Read the first sections below to see what goes wrong inside PHP and which setups attackers can reach.
  2. On the server, run php -v, or open a phpinfo() page on your website (delete it afterwards), and paste the output above.
  3. Read the verdict: Patched, Vulnerable, Check your package or No fix. Ubuntu and Debian builds are compared with their own fixed package versions.
  4. If it is not patched: look for signs of compromise first, then update, restart every PHP worker and harden.

What happened

On October 21, 2026, the PHP project released PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35 to fix two bugs now called PHP2Shell: CVE-2026-109618 and CVE-2026-109619, both rated 9.2 on CVSS 4.0. Either one can let an attacker run code on a web server with one or two ordinary HTTP requests, without logging in and without any bug in the website's own code. Details leaked a day before the release, and watchTowr reports exploitation in the wild since October 21.

What causes CVE-2026-109618: running out of memory at the wrong moment

Every PHP request has a memory budget (memory_limit). When a request goes over it, PHP does not unwind step by step: it jumps straight out of whatever it was doing (a longjmp in C) and runs the request shutdown code. That shortcut is safe once the request is fully set up. The bug is that the jump can also happen while PHP is still setting the request up, when some of its memory has been reserved but not yet filled in. Shutdown then reads that half-filled memory and acts on it as if it were valid.

An attacker can steer PHP into that state with a multipart POST, the format used for file uploads. PHP's advisory lists several ways to make the parser use a lot of memory before any script runs: a body with no usable length passes the post_max_size check and keeps streaming, a part may carry any number of headers, and empty file fields don't count toward max_file_uploads but still build the usual arrays. It is like a fire alarm going off while the movers are halfway through unloading a truck: the person who locks up afterwards assumes every box was put away.

The fix removes the jump. PHP now notes a soft out-of-memory condition and stops cleanly at the next safe point, with a hard exit at a second, higher limit.

What causes CVE-2026-109619: leftovers from the previous request

A PHP worker serves many requests one after another. PHP keeps some global bookkeeping in the worker that points into memory owned by the current request. When a request dies abruptly (a fatal error, a parse error, a failed require, "Maximum execution time exceeded" or running out of memory), some of those pointers are not reset. The memory they point to is freed, but the pointers stay.

The next request on the same worker can use them before its own setup clears them. PHP names two such early paths: INI warnings raised before the request starts (on Apache, .htaccess php_value lines are applied at that point), and session upload progress, which is on by default and runs even if the site never calls session_start(). Think of a hotel room where the previous guest's key card was left on the desk and now opens someone else's room.

Who is exposed

Every PHP that serves web pages: PHP-FPM, Apache mod_php, php-cgi, LiteSpeed and FrankenPHP. Apache mod_php carries the most risk, because it runs the shutdown code even when request startup failed, so an attack can succeed before any of your site's code runs; PHP validated full code execution there with default memory and input limits. On PHP-FPM, the leftover-state path was also validated, and more workers only lower the odds per attempt. PHP 8.1 and older get no official release.

How to check your PHP version

A terminal window and a web page with a magnifying glass checking the PHP version

php -v prints the command-line version, which can differ from the one your website runs. Create a file with <?php phpinfo(); in the site folder, open it, note the PHP Version and Server API, then delete it. On cPanel or Plesk, look under MultiPHP Manager or PHP Settings.

Fixed packages on Linux distributions

Package boxes with check marks moving on a conveyor into a server

Distributions backport the fix, so the PHP number may not match the upstream release. Red Hat, AlmaLinux and Rocky builds keep their old numbers, so check the changelog: rpm -q --changelog php-common | grep 109618.

SystemFixed package
Ubuntu 26.10php8.5 8.5.9-0ubuntu2.1
Ubuntu 26.04 LTSphp8.5 8.5.4-0ubuntu1.5
Ubuntu 24.04 LTSphp8.3 8.3.6-0ubuntu0.24.04.13
Ubuntu 22.04 LTSphp8.1 8.1.2-1ubuntu2.28
Debian 12 bookwormphp8.2 8.2.35-1~deb12u1
Debian 13 trixiephp8.4 8.4.27-1~deb13u1
AlmaLinux 9 (php:8.2 stream)php-8.2.33-1.module_el9.8.0+327+37dfd4b4.alma.1

Check if your server was already hacked

A magnifying glass highlighting a suspicious line in a server log, next to a file marked with a bug

Do this before patching, since an update does not remove a backdoor. Copy the web server and PHP logs, the configuration and any suspicious files somewhere safe first.

Signs seen in real attempts: the web server or PHP process starting sh or bash, especially with curl, wget, base64 -d or /dev/tcp in the command line; new PHP files in web folders since October 20 (find /var/www -name '*.php' -newermt 2026-10-20); PHP session files containing PHP code; large multipart POSTs with odd boundaries such as shellflow-php2shell or --VERIFY; and workers crashing or hitting the memory limit. Zscaler counted 1,156 attempts from 156 addresses in the first 48 hours. If you find anything, isolate the server, get incident-response help, and change every password, API key and token the site uses.

Ways to protect a server

A server with a patch, an update arrow and a protective shield

Patch: PHP calls the update the only complete fix. On Ubuntu or Debian run sudo apt update && sudo apt upgrade; on AlmaLinux, Rocky or RHEL run sudo dnf upgrade 'php*'; with Docker, pull the fixed tag and redeploy. Then restart every PHP worker (for example sudo systemctl restart php8.3-fpm, or Apache for mod_php): old workers keep running the old code.

Remove the triggers while you wait: set session.upload_progress.enabled = 0, keep post_max_size small, and on PHP 8.5 set fatal_error_backtraces = 0. PHP's advisory also names enforcing memory_limit = -1, which sounds backwards but removes the out-of-memory jump (PHP calls it partial); keep an eye on server memory, and don't cap it with RLIMIT_AS or RLIMIT_DATA, which trigger the same jump. pm.max_requests = 1 gives each request a fresh worker. Set these in php.ini or the FPM pool and restart; ini_set() and .user.ini come too late.

Limit the blast radius: cap request size and multipart parts at the web server or WAF, fix pages that end in fatal errors or timeouts, and run PHP as a user that can't write to your code folders.

Be careful with "exploits" on GitHub: VulnCheck counted hundreds of PHP2Shell proof-of-concept repositories, almost none real. Don't run them on your servers.

Frequently asked questions

Is PHP 7 or PHP 5 affected?

Yes. The code goes back many years. PHP 7.4, 8.0 and 8.1 only have source backports, and older versions have no fix at all, so move to PHP 8.2 or newer unless your distribution ships a patched build.

My WordPress site is fully updated. Am I safe?

No. The bug is in PHP itself and is reached before WordPress runs. Your host or server admin must update PHP.

Why does php -v say patched but my site is not?

The command line and the web server can use different PHP builds, and workers started before the update still run old code. Check phpinfo() from the website and restart PHP-FPM or Apache.

Does hiding errors (display_errors = Off) help?

No. PHP's advisory says error_reporting, @, display_errors and log_errors don't protect against it; only the settings listed above and the update do.

Is my pasted text uploaded?

No. The check runs in your browser and nothing you paste is sent anywhere.

Found a problem or have an idea? Report a problem

Share

You might also like