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

# Underpass HackTheBox Writeup

Writeup zur HackTheBox-Easy-Linux-Maschine Underpass mit Abdeckung von UDP-Enumeration, Standardanmeldeinformationen (DaloRADIUS), Passwort-Cracking, Privilegieneskalation über SUDO (mosh-server), mit praktischer Enumeration,

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

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

* UDP-Aufzählung
* Standardanmeldedaten (DaloRADIUS)
* Passwort-Knacken
* Rechteausweitung über SUDO (mosh-server)
  {% 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-c95ecbf78acd28e77cd883b1a671689ae1f0a8f0%2Fimage%20(2690).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-682bf9a380dddc1a16521369b9ced2160d02f6ec%2Fimage%20(2691).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

### TCP

**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 -vvv --min-rate 5000 10.10.11.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-a684285782e8d89239e15e4a15151d40a74c0ab2%2Fimage%20(2692).png?alt=media" alt=""><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,80 10.10.11.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-6c123c9a69ea58a97a94b9c767c690fb02914347%2Fimage%20(2693).png?alt=media" alt=""><figcaption></figcaption></figure>

### UDP

**Scan der am häufigsten verwendeten UDP-Ports:**

Wir führen einen Scan der 100 häufigsten UDP-Ports durch:

```bash
nmap -sU --top-ports 100 --open -vvv -n 10.10.11.48 -oG allPortsUDP
```

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

* Erkannte Ports: **161, 1812, 1813**.

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

**UDP-Dienstversionsscan :**/ Wir untersuchen die identifizierten Ports für weitere Informationen:

```bash
nmap -sUCV -p161,1812,1813 10.10.11.48 -oN targetedUDP
```

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

**Initiale Beobachtung :**

* Die Domain **underpass.htb** wird entdeckt.
* Ein CMS namens **DaloRADIUS** wird identifiziert.

## CMS - **DaloRADIUS**

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

**Verzeichnisse mit Gobuster scannen:**/ Wir erkunden die Verzeichnisse der Website:

```bash
gobuster dir -u http://underpass.htb/daloradius/ -w /usr/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -t 100
```

Ergebnis: ein Verzeichnis namens **`/app`** wird entdeckt.

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

**Auflistung der Unterverzeichnisse:**<br>

Beim Erkunden von **`/app`**, finden wir:

```bash
gobuster dir -u http://underpass.htb/daloradius/app/ -w /usr/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -t 100
```

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

* A **Login-Seite für Benutzer**.

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

* A **Login-Seite für Betreiber**.

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

**Zugriff mit den Standardanmeldedaten von DaloRADIUS:**/ Durch das Testen der Standardanmeldedaten für RADIUS:

* **Benutzername:** `administrator`
* **Passwort:** `radius`/ Diese Anmeldedaten funktionieren im Bedienfeld für Betreiber.

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

### **Extraktion sensibler Informationen:**

In dem **Verwaltung** Abschnitt finden wir ein **Benutzername** und ein **Passwort-Hash**:

* **Benutzer:** `svcMosh`
* **Hash:** `412DD4759978ACFCC81DEAB01B382403`

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

### **Hash-Knacken:**<br>

Wir verwenden **CrackStation** um den Hash zu entschlüsseln:

{% embed url="<https://crackstation.net/>" %}

**Entschlüsseltes Passwort:** `underwaterfriends`

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

**SSH-Verbindung:**/ Mit diesen Anmeldedaten greifen wir per SSH auf die Maschine zu:

```bash
ssh svcMosh@underpass.htb

underwaterfriends
```

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

## Privilegieneskalation

### SUDO - Mosh-Server

Beim Überprüfen der Berechtigungen mit dem `sudo -l` Befehl entdecken wir, dass der Benutzer **svcMosh** kann die **mosh-server** Binärdatei mit Administratorrechten ohne Passwort ausführen

```bash
sudo -l
```

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

> Da du die Möglichkeit hast, **mosh-server** als Root auszuführen, kannst du dies nutzen, um eine Verbindung mit **mosh** mit **sudo** den Server als Administrator auszuführen.

Der folgende Befehl wird **mosh-server** mit Root-Rechten ausführen und anschließend eine Verbindung mit dem **mosh** Client herstellen:

```bash
mosh --server="sudo /usr/bin/mosh-server" localhost
```

Dies wird es **mosh** ermöglichen, sich mit dem Server zu verbinden **mosh-server** der als Root auf **localhost**läuft. Mit dieser Methode erhältst du privilegierten Zugriff auf die Maschine mit Administratorrechten.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2e0b52c064410341185cadca3dbc89602379310d%2Fimage%20(857).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-6cf263c13eecefd18fcea5b82d6a19d8b0ddd025%2Fimage%20(859).png?alt=media" alt="" width="547"><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-d1c170714067e1e71a61f9a20224c7b8bfda7792%2Fimage%20(858).png?alt=media" alt="" width="522"><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/underpass-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.
