跳到主内容
@wquguru
精选80GitHub 新爆发仓库(GitHub)行业动态多源精选 ×2

PHP核心曝严重RCE漏洞php2shell,影响全版本

eness/php2shell-CVE-2026-109618-CVE-2026-109619-PoC: Proof-of-Concept (PoC) exploit for php2shell (CVE-2026-109618 / CVE-2026-109619), demo…

原文
发到 X

Proof-of-Concept (PoC) exploit for php2shell (CVE-2026-109618 / CVE-2026-109619), demonstrating remote code execution in vulnerable PHP environments. For security research and educational purposes only.

php2shell(CVE-2026-109618 / CVE-2026-109619)的概念验证(PoC)利用代码,演示了在易受攻击的 PHP 环境中实现远程代码执行。仅限用于安全研究和教育目的。

GitHub repository created 2026-10-21 · 1002 stars in 4.4 days (about 225 a day) · Shell

GitHub 仓库创建于 2026-10-21 · 4.4 天内获得 1002 颗星(平均每天约 225 颗)· Shell

php2shell — CVE-2026-109618 / CVE-2026-109619

> Critical Advisory (CVSS v4.0: 9.2 - Critical): On October 20, details of two pre-auth Remote Code Execution (RCE) flaws in the PHP core leaked online ahead of coordinated disclosure. Exploitation allows arbitrary command execution straight from the web server.

> 关键安全公告(CVSS v4.0: 9.2 - 严重):10 月 20 日,PHP 核心中两个预认证远程代码执行(RCE)漏洞的细节在协调披露前泄露至网络。利用这些漏洞可直接从 Web 服务器执行任意命令。

Table of Contents

目录

  • Overview - Root Cause - Verification & Targets - Affected PHP Versions - Threat Landscape & Detection Guidance - Behavioral Indicators & Suspicious Child Processes - Monitoring Recommendation - Action Items for Organizations - Proof of Concept (PoC) - Exploit Architecture & Stages - Target Requirements - Usage & Parameters - Profiles & Offsets - Mitigation & Source Patching - 1. Configuration Mitigation (Immediate Stopgap) - 2. Automated Quick-Fix Script - 3. Source Code Patch (`session-upload-progress-counters.patch`) - 4. Cloudflare WAF Custom Rules - 5. FrankenPHP Caddyfile Configuration - 6. Lighttpd Configuration - 7. Apache Mitigation (ModSecurity & .htaccess) - Disclaimer
  • 概述 - 根本原因 - 验证与目标 - 受影响的 PHP 版本 - 威胁态势与检测指南 - 行为指标与可疑子进程 - 监控建议 - 组织行动项 - 概念验证(PoC) - 利用架构与阶段 - 目标要求 - 用法与参数 - 配置文件与偏移量 - 缓解措施与源码修补 - 1. 配置缓解(即时临时措施) - 2. 自动化快速修复脚本 - 3. 源代码修补 (`session-upload-progress-counters.patch`) - 4. Cloudflare WAF 自定义规则 - 5. FrankenPHP Caddyfile 配置 - 6. Lighttpd 配置 - 7. Apache 缓解措施 (ModSecurity & .htaccess) - 免责声明

Overview

概述

`php2shell` refers to two critical vulnerabilities (CVE-2026-109618 & CVE-2026-109619) affecting core PHP functionality. The primary demonstrated vector is a heap use-after-free (UAF) in the PHP core session upload progress mechanism leading to arbitrary code execution (`zend_call_function` / `system()`).

`php2shell` 指影响 PHP 核心功能的两个关键漏洞(CVE-2026-109618 & CVE-2026-109619)。主要演示的攻击向量是 PHP 核心会话上传进度机制中的堆释放后使用(UAF)漏洞,导致任意代码执行(`zend_call_function` / `system()`)。

  • Severity: Critical (CVSS v4.0: 9.2) - Impacted Versions: Reports indicate PHP versions 5, 6, 7, and 8 may be affected. Fixes are primarily expected for currently supported PHP 8 branches, leaving end-of-life (EOL) versions (PHP 5.x, 7.x, 8.0, 8.1) exposed without official vendor patches. - Industry Tracking: Confirmed by security researchers (watchTowr reproduced CVE-2026-109618; monitoring by Huntress and Florian Roth / process-watcher).
  • 严重程度:严重(CVSS v4.0: 9.2) - 受影响版本:报告指出 PHP 5、6、7 和 8 版本可能受到影响。修复主要预期针对当前支持的 PHP 8 分支,这使得生命周期结束(EOL)的版本(PHP 5.x、7.x、8.0、8.1)在没有官方厂商补丁的情况下暴露于风险之中。 - 行业跟踪:已得到安全研究人员确认(watchTowr 复现了 CVE-2026-109618;Huntress 以及 Florian Roth / process-watcher 正在进行监控)。

Root Cause

根本原因

PHP's upload progress handler (`php_session_rfc1867_callback` in `ext/session/session.c`) stores two raw `zval *` bucket pointers (`post_bytes_processed` and `current_file_bytes_processed`) directly in live `HashTable` structures.

PHP 的上传进度处理程序(`ext/session/session.c` 中的 `php_session_rfc1867_callback`)将两个原始 `zval *` 桶指针(`post_bytes_processed` 和 `current_file_bytes_processed`)直接存储在活动的 `HashTable` 结构中。

During request processing: 1. Trigger: A standard multipart `POST` request activates progress tracking with default configuration values (`session.upload_progress.enabled = 1`). 2. Free: A progress update cycle re-reads session data. The function `zend_hash_update()` destroys the previous data tree using the destructor `zval_ptr_dtor`, freeing the memory block. 3. Reclaim: The freed bucket memory is reclaimed. The dangling pointer is redirected to crafted `zend_fcall_info` and `zend_internal_function` structures. 4. Execution: PHP calls `zend_call_function()`, resulting in arbitrary system command execution.

在请求处理期间: 1. 触发:标准的 multipart `POST` 请求激活了进度跟踪,使用默认配置值(`session.upload_progress.enabled = 1`)。 2. 释放:进度更新周期重新读取会话数据。函数 `zend_hash_update()` 使用析构函数 `zval_ptr_dtor` 销毁之前的数据结构树,从而释放内存块。 3. 回收:被释放的桶内存被回收。悬空指针被重定向到精心构造的 `zend_fcall_info` 和 `zend_internal_function` 结构体。 4. 执行:PHP 调用 `zend_call_function()`,导致任意系统命令执行。

Verification & Targets

验证 & 目标

  • Confirmed on standard `php-src` builds (including versions 8.4.4 and 8.2.34). - Uses symbol offsets (`--syms`) between `zval_ptr_dtor` and `zend_call_function` to adapt to distribution-specific binary layouts (e.g., Debian Bookworm, Ubuntu Noble, Ubuntu Jammy).
  • 已在标准 `php-src` 构建中确认(包括版本 8.4.4 和 8.2.34)。 - 使用 `zval_ptr_dtor` 和 `zend_call_function` 之间的符号偏移量(`--syms`)以适应特定发行版的二进制布局(例如 Debian Bookworm、Ubuntu Noble、Ubuntu Jammy)。

Affected PHP Versions

受影响的 PHP 版本

The following table summarizes the PHP versions affected by CVE-2026-109618 and CVE-2026-109619, along with their support and patch statuses:

下表总结了受 CVE-2026-109618 和 CVE-2026-109619 影响的 PHP 版本,以及它们的支持和补丁状态:

PHP BranchStatusAffected VersionsFixed / Secure VersionNotes
PHP 8.5Supported (Active)< 8.5.128.5.12Emergency security release published
PHP 8.4Supported (Active)< 8.4.278.4.27Emergency security release published
PHP 8.3Supported (Active)< 8.3.368.3.36Emergency security release published
PHP 8.2Supported (Security Only)< 8.2.358.2.35Emergency security release published
PHP 8.1End of Life (EOL)All 8.1.x versionsNo Official Patch (EOL)Set `session.upload_progress.enabled = Off` or use ELS/distro backports
PHP 8.0End of Life (EOL)All 8.0.x versionsNo Official Patch (EOL)Official support ended; configuration mitigation is mandatory
PHP 7.xEnd of Life (EOL)All 7.0 - 7.4 versionsNo Official Patch (EOL)Core `ext/session` logic vulnerable; urgent mitigation or upgrade required
PHP 5.xEnd of Life (EOL)5.4.0+ (with RFC1867 progress tracking)No Official Patch (EOL)Official support ended; isolate host or disable upload progress
PHP 分支状态受影响版本修复/安全版本备注
PHP 8.5支持(活跃)< 8.5.128.5.12已发布紧急安全更新
PHP 8.4支持(活跃)< 8.4.278.4.27已发布紧急安全更新
PHP 8.3支持(活跃)< 8.3.368.3.36已发布紧急安全更新
PHP 8.2支持(仅限安全)< 8.2.358.2.35已发布紧急安全更新
PHP 8.1生命周期结束 (EOL)所有 8.1.x 版本无官方补丁 (EOL)设置 `session.upload_progress.enabled = Off` 或使用 ELS/发行版回溯补丁
PHP 8.0生命周期结束 (EOL)所有 8.0.x 版本无官方补丁 (EOL)官方支持已结束;必须采用配置缓解措施
PHP 7.x生命周期结束 (EOL)所有 7.0 - 7.4 版本无官方补丁 (EOL)核心 `ext/session` 逻辑存在漏洞;需紧急缓解或升级
PHP 5.x生命周期结束 (EOL)5.4.0+(启用 RFC1867 进度跟踪)无官方补丁 (EOL)官方支持已结束;隔离主机或禁用上传进度功能

> PHP 8.1 and older End-of-Life (EOL) versions do not receive official security patches from the PHP Foundation. For these environments, immediately apply `session.upload_progress.enabled = Off` or rebuild PHP from source using the provided C source patch.

> PHP 8.1 及更早的生命周期结束 (EOL) 版本不会从 PHP 基金会获得官方安全补丁。对于这些环境,请立即应用 `session.upload_progress.enabled = Off` 或使用提供的 C 源代码补丁从源码重新构建 PHP。

Threat Landscape & Detection Guidance

威胁态势 & 检测指南

Exploitation of `php2shell` typically manifests as anomalous child processes spawned directly by PHP worker processes (`php-fpm`, `php-cgi`, `php-cgi.exe`, `httpd`, `apache2`).

对 `php2shell` 的利用通常表现为由 PHP 工作进程(`php-fpm`、`php-cgi`、`php-cgi.exe`、`httpd`、`apache2`)直接生成的异常子进程。

Behavioral Indicators & Suspicious Child Processes

行为指标与可疑子进程

Monitor and alert on PHP worker processes executing: - Interactive Shells: `/bin/sh`, `/bin/bash`, `cmd.exe`, `powershell.exe` - Script Interpreters: `python`, `perl` - Network / Transfer Utilities: `curl`, `wget`, `nc`, `certutil.exe` - Common Reverse Shell Patterns: `/dev/tcp/`, `fsockopen`, `mkfifo` - Immediate Reconnaissance Commands: `whoami`, `id`, `uname -a`, `ipconfig`

监控并告警执行以下操作的 PHP 工作进程: - 交互式 Shell:`/bin/sh`、`/bin/bash`、`cmd.exe`、`powershell.exe` - 脚本解释器:`python`、`perl` - 网络/传输工具:`curl`、`wget`、`nc`、`certutil.exe` - 常见反向 Shell 模式:`/dev/tcp/`、`fsockopen`、`mkfifo` - 即时侦察命令:`whoami`、`id`、`uname -a`、`ipconfig`

Monitoring Recommendation

监控建议

For Linux-based web environments without an endpoint detection agent, tools like Florian Roth's free process-watcher can be run in observe mode to flag unusual child process spawning in real time.

对于没有端点检测代理的基于 Linux 的 Web 环境,可以运行 Florian Roth 开发的免费进程监视工具(process-watcher)的观察模式,以实时标记异常的子进程生成行为。

Action Items for Organizations

组织行动项

更进一步:量化金融体系

看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力

进入量化体系 →

关联讨论

同一事件的更多信源

相似阅读

关联信息,但可能不是同一事件