> 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/writeups-ctf/hackthebox/linux-easy/underpass-hackthebox-writeup.md).

# Underpass HackTheBox Writeup

Underpass HackTheBox Easy Linux machine writeup covering UDP Enumeration, Default Credentials (DaloRADIUS), Password Cracking, Privilege Escalation via SUDO (mosh-server), with practical enumeration,

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

{% hint style="warning" %}
**Skills:**

* UDP Enumeration
* Default Credentials (DaloRADIUS)
* Password Cracking
* Privilege Escalation via SUDO (mosh-server)
  {% endhint %}

## Reconnaissance

**Workspace Setup:**

Set up the workspace by creating three folders to store important content, exploits, and Nmap reconnaissance results.

<figure><img src="https://131707722-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 Connectivity Check**

Check VPN connectivity to ensure stable communication with the target machine.

<figure><img src="https://131707722-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

**Open Port Discovery with Nmap:**

Enumerate open ports and export the results to the "allPorts" file in the Nmap directory:

```bash
nmap -p- --open -sS -n -Pn -vvv --min-rate 5000 10.10.11.48 -oG allPorts
```

<figure><img src="https://131707722-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 version scan with Nmap:

Use Nmap to scan service versions and save the output in the "targeted" file:

```bash
nmap -sCV -p22,80 10.10.11.48 -oN targeted
```

<figure><img src="https://131707722-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 of the most used UDP ports:**

We perform a scan of the 100 most common UDP ports:

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

<figure><img src="https://131707722-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>

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

<figure><img src="https://131707722-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 Service Version Scan :**/ We target the identified ports for additional information:

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

<figure><img src="https://131707722-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>

**Observation initiale :**

* The domain **underpass.htb** is discovered.
* A CMS named **DaloRADIUS** is identified.

## CMS - **DaloRADIUS**

<figure><img src="https://131707722-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>

**Scan directories with Gobuster:**/ We explore the website directories:

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

Result: a directory named **`/app`** is discovered.

<figure><img src="https://131707722-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>

**Listing of subdirectories:**<br>

By exploring **`/app`**, we find:

```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://131707722-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 page for users**.

<figure><img src="https://131707722-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 page for operators**.

<figure><img src="https://131707722-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>

**Access with DaloRADIUS default credentials:**/ By testing the default credentials for RADIUS:

* **Username:** `administrator`
* **Password:** `radius`/ These credentials work on the operator panel.

<figure><img src="https://131707722-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>

### **Sensitive Information Extraction:**

In the **Management** section we find a **username** and a **password hash**:

* **User:** `svcMosh`
* **Hash :** `412DD4759978ACFCC81DEAB01B382403`

<figure><img src="https://131707722-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 Cracking:**<br>

We use **CrackStation** to decrypt the hash:

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

**Decrypted password:** `underwaterfriends`

<figure><img src="https://131707722-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 connection:**/ With these credentials, we access the machine via SSH:

```bash
ssh svcMosh@underpass.htb

underwaterfriends
```

<figure><img src="https://131707722-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>

## Privilege Escalation

### SUDO - Mosh-Server

By checking permissions with the `sudo -l` command, we discover that user **svcMosh** can run the **mosh-server** binary with administrator privileges without providing a password

```bash
sudo -l
```

<figure><img src="https://131707722-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>

> Since you have the option to run **mosh-server** as root, you can leverage this to establish a connection with **mosh** using **sudo** to run the server as administrator.

The following command will run **mosh-server** with root privileges, then establish a connection with the **mosh** client:

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

This will allow **mosh** to connect to the server **mosh-server** which is running as root on **localhost**. Using this method you will have privileged access to the machine with administrator rights.

<figure><img src="https://131707722-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>

### Flag root.txt :)

<figure><img src="https://131707722-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://131707722-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/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.
