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

Writeup zur HackTheBox-Easy-Linux-Maschine Mirai mit Abdeckung von Identifizierung eines IoT-Geräts, forensischer Dateiwiederherstellung, mit praktischen Notizen zu Enumeration, Ausnutzung, Foothold und Privilegieneskalation.

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

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

* Identifizierung eines IoT-Geräts
* Forensische Dateiwiederherstellung
  {% 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-af4bfc4f7562c78765f9c16b46170a62afbdfcaa%2Fimage%20(982).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-d2dfdea2d662c18f04fa94f8eb2f8e516fb7735b%2Fimage%20(983).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 --min-rate 5000 10.10.10.48 -oG allPorts
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1e8f472a15dae8a1440336fb16cf4c5e6565b7a2%2Fimage%20(984).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 sie in die Zwischenablage zu kopieren (22,53,80,1178,32400,32469)

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

Port-Versionsscan mit Nmap:

Verwende Nmap, um die Dienstversionen 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="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ca13d94e97c478d03ed911d42ef6a132e17e4a1f%2Fimage%20(986).png?alt=media" alt=""><figcaption></figcaption></figure>

## Port 80 - Pi-hole

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

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

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

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

Wir suchen dann im Internet nach Standardanmeldedaten und finden die folgenden Informationen:

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

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

### Flag user.txt

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

## **Privilegieneskalation :**

**Sudo-Gruppe:** Beim Überprü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="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3bbb273cf0c406d150331bb33556165707572b02%2Fimage%20(991).png?alt=media" alt=""><figcaption></figcaption></figure>

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

```bash
sudo su
```

### Flag root.txt

**Wiederherstellung der root.txt-Datei:** 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="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e3c489dfa36b0d7c555146075a3502b6ef65ea52%2Fimage%20(993).png?alt=media" alt=""><figcaption></figcaption></figure>

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

```bash
df -h 
```

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

Beim Versuch, diese Festplatte direkt zu lesen, sind die Daten unlesbar. Nachdem wir jedoch den `strings` Befehl verwendet haben, können wir lesbare Informationen vom Gerät wiederherstellen:

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

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

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d7c843813e19430b9fefb27f076c3562337adfbd%2Fimage%20(996).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-ee2704119fe1a89dc3d5f9dfb41d14f663745cbc%2Fimage%20(997).png?alt=media" 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 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/mirai-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.
