WordPress:未授权路径遍历导致条件远程代码执行
WordPress: Unauthenticated path traversal leading to conditional RCE

原始链接: https://github.com/WordPress/wordpress-develop/security/advisories/GHSA-7hp8-65ch-5whp

WordPress 的 `get_page_template()` 函数存在一个漏洞,允许未经身份验证的攻击者通过针对主题目录之外的 `.php` 文件执行本地文件包含(LFI)攻击。在特定条件下(例如主题包含以“page-”开头的顶层目录),该漏洞可被升级为远程代码执行(RCE)。 此漏洞影响 Twenty Twelve 和 Twenty Fourteen 等旧版主题,以及 Neve、Hestia 和 Sydney 等热门第三方主题。在启用了 `register_argc_argv` 的环境中(例如官方 PHP Docker 镜像或运行旧版本 PHP 的默认 cPanel 配置),RCE 的可行性较高。 WordPress 7.1.2 已包含针对此问题的修复程序。为了保护旧版本站点,该补丁已向后移植至所有可追溯至 4.7 版本的 WordPress。强烈建议用户立即更新其安装程序。该漏洞由 Robert Ressl 发现并负责任地披露。

Hacker News 上出现了一场关于 WordPress 新发现的未经身份验证的路径遍历漏洞的讨论,该漏洞可能导致远程代码执行(RCE)。 虽然一些用户最初认为该威胁仅限于少数主题,但其他人指出,该漏洞源于 WordPress 官方文档中推荐的一种常见目录命名规范。这显著扩大了潜在的影响范围,波及许多使用特定子目录的主题。 这一技术缺陷似乎存在于 `locate_template()` 函数中,该函数缺乏内置的目录遍历保护机制。评论者指出,这个问题已经存在近十年之久,之前的开发者曾多次提醒需要对模板路径进行手动验证。尽管利用此 RCE 需要特定的服务器配置(例如存在 `pearcmd.php` 且启用了 `register_argc_argv`),但该漏洞仍被视为严重级别。此次讨论还强调了人们对 CVSS 评分可靠性的担忧,以及 WordPress 长期架构设计中固有的风险——一些贡献者认为这种设计极易导致安全疏漏。
相关文章

原文

An unauthenticated attacker can make get_page_template() page-template resolution include a chosen readable local .php file outside the active theme directories. If relevant pre-conditions for both the server environment and the active theme are met, this can lead to RCE.

The pre-conditions are:

  • The active child or parent theme contains a top-level directory whose name starts with page- (e.g. page-templates). This affects the legacy Twenty Twelve and Twenty Fourteen themes, as well as some popular third party themes such as Neve, Hestia, and Sydney.
  • A chosen local .php target file exists on the server and is readable by the web server account. The well known pearcmd.php PEAR→RCE transition can be used for this when register_argc_argv is set to On. The official php image for Docker is affected, and the default cPanel configuration is affected when PHP prior to 8.5 is in use.

WordPress 7.1.2 has been released containing a fix for the vulnerability, and as a courtesy to users on older branches the fix has been backported to all branches back to 4.7.

Discovered and responsibly disclosed by Robert Ressl.

联系我们 contact @ memedata.com