← All posts

Detecting PHP2Shell with Goodnight Check

· Nikolas Eller

PHP2ShellCVE-2026-109618CVE-2026-109619Goodnight CheckNuclei

On 21 October 2026 the PHP project shipped PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35.1 The releases fix two critical vulnerabilities, CVE-2026-109618 and CVE-2026-109619, now known together as PHP2Shell.2 Both can let an unauthenticated attacker run code on the server. Both sit in PHP itself, not in an application, so a well-written site on a vulnerable PHP is still exposed.

We launched Goodnight Check3 this week: a free, self‑hosted vulnerability scanner that runs Nuclei templates. This post shows how to use it to find PHP2Shell on the servers you are responsible for: first without touching them, then with the active check, and what a finding does and does not tell you.

What PHP2Shell is

  • CVE-2026-109618. When PHP runs out of memory while it sets up a request, it can leave request memory half initialized. The cleanup that follows then reads that memory. Attackers can trigger the out-of-memory condition on purpose with a crafted request.
  • CVE-2026-109619. Some internal state, among it state of the session upload progress feature, outlives the request it belongs to. The next request the same PHP worker handles can act on the leftover data.

Both are rated 9.2 (CVSS 4.0). Every PHP that serves web requests is in scope: PHP-FPM, Apache mod_php, php-cgi, LiteSpeed, FrankenPHP. Details leaked before the planned disclosure, and reports on exploitation differ: some vendors saw attempts in the wild, others had no evidence of working exploits at the time of the release.

Every version before these releases is affected:

Branch Fixed in
PHP 8.5 8.5.12
PHP 8.4 8.4.27
PHP 8.3 8.3.36
PHP 8.2 8.2.35

PHP 8.1 and older no longer get releases from the PHP project. Because of the severity, the PHP security team published minimal source backports for PHP 7.4, 8.0 and 8.1, for people who build from source or have no LTS vendor.1 Otherwise, use your distribution’s or LTS vendor’s backport, or move to a supported branch.

The PHP project is clear that only the update fixes it: “There are no complete mitigations, updating is the only safe choice.”1 Configuration changes such as a low post_max_size or session.upload_progress.enabled=0 only block some known paths. After updating, restart every PHP worker, or the old code keeps running.

After the update, set session.upload_progress.enabled=0 anyway, or keep it if you already have. On 23 October the PHP project suggested it until the next regular bugfix release, against a further, unlikely code execution path, CVE-2026-115560, that the fixed releases still have.4 It needs an unusual setup: an application that switches session.serialize_handler to php at runtime before it starts the session. Applications that never change the serialize handler can keep upload progress on.

Three checks, from quiet to loud

Check Requests Touches PHP? Reports
php-detect 1 GET No That a host runs PHP, and its version if a header shows it
Passive version check 1 GET No A PHP version below the fix
Active check Up to 5; up to three of them 1 to 20 MiB Yes, on purpose A PHP crash in the vulnerable code path, or a version below the fix

Start with the two quiet checks on everything you are responsible for. Use the active check where you need more than a version number, and only where you are allowed to.

1. Find your PHP servers with php-detect

The template with the ID php-detect is a technology template from the ProjectDiscovery catalog,5 severity info. It sends one ordinary GET /, follows up to two redirects, and matches when a response header contains PHP/, a PHPSESSID cookie or a .php path. When the header shows a version, it extracts it.

That makes it the inventory step. It finds PHP servers even when they hide their version (through the session cookie or a .php redirect), and those are the ones the version checks below can’t judge. It doesn’t decide whether a version is affected: compare the extracted version with the fixed versions above yourself.

2. Flag affected versions without touching PHP

The first upstream template for these CVEs, published on 21 October, was exactly that:6 one GET, tagged passive, comparing the version in the X-Powered-By header with the fixed releases. A day later it was replaced, under the same ID, by the active check below, so it never reached a stable release of the catalog. A separate version-only proposal was closed as a duplicate;7 a reviewer there pointed out that a version alone gives too many false negatives.

That is true, and a version check is still useful as a quiet first pass. Here is that first version as a custom template, with its own ID, so it doesn’t clash with the upstream one. Like the active template, it also reads the version from a Server header.

The template: php2shell-version-passive.yaml
# Adapted from http/cves/2026/CVE-2026-109618.yaml in projectdiscovery/nuclei-templates,
# commit c6d5ea1e08, under the MIT License:
#
# Copyright (c) 2025 ProjectDiscovery, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

id: php2shell-version-passive

info:
  name: PHP2Shell (CVE-2026-109618/CVE-2026-109619) - Passive Version Check
  author: princechaddha,goodnightsec
  severity: critical
  description: |
    Flags PHP versions affected by PHP2Shell from the version in the X-Powered-By or Server
    response header. One ordinary GET request, no exploitation. Based on the first, passive
    version of CVE-2026-109618.yaml in projectdiscovery/nuclei-templates (MIT), commit c6d5ea1e08.
    Vendor packages may contain backported fixes without changing the upstream version string.
  remediation: |
    Upgrade to PHP 8.2.35, 8.3.36, 8.4.27, 8.5.12, or later, or a vendor package that backports
    both fixes, and restart every PHP worker.
  reference:
    - https://www.php.net/index.php#2026-10-21-5
    - https://github.com/projectdiscovery/nuclei-templates/blob/c6d5ea1e08/http/cves/2026/CVE-2026-109618.yaml
  classification:
    cve-id: CVE-2026-109618,CVE-2026-109619
    cpe: cpe:2.3:a:php:php:*:*:*:*:*:*:*:*
  metadata:
    max-request: 1
    vendor: php
    product: php
  tags: cve,cve2026,php,php2shell,passive

http:
  - method: GET
    path:
      - "{{BaseURL}}/"

    redirects: true
    max-redirects: 2

    extractors:
      - type: regex
        name: php_base_version
        part: header
        group: 1
        regex:
          - '(?im)^(?:X-Powered-By|Server):[^\r\n]*\bPHP/([0-9]+\.[0-9]+\.[0-9]+)'
        internal: true

      - type: regex
        name: php_full_version
        part: header
        group: 1
        regex:
          - '(?im)^(?:X-Powered-By|Server):[^\r\n]*\bPHP/([0-9]+\.[0-9]+\.[0-9]+[^\s;,)]*)'
        internal: true

      - type: regex
        name: version
        part: header
        group: 1
        regex:
          - '(?im)^(?:X-Powered-By|Server):[^\r\n]*\bPHP/([0-9]+\.[0-9]+\.[0-9]+[^\s;,)]*)'

    matchers-condition: and
    matchers:
      - type: regex
        part: header
        regex:
          - '(?im)^(?:X-Powered-By|Server):[^\r\n]*\bPHP/[0-9]+\.[0-9]+\.[0-9]+'

      - type: dsl
        dsl:
          - |
            compare_versions(php_base_version, ">= 5.4.0", "< 5.7.0") ||
            compare_versions(php_base_version, ">= 7.0.0", "< 7.5.0") ||
            compare_versions(php_base_version, ">= 8.0.0", "< 8.2.35") ||
            compare_versions(php_base_version, ">= 8.3.0", "< 8.3.36") ||
            compare_versions(php_base_version, ">= 8.4.0", "< 8.4.27") ||
            compare_versions(php_base_version, ">= 8.5.0", "< 8.5.12") ||
            (
              regex('(?i)^[0-9]+\.[0-9]+\.[0-9]+[-+_~.]?(?:dev|alpha|beta|rc)', php_full_version) &&
              (
                compare_versions(php_base_version, "= 8.2.35") ||
                compare_versions(php_base_version, "= 8.3.36") ||
                compare_versions(php_base_version, "= 8.4.27") ||
                compare_versions(php_base_version, "= 8.5.12")
              )
            )

3. Confirm with the active check

The current upstream template has the ID CVE-2026-109618 and is part of the stable release v10.5.1 of the ProjectDiscovery catalog, from 23 October 2026.8 The catalog files a template under one CVE, so it carries only the first ID, but it is written for both: its name is “PHP2Shell (CVE-2026-109618/CVE-2026-109619)”. Its crash probes go after the out-of-memory bug, CVE-2026-109618. Its version check covers both, because both are fixed in the same releases. The passive template above lists both IDs.

This check is intrusive. It does not just read a version number. It sends multipart requests of about 1, 8 and 20 MiB to the site’s root path, built to push a PHP worker into memory exhaustion. The template carries the tag intrusive for that reason. Run it only against systems you own or are allowed to test, tell the people who run them, and prefer a maintenance window.

It sends at most five requests per target, in this order:

  1. Control request. A small multipart POST /. If the server already answers with a 5xx error, the template stops there, so a host that is already failing isn’t hit further. It notes the PHP version if the X-Powered-By or Server header shows one.
  2. Up to three probes, growing from about 1 to 20 MiB. If the response contains PHP’s “Allowed memory size … exhausted” error, the template reports the match memory-exhaustion: PHP crashed in the vulnerable code path. It stops early when the server rejects the body (for example 413 or 403 from a proxy) or when the header shows a fixed version.
  3. Version fallback. If no probe caused the error but a header shows a PHP version, the template compares it with the fixed releases. It reports version-vulnerable-no-crash for a supported branch below its fix, and version-eol-branch for PHP 8.1 and older.

The matcher name tells you how strong the evidence is. memory-exhaustion is the strongest: the server behaved as a vulnerable one does. The two version matches are only as good as the header.

What we saw in a test

We ran all three checks against local containers from the official php images, Apache with a one-line index.php, nothing else on the network:

Container php-detect Passive version check Active check
PHP 8.2.29, defaults 8.2.29 Finding, 8.2.29 memory-exhaustion
PHP 8.2.35, defaults 8.2.35 No finding No finding
PHP 8.2.29, display_errors=Off 8.2.29 Finding, 8.2.29 version-vulnerable-no-crash
PHP 8.2.29, display_errors=Off, expose_php=Off No finding No finding No finding

The last row is the one to remember: an unpatched PHP that hides both its errors and its version passes all three.

Running it with Goodnight Check

The steps below use the Goodnight Check web interface (v0.5.0). The administration guide covers each screen in detail.9

The screenshots come from a local test stack: Goodnight Check v0.5.0 from the published images, and three demo web servers on a private Docker network, shop.example.test (PHP 8.2.29), wiki.example.test (PHP 8.2.29 with display_errors=Off) and intranet.example.test (PHP 8.2.35).

1. Get the templates

The default template source mirrors the latest stable release of the ProjectDiscovery catalog, and the backend syncs it every six hours. Under Templates → Sync, run Sync now if you don’t want to wait. The sync history shows the upstream commit; v10.5.1 is 79fb682760ab. php-detect and CVE-2026-109618 are both in it.

The Sync tab under Templates: the upstream mirror on the stable “latest” ref, and a successful sync of 14,104 templates at upstream commit 79fb682760ab.

2. Add the passive check

Under Templates → Custom templates, choose New custom template, paste the YAML from above and save it. A scanner node validates it with nuclei before it is stored.

The Custom templates tab after saving: “Saved php2shell-version-passive; validated with Nuclei v3.11.1”, and the template listed as critical, source custom.

3. Build two template sets

In the Catalog tab, search for php-detect and tick it, then filter by the tag php2shell and tick php2shell-version-passive. The selection stays while you change the filters. Type a name under Or create a set, for example php2shell-passive, and choose Create from selection. Then tick CVE-2026-109618 alone and save it the same way as php2shell-active. Both are exact sets: they hold just these templates, so each scan does exactly what is described above and nothing else.

The Catalog tab filtered by the tag php2shell, with two templates selected and “php2shell-passive” typed in the “Or create a set” field next to “Create from selection”.

4. Distribute the catalog

Under Scanner nodes, open the node’s ⋯ menu and choose Sync templates. The node then shows the pushed catalog bundle and the Nuclei version that runs it.

The Scanner nodes page: the default node is healthy and shows the pushed catalog bundle and Nuclei v3.11.1.

5. Create two scan policies

Under Scan policies, add a New scan policy for each set. For the active policy, keep the rate limit and concurrency low: the probes are large, and you don’t need speed for a handful of requests per host. The Minimum severity under the mail settings only filters the digest mail: every finding, info included, still shows up under Findings. If the mail should list the php-detect results too, which are info, leave it at All severities (including info).

Port discovery with naabu is on by default, so the scanner finds the open web ports first. In our test stack, naabu and nuclei didn’t resolve the demo hostnames through Docker’s internal DNS, so we listed the hosts in the scanner’s hosts file and turned port discovery off, as in the screenshot. On a normal network, leave it on.

The Edit scan policy dialog for php2shell-active: template set php2shell-active, rate limit 10, concurrency 5, port discovery turned off for the test stack.

6. Scan quietly first

Under Scans, choose Run scan, pick the passive policy and your approved target. The scope guardrail refuses anything that isn’t an approved target. Include the web servers you don’t think of as “PHP”: control panels, wikis, shop systems, monitoring front ends. Every php-detect finding is a PHP server; every passive finding is one to update.

In the test, php-detect found all three servers with their versions, and the passive check flagged the two on 8.2.29:

Findings after the passive scan: two critical PHP2Shell findings for shop and wiki at version 8.2.29, and three PHP Detect findings, including intranet at 8.2.35.

7. Then confirm where you need to

Run the active policy against the PHP servers from step 6 that you are allowed to test, in a maintenance window, starting with what is reachable from the internet, and above all those where php-detect found PHP but no version. The findings list shows the matcher name under each title: memory-exhaustion for shop, version-vulnerable-no-crash for wiki, which hides its errors. intranet on 8.2.35 has no finding.

Findings after the active scan: CVE-2026-109618 with the matcher memory-exhaustion on shop and version-vulnerable-no-crash on wiki, above the passive findings.

8. Triage the findings

Open a finding to see the evidence. Under Result identity, Matcher names the match, and the extracted results show the version. For memory-exhaustion, the response at the bottom of the page shows PHP’s own error, here caused by the first, 1 MiB probe:

The response of the memory-exhaustion finding on shop: HTTP 200, X-Powered-By PHP/8.2.29, and “Fatal error: Allowed memory size of 134217728 bytes exhausted”.

9. Rescan after the update

Once a server is updated and its workers have restarted, scan it again with the same policies. The finding moves to mitigated. If an old image or a forgotten host brings the version back, the finding resurfaces instead of starting over. In the test we moved shop to PHP 8.2.35 and ran both policies again. Under View: All findings, both PHP2Shell findings for shop are mitigated, and wiki is still active. php-detect reports the new version as a new finding, because the extracted version is part of what identifies it.

All findings after updating shop: the PHP2Shell findings for shop are mitigated, those for wiki are active, and PHP Detect shows shop at 8.2.35 as new.

A weekly schedule with the passive policy keeps watch until the last server is done, without loading anyone’s servers. For the people who do the updates, export the findings as CSV or SARIF.

What a finding does, and doesn’t, tell you

  • No finding doesn’t mean not affected. The crash signal needs PHP to show its error in the response, and production servers usually hide errors. The version checks need a version in the headers, and expose_php = Off or a proxy removes it. A hidden, unpatched PHP passes all three checks, as the test above shows. Check the installed package version on the server, too.
  • Backported packages can give false positives. Vendors fix PHP in two ways: some move to the new upstream release, others backport the fixes into the version they already ship, and some do both, depending on the release. A backported package keeps its old upstream version, for example 8.3.6-0ubuntu0.24.04.13 on Ubuntu 24.04 LTS,10 so both version checks flag it. Compare the full version with your vendor’s advisory; if the package is fixed, mark the finding as a false positive and note the package version. Not every vendor stream had a fixed package at the time of writing; there, move to one that has.
  • Only the root path is tested. All three checks send their requests to /. A host whose root isn’t served by PHP, while an application further down is, may not show PHP at all.
  • A WAF can change the result. A proxy that rejects large bodies stops the active probes, so the result rests on the version header alone. That limit protects you from this request, not from every way to reach the bug.

Summary

Update PHP to 8.5.12, 8.4.27, 8.3.36 or 8.2.35, or to your vendor’s fixed package, and restart every worker. Until the next regular PHP release, also set session.upload_progress.enabled=0, unless you know your applications never switch the session serialize handler.

Goodnight Check takes the search off your hands, so your team can focus on the updates. Start with a quiet scan across all your approved targets, using php-detect and the passive version check. Run the active check where you need proof and have permission. After each update, a rescan shows the finding as mitigated. Read the matcher name before you act on a finding, and don’t take a clean scan as proof.

Appendix

Footnotes

  1. PHP project, PHP security release, 21 October 2026. ↩ ↩2 ↩3

  2. PHP security advisories GHSA-w8hw-w9fx-j79w and GHSA-6wmf-4rv5-p3rp. ↩

  3. Goodnight Check on goodnightsec.com. ↩

  4. PHP project, informational advisory: session upload progress, 23 October 2026. ↩

  5. ProjectDiscovery nuclei-templates v10.5.1, the php-detect template. ↩

  6. ProjectDiscovery nuclei-templates, the first, passive version of the CVE-2026-109618 template (commit c6d5ea1e08). ↩

  7. ProjectDiscovery nuclei-templates, pull request 17475, a version-only template for PHP2Shell. ↩

  8. ProjectDiscovery nuclei-templates v10.5.1, the CVE-2026-109618 template. ↩

  9. Goodnight Check administration guide on GitHub. ↩

  10. Ubuntu, USN-8948-1, fixed PHP packages for Ubuntu 22.04 LTS to 26.10. ↩

Only scan systems you own or are explicitly authorized to test. Scanning other systems without permission can be a criminal offense, including in Germany under §§ 202a–202c StGB.