Critical · CVSS v4.0 9.2 · Unauthenticated RCE

USDSC Security Operations · Free Tool · Updated October 21, 2026

PHP2Shell Exposure Check: Is Your Server Vulnerable to CVE-2026-109618 and CVE-2026-109619?

A free, read-only Bash script that finds every PHP binary on a Linux host, tells you which ones are still vulnerable to PHP2Shell, and shows whether the interim mitigations are actually in effect.

Direct Answer

If your server runs PHP below 8.5.12, 8.4.27, 8.3.36 or 8.2.35 and serves web requests (PHP-FPM, Apache mod_php, php-cgi, FrankenPHP or LiteSpeed), it is exposed to PHP2Shell unless your vendor has backported the fix. Run the script below as root to find out in under a minute, then update PHP and restart every worker.

SHA-256  3f833934b58494bd32459371c2c5fc8f76218eede69d110fe30748aba085ba7a

9.2CVSS v4.0, both CVEs
Pre-authNo login needed; app code can be bypassed
5Web SAPIs affected (FPM, mod_php, CGI, FrankenPHP, LiteSpeed)
0Complete mitigations. Patching is the only fix

Quick Start

The script is plain Bash with no dependencies and no network calls, and it never changes anything on the host. Read it before you run it. You should do that with any script you pull off the internet, including ours.

# 1. Download
curl -fsSLO https://www.usa-digital.com/mitigations/php2shell-Check.sh

# 2. Verify the checksum matches the one published on this page
sha256sum php2shell-Check.sh

# 3. Read it (about 170 lines)
less php2shell-Check.sh

# 4. Run it as root for full package + config visibility
sudo bash php2shell-Check.sh
echo "exit code: $?"

What the Script Checks

Every PHP binary, not just the default

It finds php, php-fpm, php-cgi and lsphp across distro paths, Remi, cPanel EA-PHP, CloudLinux alt-php and LiteSpeed. Multi-version hosts are where forgotten, unpatched builds hide.

Version against the fixed release

Each binary is compared to the fixed release for its branch: 8.5.12, 8.4.27, 8.3.36 or 8.2.35.

Vendor backports

Distros often patch without bumping the upstream version. The script looks for the CVE IDs in the owning package's RPM or Debian changelog before calling a binary vulnerable.

Apache mod_php

It warns loudly if php_module is loaded. The PHP team rates mod_php the highest-risk setup, with a demonstrated exploit that fires before any application code runs.

Mitigation settings, per SAPI

It reads memory_limit, post_max_size, upload_max_filesize, session.upload_progress.enabled and (on 8.5) fatal_error_backtraces from the CLI, FPM, Apache and CGI ini files separately.

Pool and vhost overrides

It greps FPM pool and Apache configs for php_admin_value and php_value overrides, which change the values your web workers actually run with.

How to Read the Output

Here is an example run on a typical multi-version Ubuntu web server. The host and values are illustrative:

  PHP2Shell Exposure Check  |  CVE-2026-109618 / CVE-2026-109619
  Security Operations  |  host: web01  |  2026-10-21T15:02:11Z
 ==============================================================
!! Apache mod_php is loaded (apachectl -M) - HIGHEST RISK per advisory, patch first

/usr/sbin/php-fpm8.4  PHP 8.4.18
   source: php8.4-fpm
   status: VULNERABLE - update to 8.4.27 and restart all workers

/usr/bin/php8.3  PHP 8.3.36
   source: php8.3-cli
   status: PATCHED (>= 8.3.36)
   mitigations (/etc/php/8.3/fpm/php.ini, before pool/vhost overrides):
      [MISS] [109618] memory_limit = 512M (want -1)
      [ok]   [109618] post_max_size = 8M (want 8M, or 32M if uploads needed)
      [ok]   [109618] upload_max_filesize = 2M (want below post_max_size)
      [MISS] [109619] session.upload_progress.enabled = On (want Off)
  • VULNERABLE means the binary is below the fixed release and the package changelog doesn't mention either CVE. Update it.
  • PATCHED (vendor backport) means your distro fixed it without changing the upstream version number. That is common on RHEL, Debian and Ubuntu LTS.
  • [MISS] lines show interim mitigations that aren't set. They matter only while you wait for a patch, and they reduce exposure without eliminating it.
  • The CLI ini is not your web ini. In our testing, the CLI often reports memory_limit = -1 while the FPM pool serving real traffic is set to gigabytes. Always read the FPM and Apache sections, or use --probe.

Exit codes (for automation)

CodeMeaningWhat to do
0CLEAN No vulnerable binary foundConfirm workers were restarted after patching. Re-check containers separately.
2VULNERABLE At least one vulnerable binaryPatch, restart every php-fpm and Apache worker, then re-run.
1NO PHP No PHP binaries foundCheck containers, chroots or non-standard install paths.

Because exit code 2 means vulnerable, you can drop the script into Ansible, Salt or a plain SSH loop and get a fleet-wide pass/fail list in minutes.

# Fleet sweep: one line per host
for h in $(cat hosts.txt); do
  ssh "$h" 'sudo bash -s' < php2shell-Check.sh >/dev/null 2>&1
  echo "$h exit=$?"
done

Confirming What Your Web Workers Actually See: --probe

ini files are only part of the picture. Pool overrides, vhost directives and per-directory config all change the values a live web request runs with. The only way to be sure is to ask PHP from inside the web SAPI:

bash php2shell-Check.sh --probe > /var/www/html/p2s-$(openssl rand -hex 6).php
# load it once in a browser, read the result, then:
rm /var/www/html/p2s-*.php
Delete the probe immediately

The probe prints your PHP version and configuration to anyone who loads it. Give it a random filename, load it once, and delete it. Never leave it in a web root.

If the Script Says You're Vulnerable

  1. Patch PHP to the fixed release for your branch.

    8.5.12, 8.4.27, 8.3.36 or 8.2.35, or your distro's backported package. Check the version your package manager will actually install with apt-cache policy or dnf info before you assume an upgrade fixes it, because third-party repos can lag. The PHP team has said Remi will not have updates on release day.

  2. Restart every worker, not just the service you think of first.

    Running FPM workers and Apache children keep the old code in memory. Restart php-fpm (all versions) and Apache, then re-run the script.

  3. On PHP 8.1 or older, there is no official release.

    Minimal source backports exist for 7.4, 8.0 and 8.1. Anything older needs a vendor (an LTS provider or your distro) or isolation behind a VPN or WAF until you can upgrade.

  4. Until you can patch, apply the interim mitigations.

    Set them in php.ini, the FPM pool or the Apache config with php_admin_value, never via ini_set() or .user.ini, and restart workers. The full mitigation table and its trade-offs are in our PHP2Shell briefing.

What the Script Can't See

  • Containers. A host scan doesn't look inside Docker or Kubernetes images. Run it inside each image, or rebuild on a patched base image.
  • Managed or shared hosting. If you don't have root, ask your host which PHP build serves your site and when it was patched. The --probe output shows the version.
  • Backport false positives. If a distro package shows VULNERABLE but your vendor's advisory says it's fixed, the vendor advisory wins. Their changelog wording may just differ.
  • Pre-release PHP 8.6. RC builds are reported as UNKNOWN. Check that your RC includes the fix.

Frequently Asked Questions

Is the PHP2Shell check script safe to run on production?

Yes. It's read-only: it runs php -v, reads package changelogs and config files, and evaluates a few ini_get() calls. It doesn't modify files, restart services or make network connections. Read the source before you run it anyway.

Does updating WordPress, Magento or my plugins fix PHP2Shell?

No. PHP2Shell is a flaw in the PHP engine itself, not in any application, so only updating PHP fixes it. A fully patched WordPress site on a vulnerable PHP build is still exposed.

Which PHP versions fix CVE-2026-109618 and CVE-2026-109619?

PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35, released October 21, 2026. PHP 8.1 and older get no official release. Source backports are available for 7.4, 8.0 and 8.1.

I patched PHP. Why does the script still say vulnerable?

Usually one of three reasons: another PHP version on the same host wasn't updated, the package came from a repo that hasn't shipped the fix yet, or your distro backported the fix without the CVE IDs in its changelog. Check the binary path in the output, and confirm against your vendor's advisory.

Do I need to restart anything after patching?

Yes. Restart every php-fpm master and Apache. Long-running workers keep the vulnerable code loaded in memory until they restart, even after the package on disk has been replaced.

Need Help Patching a Fleet?

USDSC's engineering team handles PHP upgrades, worker restarts and post-patch verification across WordPress, WooCommerce and custom PHP stacks. If you'd rather not do this by hand tonight, talk to us.

Sources