Cloudflare WAF 如何帮助防御 phpAfterShell 及其他严重 PHP 漏洞
2026 年 11 月 19 日,安全研究公司 depthfirst 披露了 phpAfterShell(CVE-2026-126714),这是 PHP 默认基于文件的会话处理器中的一个严重漏洞,CVSS 4.0 评分 9.2,可导致远程代码执行。PHP 项目当天即在 8.2.36、8.3.37、8.4.28、8.5.13 和 8.6.0 版本中修复,这些版本还修复了另外 16 个安全漏洞,其中 6 个同样被评为严重。
phpAfterShell 的触发条件是会话文件回写过程被中断,导致文件中新旧会话数据混杂,在下一次请求时被 session_start() 反序列化。如果攻击者控制了旧数据,例如通过会话上传进度功能或应用存入会话的大段用户可控字符串,PHP 可能反序列化攻击者指定的对象。depthfirst 称其通过链接第二个未公开的内存破坏漏洞,在无需应用侧 gadget 的情况下实现了代码执行,而现有来源并未说明该漏洞是否已在 11 月 19 日的版本中修复。
Cloudflare 的 WAF 在包括免费版在内的所有套餐上阻止已知的 phpAfterShell 攻击模式,这依托于其 PHP 远程代码执行规则,该规则最初于 2026 年 10 月为 php2shell 漏洞部署,并于 11 月 19 日更新以覆盖 phpAfterShell。同一次 WAF 发布还为付费用户新增了三条规则,覆盖 PHP-FPM 请求走私漏洞(CVE-2026-129289)和两个 SOAP 扩展漏洞(CVE-2026-15353、CVE-2026-129506);这些规则默认动作为 Log,用户可在 Security Events 中审查匹配请求后改为 Block。
WAF 只是额外的防御层,不能替代补丁:多个漏洞依赖于服务器配置或 WAF 无法看到的路径,唯一彻底的修复方式是升级 PHP 并重启所有 worker。受影响版本为 8.2.36 之前的 PHP 8.2、8.3.37 之前的 8.3、8.4.28 之前的 8.4、8.5.13 之前的 8.5 以及 8.6.0 候选版本,而 Linux 发行版通常在不改变版本号的情况下回移修复,因此运维人员应根据发行版公告核对完整包版本。截至 2026 年 11 月 19 日,没有迹象表明这 17 个漏洞中任何一个已被在野利用。
How Cloudflare WAF helps protect against phpAfterShell and other critical PHP flaws
On November 19, 2026, depthfirst disclosed phpAfterShell (CVE-2026-126714), a critical 9.2 CVSS 4.0 vulnerability in PHP's default file-based session handler that can lead to remote code execution. The PHP project fixed it the same day in versions 8.2.36, 8.3.37, 8.4.28, 8.5.13, and 8.6.0, releases that also fix 16 other security vulnerabilities, six of them rated critical.
phpAfterShell is triggered when the write-back of a session file is interrupted, leaving a mix of new and old session data that session_start() deserializes on the next request. If the attacker controlled the old data, for example via session upload progress or large user-controlled strings stored in the session, PHP may deserialize attacker-chosen objects. depthfirst reports achieving code execution without an application gadget by chaining a second, undisclosed memory-corruption bug, and the sources reviewed do not establish whether that bug is fixed in the November 19 releases.
Cloudflare's WAF blocks known phpAfterShell attack patterns on every plan, including Free, through its PHP Remote Code Execution rule, first deployed in October 2026 for the php2shell flaws and updated on November 19 to cover phpAfterShell. The same WAF release adds three rules for paid plans covering a PHP-FPM request smuggling flaw (CVE-2026-129289) and two SOAP extension flaws (CVE-2026-15353, CVE-2026-129506); these default to Log action, and customers can review matches in Security Events and switch them to Block.
The WAF is an additional layer of defense, not a replacement for patching: several flaws depend on server configuration or paths a WAF cannot see, and the only complete fix is to upgrade PHP and restart every worker. Affected versions are PHP 8.2 before 8.2.36, 8.3 before 8.3.37, 8.4 before 8.4.28, 8.5 before 8.5.13, and 8.6.0 release candidates, and Linux distributions often backport fixes without changing the version number, so operators should check the full package version against their distribution's advisory. As of November 19, 2026, there was no indication that any of the 17 vulnerabilities had been exploited in the wild.
猎鹰不保存原文正文。标题与摘要用于快速发现信息,事实细节请以来源原文为准。