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

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

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

* UDP-Enumerierung
* Standardanmeldeinformationen (DaloRADIUS)
* Passwortknacken
* Privilegieneskalation via SUDO (mosh-server)
  {% 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/2fa9b24fa990854ed6d7c219a1fd4305fc7fe529" 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/2d984aa8fe0c51f9663c287aa1d56307d4ec4d35" alt="" width="563"><figcaption></figcaption></figure>

### TCP

**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 -vvv --min-rate 5000 10.10.11.48 -oG allPorts
```

<figure><img src="/files/fe89255635916a1b30009ffae47076f54acc902c" alt=""><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,80 10.10.11.48 -oN targeted
```

<figure><img src="/files/4553801e98286895afa6ea85bbdeb728c42588df" alt=""><figcaption></figcaption></figure>

### UDP

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

Wir führen einen Scan der 100 gängigsten UDP-Ports durch:

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

<figure><img src="/files/39a147af8d7fa4cd101a3bdbd909a22a17982dbc" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/45a8611991a53136ff14bcd0f53c2b241563df09" alt=""><figcaption></figcaption></figure>

**UDP-Dienstversions-Scan:**/ Wir untersuchen die identifizierten Ports für zusätzliche Informationen:

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

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

**Erste Beobachtung:**

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

## CMS - **DaloRADIUS**

<figure><img src="/files/d91f5e49ebda8aa67417705a92dce664c71fc3a0" 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="/files/844d31646bb6cd22c174cf670d5fa3bfa454f46f" 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="/files/7551ca9d99c5a7a814d598344597e2517dcd5d1c" alt=""><figcaption></figcaption></figure>

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

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

* Eine **Login-Seite für Operatoren**.

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

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

* **Benutzername:** `Administrator`
* **Passwort:** `radius`/ Diese Anmeldedaten funktionieren im Operator-Panel.

<figure><img src="/files/510b5aae249ca1c163670883b7330b0b163ec4cc" alt=""><figcaption></figcaption></figure>

### **Extraktion sensibler Informationen:**

In dem **Verwaltung** Bereich finden wir ein **Benutzernamen** und einen **Passworthash**:

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

<figure><img src="/files/d8c2d1c925f6ca0cdf2e9093d16858951c599e32" 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="/files/0b00bf687dddeda6c3bc7f8abf20a712d5ba4b57" 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="/files/f98ee0a37924805f5e1b2026eb01421f89a064f2" alt="" width="563"><figcaption></figcaption></figure>

## Privilegieneskalation

### SUDO - Mosh-Server

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

```bash
sudo -l
```

<figure><img src="/files/35de12463c9c2098767a2382fc75a49bc6af17b1" alt=""><figcaption></figcaption></figure>

> Da Sie die Möglichkeit haben, **mosh-server** als root auszuführen, können Sie dies nutzen, um eine Verbindung mit **mosh** mit **sudo** den Server als Administrator auszuführen.

Der folgende Befehl führt **mosh-server** mit Root-Rechten aus und stellt dann eine Verbindung mit dem **mosh** Client her:

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

Dies ermöglicht es **mosh** mit dem Server zu verbinden **mosh-server** der als Root auf **localhost**. Mit dieser Methode erhalten Sie privilegierten Zugriff auf die Maschine mit Administratorrechten.

<figure><img src="/files/961491ff61267e5b0748ee3d3020afa6df5dc05b" alt=""><figcaption></figcaption></figure>

### Flag root.txt :)

<figure><img src="/files/5924af5e6b41359d55543b19f15203753e4c5c40" alt="" width="547"><figcaption></figcaption></figure>

<figure><img src="/files/80e90fb194cdd3f6197ed10ae367e8576a449762" 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 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/underpass-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.
