Cloudflare · PHP2Shell

Cloudflare 与 PHP2Shell

Cloudflare 于 2026 年 10 月 21 日 03:02 UTC 为所有 WAF 套餐启用了 PHP2Shell 防护。

最后核实 2026-10-22

WAF 只是争取时间,不是修复

Cloudflare 自己也说,攻击者正在变形载荷以绕过规则,规则会随新变种不断更新。任何不经过 Cloudflare 直接到达你服务器的请求都不会被过滤。去升级 PHP。

规则 ID

Cloudflare Managed Free Ruleset

规则集 77454fe2d30c4220b5701f6fdfb893ba

  1. 4e315666e8e344cdb64119a3b5ccf32f · Anomalous Execution 1
  2. 00c10e6cc4da4bd08722adeebcd95984 · Anomalous Execution 2
  3. 48ddf592361e4fdb97a8a85982dab691 · Anomalous Execution 3
  4. 3556683d512a47f2937899c524b1a4c6 · Anomalous Execution 4
  5. da07c85852e34625bb478496302ede46 · Anomalous Execution 5
  6. 19373a83abb840e18ab3ce5a7975ce1b · Anomalous Execution 6
  7. 07f0b6ddaabf40b1b2042dade8d613fa · Anomalous Execution 7

Cloudflare Managed Ruleset (Pro / Business / Enterprise)

规则集 efb7b8c949ac4650a09736fc376e9aee

  1. c1d409ad838f47f59446f21cc438d5dd · Anomalous Execution 1
  2. f9a45927414245e3a64bb12d0a0c2f64 · Anomalous Execution 2
  3. 771c654ae1154d4daa72f4e1545d163c · Anomalous Execution 3
  4. 217005865f0145f392300bac212afcc9 · Anomalous Execution 4
  5. 38efdb17ea594501bb55a1d71867b12e · Anomalous Execution 5
  6. 4148ae686fdb4d01be673fab9d9c073d · Anomalous Execution 6
  7. 1389aa259617437392ce149c48143645 · Anomalous Execution 7

此外,所有套餐都有:Cloudflare Managed Response Firewall Default——afffe22785674c80a31875c848d2242a(“Default block for High confidence Signatures”)。它还会检查源站的响应,因此能在泄露内存的响应到达攻击者之前将其拦截。

为什么还要检查响应?

结合请求与响应信号,有助于在泄露数据到达攻击者之前拦截响应,但不会修复 PHP。Cloudflare 官方说明。

确认规则在生效

  1. DNS → Records:每个提供 PHP 服务的主机名都已开启代理(橙色云朵)。灰色云朵的记录会绕过 WAF。
  2. Security → WAF → Managed rules(付费套餐):已部署 Cloudflare Managed Ruleset,且动作是 Block,不是 Log。
  3. Security → Analytics → Events:按上面的规则 ID 筛选,查看拦截了什么、来自哪里。
  4. 锁定源站:确保服务器只接受来自 Cloudflare IP 的 HTTP 流量(或使用 Cloudflare Tunnel)。
shell
# Is your origin reachable without Cloudflare? Run from outside your network.
# A normal response here means attackers can skip the WAF.
curl -sk -o /dev/null -w '%{http_code}\n' --resolve www.example.com:443:<ORIGIN_IP> https://www.example.com/

# Lock the origin to Cloudflare (nginx example; keep the list current from
# https://www.cloudflare.com/ips/)
# allow 173.245.48.0/20;  ...  deny all;

常见问题

Cloudflare 能保护我免受 PHP2Shell 攻击吗?+

能降低风险。Cloudflare 于 2026 年 10 月 21 日 03:02 UTC 为所有套餐(含免费版)上线了托管 WAF 规则,并称已拦截早期攻击。但攻击者在变形载荷,而直接到达源站的请求会完全绕过 Cloudflare。你仍然需要升级 PHP。

免费版需要做什么吗?+

只要流量经过代理(橙色云朵),免费版就会自动受到 Cloudflare Managed Free Ruleset 保护。请确认 DNS 记录已开启代理,且源站无法绕过 Cloudflare 被直接访问。

付费套餐客户应该检查什么?+

确认已部署 Cloudflare Managed Ruleset,且 PHP2Shell 相关规则处于 Block 模式而不是 Log。然后在 Security Events 中按规则 ID 筛选查看命中情况。

相关页面