字号·· | 护眼
漏洞档案 · 严重

PHP CGI 查询字符串参数注入致远程代码执行(CVE-2012-1823)

CVE-2012-1823 别名:GHSA-3P37-HV77-X3RP
CVSS 9.8 / 3.1 EPSS 100.0% CISA KEV 在野利用 公开 PoC · 8 Nuclei 模板
综合风险96/ 100
CVSS9.8严重
EPSS100.0%30 天利用概率
机构收录时间2012-05-11更新 2026-12-03

研判简报

概述

PHP 以 CGI 脚本(php-cgi)方式配置时,sapi/cgi/cgi_main.c 对缺少 = 字符的查询字符串处理不当,攻击者可将命令行选项放入查询串,触发任意代码执行,根因与 'd' 分支未跳过特定 php_getopt 有关。该漏洞无需认证、可远程触发,影响面覆盖大量历史 Linux 发行版与商业 Unix 上的 PHP 部署。仍运行 php-cgi 形态且未升级到修复版本的系统应优先关注。

严重性

CVSS 3.1 评分 9.8(critical),综合风险分 96.2/100;Nuclei 模板记录 CVSS 2.0 向量 AV:N/AC:L/Au:N/C:P/I:P/A:P、评分 7.5,与官方 3.1 评分存在口径出入,以官方记录为准。攻击面为面向公网的 php-cgi 接口,SSVC 判定 technical_impact=total。

利用状态

截至核查日期 2026-11-24:EPSS 30 天利用概率 100.0%(百分位 100.0%);已列入 CISA KEV(收录日期 2022-03-25,要求动作 Apply updates per vendor instructions,期限 2022-04-15);存在公开 Exploit-DB PoC 5 条及 Nuclei 检测模板 http/cves/2012/CVE-2012-1823.yaml;CISA SSVC 为 automatable=yes、exploitation=active。材料未给出勒索软件关联信息。

受影响产品

PHP 本体:<5.3.12、>=5.4.0 <5.4.2。下游打包与集成产品包括 Fedora 39/40、Debian 6.0、HP-UX B.11.23/B.11.31、openSUSE 11.4/12.1、SUSE Linux Enterprise Server 10/11 及 SDK 10/11、Apple Mac OS X >=10.6.8 <10.7.5 与 >=10.8.0 <10.8.2、Red Hat 多条产品线(Application Stack 2.0、Storage 2.0 系列、Enterprise Linux Desktop/Server/Workstation 5.0/6.0、EUS 5.6/6.1/6.2、AUS 5.3/5.6)。部署形态限定为 CGI 脚本方式运行的 php-cgi。

修复版本

官方修复版本:PHP 5.3.12、PHP 5.4.2;Apple 侧为 Mac OS X 10.7.5、10.8.2。HP-UX 参考公告给出的处置为安装 HP-UX Web Server Suite v3.24 或后续版本(含 PHP v5.2.17)。其余下游发行版的具体修复版本材料未给出。

缓解措施

无法立即升级时,避免以 CGI 形态暴露 php-cgi;材料未给出其他具体缓解配置项。可依据 KEV 要求按厂商指引应用更新,并对暴露的 CGI 端点实施访问限制与监控。

响应步骤

  1. 盘点资产中是否存在以 CGI 方式运行的 php-cgi,核对 PHP 版本是否落在 <5.3.12 或 >=5.4.0 <5.4.2 区间。
  2. 对可疑请求检查查询串中是否携带 -d 等命令行选项特征(如 allow_url_include、auto_prepend_file 组合),排查异常执行痕迹。
  3. 升级至 PHP 5.3.12 / 5.4.2 或厂商对应修复版本;HP-UX 升级至 Web Server Suite v3.24 及以上。
  4. 使用 Nuclei 模板 http/cves/2012/CVE-2012-1823.yaml 对存量资产做验证性检测。
  5. 对暂无法修复的实例下线 CGI 暴露面或加访问控制,并纳入持续监控。

参考来源

  1. https://nvd.nist.gov/vuln/detail/CVE-2012-1823kev
  2. https://www.exploit-db.com/exploits/29290exploit,exploitdb
  3. https://www.exploit-db.com/exploits/29316exploit,exploitdb
  4. https://www.exploit-db.com/exploits/18834exploit,exploitdb
  5. https://www.exploit-db.com/exploits/18836exploit,exploitdb
  6. https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2012/CVE-2012-1823.yamlexploit,nuclei
  7. http://marc.info/?l=bugtraq&m=134012830914727&w=2vendor-advisory,vendor-advisory,x_transferred,Mailing List,advisory,euvd
  8. http://lists.opensuse.org/opensuse-security-announce/2012-05/msg00011.htmlvendor-advisory,vendor-advisory,x_transferred,Mailing List,Third Party Advisory,
  9. http://www.securitytracker.com/id?1027022vdb-entry,vdb-entry,x_transferred,advisory,euvd
  10. http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=c03360041vendor-advisory,vendor-advisory,x_transferred,Broken Link,advisory,euvd
  11. http://www.mandriva.com/security/advisories?name=MDVSA-2012:068vendor-advisory,vendor-advisory,x_transferred,advisory,euvd
  12. http://lists.opensuse.org/opensuse-security-announce/2012-05/msg00002.htmlvendor-advisory,vendor-advisory,x_transferred,Mailing List,Third Party Advisory,
  13. http://rhn.redhat.com/errata/RHSA-2012-0546.htmlvendor-advisory,vendor-advisory,x_transferred,Third Party Advisory,advisory,euvd
  14. http://rhn.redhat.com/errata/RHSA-2012-0568.htmlvendor-advisory,vendor-advisory,x_transferred,Third Party Advisory,advisory,euvd
  15. http://rhn.redhat.com/errata/RHSA-2012-0569.htmlvendor-advisory,vendor-advisory,x_transferred,Third Party Advisory,advisory,euvd
  16. http://www.php.net/ChangeLog-5.php#5.4.2x_transferred,advisory,euvd