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

# Mirai HackTheBox-Lösungsbericht

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

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

* Identifizierung eines IoT-Geräts
* Forensische Dateiwiederherstellung
  {% 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/c4422aa848c40212c79c46083927ea0eb5998962" alt=""><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/9404bdf9307c53922a1caf10afb4dfbb25a283ab" alt=""><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 10.10.10.48 -oG allPorts
```

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

**Analyse offener Ports mit extractPorts:**

Verwenden Sie die Funktion extractPorts, um offene Ports in einem kompakten Format anzuzeigen und sie in die Zwischenablage zu kopieren (22,53,80,1178,32400,32469)

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

Versionsscan der Ports mit Nmap:

Verwenden Sie Nmap, um die Service-Versionen zu scannen und die Ausgabe in der Datei "targeted" zu speichern:

```bash
nmap -sCV -p22,53,80,1178,32400,32469 10.10.10.48 -oN targeted
```

<figure><img src="/files/4f3b29c0d1ad170ffe377c8fa79ae6446549b156" alt=""><figcaption></figcaption></figure>

## Port 80 - Pi-hole

Beim Scannen von Port 80 liefert das Wappalyzer-Tool keine nennenswerten Informationen.

<figure><img src="/files/3acfdee15fd610d627874c91958a11b642a84e72" alt=""><figcaption></figcaption></figure>

Allerdings entdecken wir nach etwas Fuzzing ein Verzeichnis "`admin`" im Zusammenhang mit Pi-hole, das ein Login-Panel enthält.

<figure><img src="/files/3338ec20e680c3d88914c8c60d8c2ed4478d0f96" alt=""><figcaption></figcaption></figure>

Anschließend suchen wir im Internet nach Standard-Zugangsdaten und finden die folgenden Informationen:

* **Benutzer:** pi
* **Passwort:** raspberry

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

Wir versuchen, uns per SSH zu verbinden, da Port 22 offen ist:

```bash
ssh pi@10.10.10.48
```

Die Verbindung ist erfolgreich.

<figure><img src="/files/220498050f95fafba3eb6694b3505037c6aee888" alt=""><figcaption></figcaption></figure>

### Flagge user.txt

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

## **Privilegieneskalation :**

**Sudo-Gruppe:** Beim Prüfen der Benutzergruppen sehen wir, dass der Benutzer "pi" zur sudo-Gruppe gehört. Da wir sein Passwort bereits kennen, können wir Root-Rechte erlangen.

```bash
id
```

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

Als Nächstes führen wir `sudo su` und geben das Passwort für den Benutzer "pi" ein:

```bash
sudo su
```

### Flag root.txt

**Wiederherstellung der Datei root.txt:** Der Angreifer teilt uns mit, dass er die `root.txt` Datei verloren hat und dass wir in einem Backup auf einem USB-Stick danach suchen müssen.

<figure><img src="/files/19b24f96f635a6f9c1f0e2b49e59961c3d281bac" alt=""><figcaption></figcaption></figure>

Wir suchen nach angeschlossenen USB-Geräten und finden ein `/dev/sdb` Festplatte

```bash
df -h 
```

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

Beim Versuch, diese Festplatte direkt zu lesen, sind die Daten unlesbar. Nach der Verwendung des `strings` Befehls können wir jedoch lesbare Informationen vom Gerät wiederherstellen:

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

```bash
strings /dev/sdb
```

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

<figure><img src="/files/96ddd251f30eb453aab08325fbd9901f08d8bf1b" alt="" width="530"><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-easy/mirai-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.
