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

# Underpass HackTheBox攻略記事

UDP列挙、デフォルト資格情報（DaloRADIUS）、パスワードクラック、SUDO（mosh-server）経由の権限昇格を扱うUnderpass HackTheBox Easy Linuxマシンの攻略記事。実践的な列挙、

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

{% hint style="warning" %}
**スキル:**

* UDP列挙
* デフォルト認証情報（DaloRADIUS）
* パスワードのクラック
* SUDOによる権限昇格（mosh-server）
  {% endhint %}

## 偵察

**作業環境の設定:**

重要なコンテンツ、エクスプロイト、Nmap の偵察結果を保存するために、3つのフォルダを作成して作業環境を整えます。

<figure><img src="https://2001299964-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://2001299964-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://2001299964-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://2001299964-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://2001299964-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://2001299964-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://2001299964-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** 見つかる。
* というCMSである **DaloRADIUS** が確認されます。

## CMS - **DaloRADIUS**

<figure><img src="https://2001299964-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://2001299964-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://2001299964-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 **ユーザー向けログインページ**.

<figure><img src="https://2001299964-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 **オペレーター向けログインページ**.

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

### **機密情報の抽出:**

その **管理** セクションで、次を見つけます: **username** と **パスワードハッシュ**:

* **ユーザー:** `svcMosh`
* **ハッシュ:** `412DD4759978ACFCC81DEAB01B382403`

<figure><img src="https://2001299964-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://2001299964-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://2001299964-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://2001299964-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** サーバーを管理者として実行する接続を確立できます。

次のコマンドで **mosh-server** root権限で実行し、その後 **mosh** クライアントに接続します:

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

これにより **mosh** サーバーに接続できるようになります **mosh-server** がrootとして実行されている **localhost**。この方法を使えば、管理者権限でマシンへの特権アクセスを得られます。

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