php-vuln-check 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ethoic Inc
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,244 @@
1
+ Metadata-Version: 2.4
2
+ Name: php-vuln-check
3
+ Version: 0.2.0
4
+ Summary: PHP vulnerability checker for PHP2Shell (CVE-2026-109618, CVE-2026-109619): audits servers, Docker images and CI. Backport-aware, zero dependencies.
5
+ Home-page: https://github.com/ethoic-inc/php-vuln-check
6
+ Author: Ethoic Inc
7
+ Author-email: hello@ethoic.com
8
+ License: MIT
9
+ Project-URL: Homepage, https://ethoic-inc.github.io/php-vuln-check/
10
+ Project-URL: Source, https://github.com/ethoic-inc/php-vuln-check
11
+ Project-URL: Issues, https://github.com/ethoic-inc/php-vuln-check/issues
12
+ Keywords: php,php2shell,cve-2026-109618,cve-2026-109619,vulnerability-scanner,security,devsecops,docker,sarif,sysadmin,incident-response
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Information Technology
16
+ Classifier: Intended Audience :: System Administrators
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: POSIX :: Linux
19
+ Classifier: Operating System :: MacOS
20
+ Classifier: Programming Language :: Python :: 3
21
+ Classifier: Topic :: Security
22
+ Classifier: Topic :: System :: Systems Administration
23
+ Requires-Python: >=3.6
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Dynamic: license-file
27
+
28
+ # php-vuln-check: PHP2Shell checker for servers, Docker images and CI
29
+
30
+ **A PHP vulnerability checker for [PHP2Shell](https://sansec.io/research/php2shell) (CVE-2026-109618 and CVE-2026-109619).** It tells you which of your servers, Docker images and pipelines still run vulnerable PHP, including the distro-backport cases that version-only checks get wrong. One file, no dependencies, and it never sends exploit traffic.
31
+
32
+ [![CI](https://github.com/ethoic-inc/php-vuln-check/actions/workflows/ci.yml/badge.svg)](https://github.com/ethoic-inc/php-vuln-check/actions/workflows/ci.yml)
33
+ [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/ethoic-inc/php-vuln-check/badge)](https://scorecard.dev/viewer/?uri=github.com/ethoic-inc/php-vuln-check)
34
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
35
+ ![Python 3.6+](https://img.shields.io/badge/python-3.6%2B-blue)
36
+ ![Dependencies: none](https://img.shields.io/badge/dependencies-none-brightgreen)
37
+
38
+ *An open-source project from [Ethoic Inc](https://ethoic.com).*
39
+
40
+ **Tested on real systems, not only fixtures.** CI installs PHP packages in Debian 12 and 13, Ubuntu 20.04 to 24.04, AlmaLinux 8 and 9, Rocky 9, Fedora, Amazon Linux, Alpine and the official `php` images, runs the tool there, and runs the unit tests on Python 3.6 to 3.13. It was security-reviewed independently before release.
41
+
42
+ ## Check your PHP in 10 seconds
43
+
44
+ ```bash
45
+ pipx install git+https://github.com/ethoic-inc/php-vuln-check
46
+ php-vuln-check # audit PHP on this server
47
+ php-vuln-check images . # audit Dockerfiles, compose files and Kubernetes manifests
48
+ ```
49
+
50
+ No install needed either. It is a single file with no dependencies, so you can drop it on a server:
51
+
52
+ ```bash
53
+ curl -fsSLO https://github.com/ethoic-inc/php-vuln-check/releases/latest/download/php_vuln_check.py
54
+ python3 php_vuln_check.py
55
+ ```
56
+
57
+ Each release also publishes `SHA256SUMS` and signed build provenance, so you can verify the file first (`gh attestation verify php_vuln_check.py --repo ethoic-inc/php-vuln-check`). On Python 3.6 hosts this single file is the way to go; `pipx` needs a newer Python.
58
+
59
+ ```text
60
+ VULNERABLE php:7.4-apache
61
+ PHP 7.4
62
+ branch 7.4 is end-of-life with no upstream release; pulling a newer image on this branch cannot fix it
63
+ at examples/demo/legacy/Dockerfile:2
64
+
65
+ VULNERABLE php:8.3.35-fpm-alpine
66
+ PHP 8.3.35
67
+ 8.3.35 is below the fixed release 8.3.36
68
+ at examples/demo/app/Dockerfile:3
69
+
70
+ REVIEW php:8.3-cli
71
+ PHP 8.3
72
+ floating tag: resolves to the newest 8.3.x at pull time. Pin it to 8.3.36 or later and rebuild with --pull
73
+ at examples/demo/app/docker-compose.yml:5
74
+
75
+ PATCHED php:8.4.27-apache
76
+ PHP 8.4.27
77
+ 8.4.27 is the fixed release
78
+ at examples/demo/app/docker-compose.yml:3
79
+
80
+ Summary: 2 vulnerable | 1 need review | 1 patched
81
+ ```
82
+
83
+ Try it yourself: `php-vuln-check images examples/demo`.
84
+
85
+ ## What PHP2Shell is, and who is affected
86
+
87
+ PHP2Shell is a pair of critical remote code execution bugs in the PHP engine itself: **CVE-2026-109618** and **CVE-2026-109619**, both rated CVSS 9.2. PHP's own advisories ([GHSA-w8hw-w9fx-j79w](https://github.com/php/php-src/security/advisories/GHSA-w8hw-w9fx-j79w) and [GHSA-6wmf-4rv5-p3rp](https://github.com/php/php-src/security/advisories/GHSA-6wmf-4rv5-p3rp)) list every release below 8.2.35, 8.3.36, 8.4.27 and 8.5.12 as affected, and no login is needed. [Sansec](https://sansec.io/research/php2shell) reports the bugs reach back to PHP 5.4; Apache `mod_php` and PHP-FPM are the main cases. A fatal error such as running out of memory during a `multipart/form-data` request leaves freed memory in use.
88
+
89
+ | PHP branch | Fixed in | What to do |
90
+ |---|---|---|
91
+ | 8.6 | **8.6.0** (first release) | nothing |
92
+ | 8.5 | **8.5.12** | upgrade (to 8.5.13: see below) |
93
+ | 8.4 | **8.4.27** | upgrade |
94
+ | 8.3 | **8.3.36** | upgrade |
95
+ | 8.2 | **8.2.35** | upgrade |
96
+ | 8.1, 8.0, 7.4 | no release; PHP published source backports on php-src branches (`PHP-8.1-CVE-2026-109618-109619` and the 8.0 and 7.4 equivalents) | build from them, use a vendor backport, or move to a supported branch |
97
+ | 7.3 and older | nothing | upgrade |
98
+
99
+ **PHP 8.5 also has CVE-2026-129182** ([GHSA-2fjv-p558-g82m](https://github.com/php/php-src/security/advisories/GHSA-2fjv-p558-g82m), critical, CVSS 9.2), a use-after-free in fatal-error backtraces fixed in **8.5.13** (and in 8.6.0). Older branches are not affected. The tool checks it too, so 8.5.12 still fails; until you can update, set `fatal_error_backtraces=0` in admin config and restart workers.
100
+
101
+ Sources: PHP's advisories above are the primary record. Analysis and mitigations: [Sansec](https://sansec.io/research/php2shell), [Help Net Security](https://www.helpnetsecurity.com/2026/10/21/php2shell-php-vulnerabilities-patched-cve-2026-109618-cve-2026-109619/), [watchTowr](https://watchtowr.com/intelligence/php-cve-2026-109618-faq/). Reports on how widely it is exploited conflict, so patch rather than wait.
102
+
103
+ ## What it checks
104
+
105
+ | Command | Looks at | Confidence |
106
+ |---|---|---|
107
+ | `php-vuln-check scan` | every `php`, `php-fpm`, `php-cgi`, `lsphp` and Apache `libphp*.so` on this machine: version, SAPI, owning package, vendor changelog or fixed build, `session.upload_progress`, `memory_limit` and `fatal_error_backtraces`, including PHP-FPM pool overrides | high |
108
+ | `php-vuln-check images PATH` | `FROM` lines in Dockerfiles (with `ARG` defaults), `image:` in compose files and Kubernetes manifests | high for pinned tags |
109
+ | `php-vuln-check images --docker` | images of running containers | high for pinned tags |
110
+ | `php-vuln-check images --kubectl` | images of every pod in the current cluster (`--kubectl-args "--context prod"`) | high for pinned tags |
111
+ | `php-vuln-check fleet hosts.txt` | runs `scan` on every host over SSH, nothing installed there | high |
112
+ | `php-vuln-check url https://example.com` | the PHP version a site advertises in `X-Powered-By` (one normal GET). Never says PATCHED: a banner proves nothing | low |
113
+
114
+ Every result is one of:
115
+
116
+ - **PATCHED**: version at or above the fix, the vendor changelog names both CVEs, or the package is at or above a fixed build listed in the vendor's security notice. It describes the files on disk; `scan` downgrades it to REVIEW when running processes still use a replaced PHP file, and you should restart PHP-FPM or Apache after any update.
117
+ - **VULNERABLE**: below the fix with no backport evidence, or an end-of-life branch.
118
+ - **REVIEW**: it cannot tell (floating image tag, digest-pinned image, hidden version, pre-release, a package whose changelog is not installed). Not a clean bill of health.
119
+ - **NONE**: `fleet` found no PHP on that host in the standard locations. This is not PATCHED: PHP in a custom prefix, container or vhost folder would not appear.
120
+ - **ERROR**: an SSH, network or file-reading failure. Unreadable or oversized Dockerfiles are errors, never a silent pass.
121
+
122
+ ## Why another PHP2Shell scanner?
123
+
124
+ Active scanners such as [Assetnote's php2shell-scanner](https://github.com/assetnote/php2shell-scanner) answer "does this host fall over when probed?" by deliberately triggering PHP memory exhaustion on the target. Their authors call that [risky in nature](https://www.helpnetsecurity.com/2026/10/22/php2shell-scanner-tool/). php-vuln-check answers a different question, "what do we run and is it patched?", and does it without touching a running service. Use both.
125
+
126
+ | | php-vuln-check | Active probe scanners |
127
+ |---|---|---|
128
+ | Sends crash-inducing requests | never | yes, by design |
129
+ | Safe on production | yes | read their warnings |
130
+ | Knows about distro backports (Debian, Ubuntu, RHEL family) | yes, via package changelogs | not their job: they test behavior |
131
+ | Audits Dockerfiles, compose and Kubernetes | yes | no |
132
+ | Audits many hosts at once | yes, `fleet` over SSH | per target |
133
+ | CI gate and GitHub code-scanning (SARIF) | yes | no |
134
+ | Tests whether a host actually fails when probed | no | yes |
135
+
136
+ ## How backport detection works
137
+
138
+ Debian, Ubuntu and RHEL patch PHP without bumping it to 8.2.35, so `PHP 8.2.30` on a distro can be safe. For a binary owned by a package, `scan` reads the vendor changelog (`/usr/share/doc/<pkg>/changelog.Debian.gz`, or `rpm -q --changelog`) and treats the host as patched only if **both** CVE IDs are named.
139
+
140
+ Docker's `ubuntu` and `debian` images strip `/usr/share/doc`, so there is often no changelog to read. Then `scan` compares the package version with the fixed builds listed in the vendor's notice (for Ubuntu, [USN-8948-1](https://ubuntu.com/security/notices/USN-8948-1)), using `dpkg --compare-versions`. A fixed build only counts for the same build line, so a Sury `8.3.6-1+ubuntu24.04.1` is never judged against Ubuntu's `8.3.6-0ubuntu0.24.04.13`. Debian's fixes are new upstream releases (8.2.35, 8.4.27), which the version check already covers. You can check by hand:
141
+
142
+ ```bash
143
+ zgrep CVE-2026-109618 /usr/share/doc/php8.2-common/changelog.Debian.gz # Debian, Ubuntu
144
+ rpm -q --changelog php-common | grep CVE-2026-109618 # RHEL, Alma, Rocky
145
+ ```
146
+
147
+ If a vendor shipped a fix without naming the CVE, you will see a false `VULNERABLE`. Check the vendor's security advisory, and please open an issue so the lookup can learn that case.
148
+
149
+ ## Run it across your whole estate
150
+
151
+ ```bash
152
+ # hosts.txt: one [user@]host per line, # for comments
153
+ php-vuln-check fleet hosts.txt --jobs 16 --format csv -o php-exposure.csv
154
+ ```
155
+
156
+ The script is streamed over SSH (`python3 -` on the host), so nothing is installed or left behind. You need key-based SSH and Python 3 on each host. Output from the hosts is validated before it is shown. A host where no PHP is found is reported as NONE, not PATCHED.
157
+
158
+ ## Gate your pipeline
159
+
160
+ ```yaml
161
+ # .github/workflows/php-check.yml
162
+ on: [push, pull_request]
163
+ jobs:
164
+ php2shell:
165
+ runs-on: ubuntu-latest
166
+ permissions: { contents: read, security-events: write }
167
+ steps:
168
+ - uses: actions/checkout@v4
169
+ - uses: ethoic-inc/php-vuln-check@v0.2.0
170
+ with:
171
+ fail-on: vulnerable # or "review" to also fail on floating tags
172
+ sarif-file: php-vuln.sarif
173
+ - uses: github/codeql-action/upload-sarif@v3
174
+ if: always()
175
+ with: { sarif_file: php-vuln.sarif }
176
+ ```
177
+
178
+ Findings show up in your repository's Security tab with the Dockerfile line. To block it earlier, add the pre-commit hook:
179
+
180
+ ```yaml
181
+ # .pre-commit-config.yaml
182
+ repos:
183
+ - repo: https://github.com/ethoic-inc/php-vuln-check
184
+ rev: v0.2.0
185
+ hooks:
186
+ - id: php-vuln-check-images
187
+ ```
188
+
189
+ Other CI systems: run `php-vuln-check images . --fail-on vulnerable`. Exit codes are `0` clean, `1` vulnerable, `2` needs review, `3` error or bad usage (a mistyped path is an error, not a clean scan). Formats: `--format text|json|csv|sarif`.
190
+
191
+ ## Limits
192
+
193
+ - It does not test whether a host is exploitable. It tells you whether the PHP on it is patched.
194
+ - `images` reads tags in your files. It does not open the image, so a `FROM` line you rebuild later can drift. Pin full versions and rebuild with `--pull`. A version that comes from an `ARG` default or a `${VAR:-default}` can be overridden by a build argument or `.env` file, so it can be VULNERABLE or REVIEW but never PATCHED. Digest-pinned references are REVIEW. Third-party images that merely name themselves `php` are never PATCHED from their tag.
195
+ - Directory scans read Dockerfiles (any `Dockerfile*`, `*.Dockerfile`, `Containerfile*`), `COPY --from=` images, and `*.yml`/`*.yaml` files with `image:` entries. JSON manifests are read when you pass them by name. Helm values files that split `repository` and `tag` are not read yet.
196
+ - SARIF output includes findings that have a file location (the `images` command), because GitHub code scanning needs one.
197
+ - Config findings (`session.upload_progress.enabled`, `memory_limit`, `fatal_error_backtraces`) come from `php -i` for that binary. For PHP-FPM, `scan` also reads `php_value` / `php_admin_value` overrides from the pools in the packaging's usual `php-fpm.conf` and its includes, shown as `pool www: memory_limit=-1`. A config passed with `-y`/`--fpm-config` and `.user.ini` files are not read. They are hints, not proof, and the partial mitigations they relate to do not replace patching.
198
+ - `scan` runs `php -n -v` and `php -i` only on binaries that are owned by root (or you) and that neither they nor their parent folders are writable by group or others. Anything else, such as a binary under a tenant's home directory, is read statically and never run. `--no-exec` runs nothing; `--exec` runs everything it finds. Programs are run with no terminal input, a timeout and capped output.
199
+ - The advisory data is typed in from PHP's and the vendors' notices. Every report warns when it is more than 30 days old; update to the latest release then.
200
+ - Linux and macOS hosts. Windows is not supported yet.
201
+ - Written for Python 3.6+ so it runs on older enterprise hosts. CI runs the tests on 3.6, 3.7 and 3.8 to 3.13, and runs the tool against real PHP packages on Debian, Ubuntu, AlmaLinux, Rocky, Fedora, Amazon Linux, Alpine and the official PHP images. It is a new tool: read the results critically and report anything that looks wrong.
202
+
203
+ ## FAQ
204
+
205
+ **Am I vulnerable to PHP2Shell?**
206
+ Run `php-vuln-check` on the server. If it prints VULNERABLE, the PHP there is below the fix and has no vendor backport. If you only see PATCHED, the version is fixed or the vendor changelog names both CVEs.
207
+
208
+ **Which PHP versions fix CVE-2026-109618 and CVE-2026-109619?**
209
+ 8.2.35, 8.3.36, 8.4.27 and 8.5.12 or later. PHP 8.1 and older get no release. PHP did publish source backports for 7.4, 8.0 and 8.1 on php-src branches; for anything else you need a vendor backport or an upgrade.
210
+
211
+ **Is PHP 7.4 or 8.1 vulnerable?**
212
+ Treat them as vulnerable. PHP's advisories only list 8.2 to 8.5, but Sansec reports the bugs reach back to PHP 5.4 and the PHP project made no release for older branches (it published source backports for 7.4, 8.0 and 8.1 only). They are safe only if your vendor's changelog names both CVEs, or you built from PHP's backport branch, which this tool cannot see.
213
+
214
+ **Does Ubuntu, Debian or RHEL ship a fixed PHP?**
215
+ Often as a backport on an older version number. `scan` checks the package changelog for both CVE IDs, which is why it can say PATCHED for `8.2.30` on a distro.
216
+
217
+ **How do I check Docker images for PHP2Shell?**
218
+ `php-vuln-check images .` reads your Dockerfiles, compose files and Kubernetes manifests. `php-vuln-check images --image php:8.3-fpm` checks one reference, and `--docker` checks running containers.
219
+
220
+ **Can I scan a website remotely?**
221
+ `php-vuln-check url https://example.com` reads the advertised `X-Powered-By` header with one ordinary request. Many sites hide it, a proxy can fake it and backports are invisible from outside, so it only ever reports REVIEW or ERROR. Run `scan` on the server for a real answer.
222
+
223
+ **Will it crash or slow my server?**
224
+ It sends no exploit traffic. `scan` reads files and runs `php -n -v` and `php -i` on trusted binaries only. `--no-exec` skips even that.
225
+
226
+ **What do I do if it says VULNERABLE?**
227
+ Update PHP and restart PHP-FPM or Apache. Until then, the partial, temporary mitigations in PHP's advisory are, in its order: enforce `memory_limit=-1` in admin config and cap request body size at the web server; set `session.upload_progress.enabled=0` (and `fatal_error_backtraces=0` on PHP 8.5) and restart every worker; and, only if the application takes no uploads, block `multipart/form-data` at the web server. See the [Sansec write-up](https://sansec.io/research/php2shell) for exact snippets.
228
+
229
+ **Does it find other PHP CVEs?**
230
+ Not yet. Advisories are one entry in the `ADVISORIES` list at the top of `php_vuln_check.py`, so adding the next one is a small pull request. See [CONTRIBUTING.md](CONTRIBUTING.md).
231
+
232
+ ## Contributing
233
+
234
+ Wrong result on your distro, a package manager we should read, or the next PHP advisory: open an issue or a pull request. Start with [CONTRIBUTING.md](CONTRIBUTING.md). To report a security problem in this tool, see [SECURITY.md](SECURITY.md). Taking part means following the [Code of Conduct](CODE_OF_CONDUCT.md).
235
+
236
+ Questions, press or anything else: **hello@ethoic.com**.
237
+
238
+ ## About Ethoic
239
+
240
+ [Ethoic Inc](https://ethoic.com) builds human-centered AI tools. This tool runs on your own machine, has no telemetry and only talks to the hosts you point it at.
241
+
242
+ ## Disclaimer
243
+
244
+ php-vuln-check is an open-source project from Ethoic Inc. It is not affiliated with the PHP Group, Sansec, Assetnote, watchTowr or anyone else named here. It is provided as is under the [MIT license](LICENSE). A PATCHED result is evidence about versions and changelogs, not a guarantee. Only check systems you own or are authorized to check.
@@ -0,0 +1,217 @@
1
+ # php-vuln-check: PHP2Shell checker for servers, Docker images and CI
2
+
3
+ **A PHP vulnerability checker for [PHP2Shell](https://sansec.io/research/php2shell) (CVE-2026-109618 and CVE-2026-109619).** It tells you which of your servers, Docker images and pipelines still run vulnerable PHP, including the distro-backport cases that version-only checks get wrong. One file, no dependencies, and it never sends exploit traffic.
4
+
5
+ [![CI](https://github.com/ethoic-inc/php-vuln-check/actions/workflows/ci.yml/badge.svg)](https://github.com/ethoic-inc/php-vuln-check/actions/workflows/ci.yml)
6
+ [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/ethoic-inc/php-vuln-check/badge)](https://scorecard.dev/viewer/?uri=github.com/ethoic-inc/php-vuln-check)
7
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
8
+ ![Python 3.6+](https://img.shields.io/badge/python-3.6%2B-blue)
9
+ ![Dependencies: none](https://img.shields.io/badge/dependencies-none-brightgreen)
10
+
11
+ *An open-source project from [Ethoic Inc](https://ethoic.com).*
12
+
13
+ **Tested on real systems, not only fixtures.** CI installs PHP packages in Debian 12 and 13, Ubuntu 20.04 to 24.04, AlmaLinux 8 and 9, Rocky 9, Fedora, Amazon Linux, Alpine and the official `php` images, runs the tool there, and runs the unit tests on Python 3.6 to 3.13. It was security-reviewed independently before release.
14
+
15
+ ## Check your PHP in 10 seconds
16
+
17
+ ```bash
18
+ pipx install git+https://github.com/ethoic-inc/php-vuln-check
19
+ php-vuln-check # audit PHP on this server
20
+ php-vuln-check images . # audit Dockerfiles, compose files and Kubernetes manifests
21
+ ```
22
+
23
+ No install needed either. It is a single file with no dependencies, so you can drop it on a server:
24
+
25
+ ```bash
26
+ curl -fsSLO https://github.com/ethoic-inc/php-vuln-check/releases/latest/download/php_vuln_check.py
27
+ python3 php_vuln_check.py
28
+ ```
29
+
30
+ Each release also publishes `SHA256SUMS` and signed build provenance, so you can verify the file first (`gh attestation verify php_vuln_check.py --repo ethoic-inc/php-vuln-check`). On Python 3.6 hosts this single file is the way to go; `pipx` needs a newer Python.
31
+
32
+ ```text
33
+ VULNERABLE php:7.4-apache
34
+ PHP 7.4
35
+ branch 7.4 is end-of-life with no upstream release; pulling a newer image on this branch cannot fix it
36
+ at examples/demo/legacy/Dockerfile:2
37
+
38
+ VULNERABLE php:8.3.35-fpm-alpine
39
+ PHP 8.3.35
40
+ 8.3.35 is below the fixed release 8.3.36
41
+ at examples/demo/app/Dockerfile:3
42
+
43
+ REVIEW php:8.3-cli
44
+ PHP 8.3
45
+ floating tag: resolves to the newest 8.3.x at pull time. Pin it to 8.3.36 or later and rebuild with --pull
46
+ at examples/demo/app/docker-compose.yml:5
47
+
48
+ PATCHED php:8.4.27-apache
49
+ PHP 8.4.27
50
+ 8.4.27 is the fixed release
51
+ at examples/demo/app/docker-compose.yml:3
52
+
53
+ Summary: 2 vulnerable | 1 need review | 1 patched
54
+ ```
55
+
56
+ Try it yourself: `php-vuln-check images examples/demo`.
57
+
58
+ ## What PHP2Shell is, and who is affected
59
+
60
+ PHP2Shell is a pair of critical remote code execution bugs in the PHP engine itself: **CVE-2026-109618** and **CVE-2026-109619**, both rated CVSS 9.2. PHP's own advisories ([GHSA-w8hw-w9fx-j79w](https://github.com/php/php-src/security/advisories/GHSA-w8hw-w9fx-j79w) and [GHSA-6wmf-4rv5-p3rp](https://github.com/php/php-src/security/advisories/GHSA-6wmf-4rv5-p3rp)) list every release below 8.2.35, 8.3.36, 8.4.27 and 8.5.12 as affected, and no login is needed. [Sansec](https://sansec.io/research/php2shell) reports the bugs reach back to PHP 5.4; Apache `mod_php` and PHP-FPM are the main cases. A fatal error such as running out of memory during a `multipart/form-data` request leaves freed memory in use.
61
+
62
+ | PHP branch | Fixed in | What to do |
63
+ |---|---|---|
64
+ | 8.6 | **8.6.0** (first release) | nothing |
65
+ | 8.5 | **8.5.12** | upgrade (to 8.5.13: see below) |
66
+ | 8.4 | **8.4.27** | upgrade |
67
+ | 8.3 | **8.3.36** | upgrade |
68
+ | 8.2 | **8.2.35** | upgrade |
69
+ | 8.1, 8.0, 7.4 | no release; PHP published source backports on php-src branches (`PHP-8.1-CVE-2026-109618-109619` and the 8.0 and 7.4 equivalents) | build from them, use a vendor backport, or move to a supported branch |
70
+ | 7.3 and older | nothing | upgrade |
71
+
72
+ **PHP 8.5 also has CVE-2026-129182** ([GHSA-2fjv-p558-g82m](https://github.com/php/php-src/security/advisories/GHSA-2fjv-p558-g82m), critical, CVSS 9.2), a use-after-free in fatal-error backtraces fixed in **8.5.13** (and in 8.6.0). Older branches are not affected. The tool checks it too, so 8.5.12 still fails; until you can update, set `fatal_error_backtraces=0` in admin config and restart workers.
73
+
74
+ Sources: PHP's advisories above are the primary record. Analysis and mitigations: [Sansec](https://sansec.io/research/php2shell), [Help Net Security](https://www.helpnetsecurity.com/2026/10/21/php2shell-php-vulnerabilities-patched-cve-2026-109618-cve-2026-109619/), [watchTowr](https://watchtowr.com/intelligence/php-cve-2026-109618-faq/). Reports on how widely it is exploited conflict, so patch rather than wait.
75
+
76
+ ## What it checks
77
+
78
+ | Command | Looks at | Confidence |
79
+ |---|---|---|
80
+ | `php-vuln-check scan` | every `php`, `php-fpm`, `php-cgi`, `lsphp` and Apache `libphp*.so` on this machine: version, SAPI, owning package, vendor changelog or fixed build, `session.upload_progress`, `memory_limit` and `fatal_error_backtraces`, including PHP-FPM pool overrides | high |
81
+ | `php-vuln-check images PATH` | `FROM` lines in Dockerfiles (with `ARG` defaults), `image:` in compose files and Kubernetes manifests | high for pinned tags |
82
+ | `php-vuln-check images --docker` | images of running containers | high for pinned tags |
83
+ | `php-vuln-check images --kubectl` | images of every pod in the current cluster (`--kubectl-args "--context prod"`) | high for pinned tags |
84
+ | `php-vuln-check fleet hosts.txt` | runs `scan` on every host over SSH, nothing installed there | high |
85
+ | `php-vuln-check url https://example.com` | the PHP version a site advertises in `X-Powered-By` (one normal GET). Never says PATCHED: a banner proves nothing | low |
86
+
87
+ Every result is one of:
88
+
89
+ - **PATCHED**: version at or above the fix, the vendor changelog names both CVEs, or the package is at or above a fixed build listed in the vendor's security notice. It describes the files on disk; `scan` downgrades it to REVIEW when running processes still use a replaced PHP file, and you should restart PHP-FPM or Apache after any update.
90
+ - **VULNERABLE**: below the fix with no backport evidence, or an end-of-life branch.
91
+ - **REVIEW**: it cannot tell (floating image tag, digest-pinned image, hidden version, pre-release, a package whose changelog is not installed). Not a clean bill of health.
92
+ - **NONE**: `fleet` found no PHP on that host in the standard locations. This is not PATCHED: PHP in a custom prefix, container or vhost folder would not appear.
93
+ - **ERROR**: an SSH, network or file-reading failure. Unreadable or oversized Dockerfiles are errors, never a silent pass.
94
+
95
+ ## Why another PHP2Shell scanner?
96
+
97
+ Active scanners such as [Assetnote's php2shell-scanner](https://github.com/assetnote/php2shell-scanner) answer "does this host fall over when probed?" by deliberately triggering PHP memory exhaustion on the target. Their authors call that [risky in nature](https://www.helpnetsecurity.com/2026/10/22/php2shell-scanner-tool/). php-vuln-check answers a different question, "what do we run and is it patched?", and does it without touching a running service. Use both.
98
+
99
+ | | php-vuln-check | Active probe scanners |
100
+ |---|---|---|
101
+ | Sends crash-inducing requests | never | yes, by design |
102
+ | Safe on production | yes | read their warnings |
103
+ | Knows about distro backports (Debian, Ubuntu, RHEL family) | yes, via package changelogs | not their job: they test behavior |
104
+ | Audits Dockerfiles, compose and Kubernetes | yes | no |
105
+ | Audits many hosts at once | yes, `fleet` over SSH | per target |
106
+ | CI gate and GitHub code-scanning (SARIF) | yes | no |
107
+ | Tests whether a host actually fails when probed | no | yes |
108
+
109
+ ## How backport detection works
110
+
111
+ Debian, Ubuntu and RHEL patch PHP without bumping it to 8.2.35, so `PHP 8.2.30` on a distro can be safe. For a binary owned by a package, `scan` reads the vendor changelog (`/usr/share/doc/<pkg>/changelog.Debian.gz`, or `rpm -q --changelog`) and treats the host as patched only if **both** CVE IDs are named.
112
+
113
+ Docker's `ubuntu` and `debian` images strip `/usr/share/doc`, so there is often no changelog to read. Then `scan` compares the package version with the fixed builds listed in the vendor's notice (for Ubuntu, [USN-8948-1](https://ubuntu.com/security/notices/USN-8948-1)), using `dpkg --compare-versions`. A fixed build only counts for the same build line, so a Sury `8.3.6-1+ubuntu24.04.1` is never judged against Ubuntu's `8.3.6-0ubuntu0.24.04.13`. Debian's fixes are new upstream releases (8.2.35, 8.4.27), which the version check already covers. You can check by hand:
114
+
115
+ ```bash
116
+ zgrep CVE-2026-109618 /usr/share/doc/php8.2-common/changelog.Debian.gz # Debian, Ubuntu
117
+ rpm -q --changelog php-common | grep CVE-2026-109618 # RHEL, Alma, Rocky
118
+ ```
119
+
120
+ If a vendor shipped a fix without naming the CVE, you will see a false `VULNERABLE`. Check the vendor's security advisory, and please open an issue so the lookup can learn that case.
121
+
122
+ ## Run it across your whole estate
123
+
124
+ ```bash
125
+ # hosts.txt: one [user@]host per line, # for comments
126
+ php-vuln-check fleet hosts.txt --jobs 16 --format csv -o php-exposure.csv
127
+ ```
128
+
129
+ The script is streamed over SSH (`python3 -` on the host), so nothing is installed or left behind. You need key-based SSH and Python 3 on each host. Output from the hosts is validated before it is shown. A host where no PHP is found is reported as NONE, not PATCHED.
130
+
131
+ ## Gate your pipeline
132
+
133
+ ```yaml
134
+ # .github/workflows/php-check.yml
135
+ on: [push, pull_request]
136
+ jobs:
137
+ php2shell:
138
+ runs-on: ubuntu-latest
139
+ permissions: { contents: read, security-events: write }
140
+ steps:
141
+ - uses: actions/checkout@v4
142
+ - uses: ethoic-inc/php-vuln-check@v0.2.0
143
+ with:
144
+ fail-on: vulnerable # or "review" to also fail on floating tags
145
+ sarif-file: php-vuln.sarif
146
+ - uses: github/codeql-action/upload-sarif@v3
147
+ if: always()
148
+ with: { sarif_file: php-vuln.sarif }
149
+ ```
150
+
151
+ Findings show up in your repository's Security tab with the Dockerfile line. To block it earlier, add the pre-commit hook:
152
+
153
+ ```yaml
154
+ # .pre-commit-config.yaml
155
+ repos:
156
+ - repo: https://github.com/ethoic-inc/php-vuln-check
157
+ rev: v0.2.0
158
+ hooks:
159
+ - id: php-vuln-check-images
160
+ ```
161
+
162
+ Other CI systems: run `php-vuln-check images . --fail-on vulnerable`. Exit codes are `0` clean, `1` vulnerable, `2` needs review, `3` error or bad usage (a mistyped path is an error, not a clean scan). Formats: `--format text|json|csv|sarif`.
163
+
164
+ ## Limits
165
+
166
+ - It does not test whether a host is exploitable. It tells you whether the PHP on it is patched.
167
+ - `images` reads tags in your files. It does not open the image, so a `FROM` line you rebuild later can drift. Pin full versions and rebuild with `--pull`. A version that comes from an `ARG` default or a `${VAR:-default}` can be overridden by a build argument or `.env` file, so it can be VULNERABLE or REVIEW but never PATCHED. Digest-pinned references are REVIEW. Third-party images that merely name themselves `php` are never PATCHED from their tag.
168
+ - Directory scans read Dockerfiles (any `Dockerfile*`, `*.Dockerfile`, `Containerfile*`), `COPY --from=` images, and `*.yml`/`*.yaml` files with `image:` entries. JSON manifests are read when you pass them by name. Helm values files that split `repository` and `tag` are not read yet.
169
+ - SARIF output includes findings that have a file location (the `images` command), because GitHub code scanning needs one.
170
+ - Config findings (`session.upload_progress.enabled`, `memory_limit`, `fatal_error_backtraces`) come from `php -i` for that binary. For PHP-FPM, `scan` also reads `php_value` / `php_admin_value` overrides from the pools in the packaging's usual `php-fpm.conf` and its includes, shown as `pool www: memory_limit=-1`. A config passed with `-y`/`--fpm-config` and `.user.ini` files are not read. They are hints, not proof, and the partial mitigations they relate to do not replace patching.
171
+ - `scan` runs `php -n -v` and `php -i` only on binaries that are owned by root (or you) and that neither they nor their parent folders are writable by group or others. Anything else, such as a binary under a tenant's home directory, is read statically and never run. `--no-exec` runs nothing; `--exec` runs everything it finds. Programs are run with no terminal input, a timeout and capped output.
172
+ - The advisory data is typed in from PHP's and the vendors' notices. Every report warns when it is more than 30 days old; update to the latest release then.
173
+ - Linux and macOS hosts. Windows is not supported yet.
174
+ - Written for Python 3.6+ so it runs on older enterprise hosts. CI runs the tests on 3.6, 3.7 and 3.8 to 3.13, and runs the tool against real PHP packages on Debian, Ubuntu, AlmaLinux, Rocky, Fedora, Amazon Linux, Alpine and the official PHP images. It is a new tool: read the results critically and report anything that looks wrong.
175
+
176
+ ## FAQ
177
+
178
+ **Am I vulnerable to PHP2Shell?**
179
+ Run `php-vuln-check` on the server. If it prints VULNERABLE, the PHP there is below the fix and has no vendor backport. If you only see PATCHED, the version is fixed or the vendor changelog names both CVEs.
180
+
181
+ **Which PHP versions fix CVE-2026-109618 and CVE-2026-109619?**
182
+ 8.2.35, 8.3.36, 8.4.27 and 8.5.12 or later. PHP 8.1 and older get no release. PHP did publish source backports for 7.4, 8.0 and 8.1 on php-src branches; for anything else you need a vendor backport or an upgrade.
183
+
184
+ **Is PHP 7.4 or 8.1 vulnerable?**
185
+ Treat them as vulnerable. PHP's advisories only list 8.2 to 8.5, but Sansec reports the bugs reach back to PHP 5.4 and the PHP project made no release for older branches (it published source backports for 7.4, 8.0 and 8.1 only). They are safe only if your vendor's changelog names both CVEs, or you built from PHP's backport branch, which this tool cannot see.
186
+
187
+ **Does Ubuntu, Debian or RHEL ship a fixed PHP?**
188
+ Often as a backport on an older version number. `scan` checks the package changelog for both CVE IDs, which is why it can say PATCHED for `8.2.30` on a distro.
189
+
190
+ **How do I check Docker images for PHP2Shell?**
191
+ `php-vuln-check images .` reads your Dockerfiles, compose files and Kubernetes manifests. `php-vuln-check images --image php:8.3-fpm` checks one reference, and `--docker` checks running containers.
192
+
193
+ **Can I scan a website remotely?**
194
+ `php-vuln-check url https://example.com` reads the advertised `X-Powered-By` header with one ordinary request. Many sites hide it, a proxy can fake it and backports are invisible from outside, so it only ever reports REVIEW or ERROR. Run `scan` on the server for a real answer.
195
+
196
+ **Will it crash or slow my server?**
197
+ It sends no exploit traffic. `scan` reads files and runs `php -n -v` and `php -i` on trusted binaries only. `--no-exec` skips even that.
198
+
199
+ **What do I do if it says VULNERABLE?**
200
+ Update PHP and restart PHP-FPM or Apache. Until then, the partial, temporary mitigations in PHP's advisory are, in its order: enforce `memory_limit=-1` in admin config and cap request body size at the web server; set `session.upload_progress.enabled=0` (and `fatal_error_backtraces=0` on PHP 8.5) and restart every worker; and, only if the application takes no uploads, block `multipart/form-data` at the web server. See the [Sansec write-up](https://sansec.io/research/php2shell) for exact snippets.
201
+
202
+ **Does it find other PHP CVEs?**
203
+ Not yet. Advisories are one entry in the `ADVISORIES` list at the top of `php_vuln_check.py`, so adding the next one is a small pull request. See [CONTRIBUTING.md](CONTRIBUTING.md).
204
+
205
+ ## Contributing
206
+
207
+ Wrong result on your distro, a package manager we should read, or the next PHP advisory: open an issue or a pull request. Start with [CONTRIBUTING.md](CONTRIBUTING.md). To report a security problem in this tool, see [SECURITY.md](SECURITY.md). Taking part means following the [Code of Conduct](CODE_OF_CONDUCT.md).
208
+
209
+ Questions, press or anything else: **hello@ethoic.com**.
210
+
211
+ ## About Ethoic
212
+
213
+ [Ethoic Inc](https://ethoic.com) builds human-centered AI tools. This tool runs on your own machine, has no telemetry and only talks to the hosts you point it at.
214
+
215
+ ## Disclaimer
216
+
217
+ php-vuln-check is an open-source project from Ethoic Inc. It is not affiliated with the PHP Group, Sansec, Assetnote, watchTowr or anyone else named here. It is provided as is under the [MIT license](LICENSE). A PATCHED result is evidence about versions and changelogs, not a guarantee. Only check systems you own or are authorized to check.