php2shell-scanner README

项目的 README,来自 github.com/assetnote/php2shell-scanner。合并为一个 markdown 文件:README.md。

php2shell-scanner

A command-line tool for detecting CVE-2026-109618 and CVE-2026-109619 in PHP applications.

How It Works

The scanner sends a minimal multipart control request followed by up to three crafted multipart probes. The probes use PHP array keys nested 62 levels deep and increase from 1 MiB to 20 MiB, matching the detection logic used by Assetnote's internal scanner.

A target is reported vulnerable when the probe produces a PHP memory-exhaustion error, a differential empty HTTP 500, a PHP-FPM worker failure, or an advertised PHP version known to be unpatched. Initial 5xx responses, common request-rejection statuses, and nonempty HTTP 500 responses without the PHP fatal-error signature are not treated as crash signals.

The scanner tests /index.php by default. A path supplied in the URL is preserved, and --path or --path-file can test custom paths. phpMyAdmin targets are automatically retested at /show_config_errors.php. Redirects are not followed unless --follow-redirects is set.

SAPI Modes

The default --sapi auto mode applies both mod_php and PHP-FPM verdict rules, matching the combined behavior of Assetnote's postmodules. Use --sapi mod_php or --sapi fpm to restrict detection to a known SAPI.

Network Impact

Each tested path may receive a 42-byte control request and three probes totalling about 29 MiB. Probing stops as soon as the verdict is settled, and duplicate input URLs are scanned once.

Requirements

Installation

pip install -r requirements.txt

Docker

Build the image:

docker build -t php2shell-scanner .

Run it with the same options as scanner.py:

docker run --rm php2shell-scanner -u https://example.com

Mount the current directory to read host lists and write results:

docker run --rm -v "$PWD:/data" -w /data php2shell-scanner -l hosts.txt -o results.json

Usage

Scan a single host:

python3 scanner.py -u https://example.com

Scan a list of hosts:

python3 scanner.py -l hosts.txt

Scan with multiple threads and save results:

python3 scanner.py -l hosts.txt -t 20 -o results.json

Scan with custom headers:

python3 scanner.py -u https://example.com -H "Authorization: Bearer token" -H "Cookie: session=abc"

Scan a custom path:

python3 scanner.py -u https://example.com --path /phpinfo.php
python3 scanner.py -u https://example.com --path /index.php --path /admin.php
python3 scanner.py -u https://example.com --path-file paths.txt

Use only PHP-FPM verdict rules:

python3 scanner.py -u https://example.com --sapi fpm

Options

-u, --url         Single URL to check
-l, --list        File containing hosts (one per line)
-t, --threads     Number of concurrent threads (default: 10)
--timeout         Request timeout in seconds (default: 60)
-o, --output      Output file for results (JSON)
--all-results     Save all results, not just vulnerable hosts
-k, --insecure    Disable TLS certificate verification
--follow-redirects Follow HTTP redirects (up to 10 hops)
-H, --header      Custom header (can be used multiple times)
-v, --verbose     Show verdict reasons and response snippets
-q, --quiet       Only output vulnerable hosts
--no-color        Disable colored output
--sapi            Verdict rules: auto, mod_php, or fpm (default: auto)
--path            Custom path to test (can be used multiple times)
--path-file       File containing paths to test (one per line)

Credits

The first, original discovery of php2shell is attributed to the Calif team. You can read their write up here: https://calif.io/php2shell/.

The scanner was built by the Assetnote Security Research Team using logic built for Searchlight's Exposure Platform.

Output

Results are printed to the terminal. When using -o, vulnerable hosts are saved to a JSON file with the verdict reason and redacted HTTP request/response evidence.

Limitations

On specific PHP configurations, the scanner may report a false positive when its multipart probe exceeds PHP's memory_limit. Patched and vulnerable versions can then return the same empty HTTP 500 response.

This was reproduced on patched PHP 8.4.27 with memory_limit values from 2M to 32M, and on PHP 8.3.36 at 128M when max_multipart_body_parts is set to 2785 or higher. The exact threshold may vary between builds.

When PHP does not disclose its version, the scanner cannot distinguish this safe post-patch OOM from the vulnerable pre-patch behavior. Results should therefore be verified against the installed PHP version and any vendor backports

php2shell-scanner (assetnote/php2shell-scanner)

正在搜索数据库…

这是什么?一个命令行扫描器,通过发送精心构造的 multipart 探测请求并检查服务器响应,检测 PHP 应用中的 CVE-2026-109618 和 CVE-2026-109619(昵称 php2shell)。
这是完整的利用工具,还是只是检测扫描器?它纯粹是一个检测扫描器:发送构造好的探测请求,并根据错误特征给出判定结果,不会利用该漏洞。
我该怎么扫描目标?可以针对单个主机运行扫描器,也可以传入主机列表;还提供多线程、自定义请求头、自定义路径以及将结果保存到文件等选项。
运行它需要什么?Python 3.9+ 以及 h11 和 tqdm 库。
它会产生误报吗?会。在某些 PHP 配置下,探测请求可能超过 PHP 的 memory_limit,导致已修复和存在漏洞的版本都返回相同的空 HTTP 500 响应,从而产生误报;当 PHP 没有披露其版本时,这种情况尤其常见。
每个目标的扫描会产生多少流量?每个被测试的路径会先收到一个 42 字节的小型控制请求,再收到三个探测请求,总计约 29 MiB;一旦得出判定结果,探测就会停止。
扫描器会测试哪些路径?默认测试 /index.php,保留 URL 中给出的任何路径,可通过 --path 或 --path-file 指定自定义路径,并会自动在 /showconfigerrors.php 对 phpMyAdmin 目标重新测试。
它支持哪些 SAPI 模式?默认使用 --sapi auto,同时应用 mod_php 和 PHP-FPM 的判定规则;也可以通过 --sapi modphp 或 --sapi fpm 将检测限定在某一种模式。
php2shell 是谁发现的,这个扫描器又是谁做的?最初的发现归功于 Calif 团队,扫描器本身由 Assetnote Security Research Team 基于 Searchlight 的 Exposure Platform 中的逻辑构建。
作者
assetnote
大小
<0.1 MB
星标
1K
更新
提交Oct 24
时长
27天
提交 · 90 天