
WordPressコアアップデートのTOCTOU競合(CWE-367)に対する概念実証エクスプロイトで、不正なwp-config.phpを書き込むことでデータベースの乗っ取り、管理者ログイン、RCEを可能にします。
| 項目 | 値 |
|---|---|
| CVE | CVE-2026-119977 |
| CVSS | 8.1 (High) |
| CWE | CWE-367 (Time-of-Check Time-of-Use) |
| 攻撃ベクター | ネットワーク (完全リモート、HTTP のみ) |
| 影響を受けるバージョン | WordPress 4.7.0 – 7.1.3 |
| 修正バージョン | WordPress 7.1.4 |
許可されたセキュリティテスト専用。 この PoC は、自身が所有するシステム、またはテストについて明示的な 書面による許可を得ているシステム上で脆弱性を検証するためのものです。 コンピュータシステムへの不正アクセスは、CFAA (米国)、Computer Misuse Act (英国)、 および世界中の同様の法律により違法です。
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 は MySQL をホストポート 3307 で公開しており、ターゲット (XAMPP) は同じホスト上にある |
| VPS → リモートターゲット | 203.0.113.50 | ターゲットは VPS のパブリック IP に接続する |
| VPS → VPN 経由のターゲット | 10.8.0.1 | ターゲットは VPN トンネル IP 経由で接続する |
| 同一 LAN | 192.168.1.100 | ターゲットは攻撃者の LAN IP に接続する |
MySQL 接続を行うのはターゲットサーバーの PHP プロセスであり、
エクスプロイトスクリプトではありません。エクスプロイトは単に setup-config.php に対して、
どの DB ホストを wp-config.php に書き込むかを指示するだけです。
検証するための最速の方法です。Docker = 攻撃者 VPS、ローカルの WordPress (XAMPP/MAMP など) = ターゲット。