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

# Delivery HackTheBox攻略記事

仮想ホスティング列挙、サポートチケットシステムの悪用、MatterMostへのアクセス、情報漏えいを扱うDelivery HackTheBox Easy Linuxマシンの攻略記事。実践的な列挙、侵入、

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

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

* 仮想ホスティングの列挙
* サポートチケットシステムの悪用
* Mattermost へのアクセス
* 情報漏えい
* データベース列挙 - MySQL
* ハッシュのクラック
* パスワードを作成するために hashcat ルールを使う
* sucrack を使ってユーザーのパスワードを見つける
  {% 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-79ad628220f3b172b553e1dc5ce6b3400861b925%2F%7B1C1F20B5-D840-4482-B0D2-8A05EADEA5E0%7D.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-b9bf9ee46870fbf2b852a30c03f74eb47b3d3221%2Fimage%20(750).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**Nmap による開いているポートの検出:**

開いているポートを列挙し、結果を Nmap ディレクトリ内の「allPorts」ファイルに出力します:

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

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-8a74350f3eb119a8afbc3b7d2819280420081066%2F%7B91218D2F-9795-451B-A2D3-A7DA3C8D2E7B%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**extractPorts による開いているポートの分析:**

extractPorts 関数を使って開いているポートを簡潔な形式で表示し、クリップボードにコピーする（22,80,8085）

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3c4ab49ed40299ac3a2a48dff61cbded587ddee5%2F%7BC0B865A9-8259-4251-8974-92367092021F%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**Nmapによるポートバージョンスキャン：**

Nmap を使ってサービスのバージョンをスキャンし、出力を「targeted」ファイルに保存します:

```bash
nmap -sCV -p22,80,8065 10.10.10.222 -oN targeted
```

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

### ポート80:

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-dd8d6212f4c55c0d8aae0f42acd1d8d497ffeccf%2F%7B7E0DE2F5-EC9E-4BD4-91C5-B604E84601EC%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**WhatWeb による情報の特定:**

WhatWeb を実行するとユーザーが判明する **jane** メールアドレスは **<jane@untitled.tld>**.

```bash
whatweb 10.10.10.222
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ef7311d43754d35ef1fdcf99bcc463e04cd6ece9%2F%7BA379B407-C232-4203-BE82-1B31B7164832%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

また、ドメインも見つかる **delivery.htb** そしてサブドメイン **helpdesk.delivery.htb**.

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

**/etc/hosts ファイルの設定**

ターゲットの IP アドレスを私たちの `/etc/hosts` ローカル DNS 解決を容易にするためのファイルに追加する。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ea165e2aca091b10679d66b67ae5190fad15adb2%2F%7B929EEA18-AAD2-4AF3-A7A0-BDD4BF829C7A%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

## **サポートセンター - HelpDesk：**

その `helpdesk.delivery.htb` このサブドメインではサポートチケットを作成できます。次の情報でアカウントを作成しようとしています：

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2ffd217d03f72db81c67d2f5ff2ea6ab2e6d9c5e%2F%7BD0BF59CE-783B-4519-9920-BFD438BE8AC4%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**チケットを開く**

* `jordan@delivery.com`

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-60b0971cd95ec0b95870385c73d16f17feb6d9f0%2F%7BE9D3738A-F8BD-442F-A91B-AD3077C4FDAA%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

新しいチケットが開かれ、識別子を含むメールが届く：

* **メール** : <7990131@delivery.htb>
* **チケット ID**: 7990131

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2a05ab9277d075949b8335bae7d2eb3b499a121a%2F%7B744DC8C7-DE38-4AE0-8091-C986BC92526A%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

チケットを確認するときは、自分のメールアドレス（**<jordan@delivery.com>**）を使います。これは作成していませんが、受け取ったチケット番号（**7990131**).

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f0a663c7e76fff980c0163082272fc83b67616a0%2Fimage%20(754).png?alt=media" alt=""><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-0d04d5aee74f7725b3ce5f99479dd88d4706cb51%2F%7BF765C4C1-6CC7-4158-8A2F-8BFD11836AE4%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### ポート 8065 - Mattermost

**Mattermost の発見:**

ポート **8065** をホストしている **Mattermost** CMS。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d03beed59a0fe2b08233f92c0ea79307e535800d%2F%7B74803BDD-4207-423C-8AC2-DD0756456E5B%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**アカウントの作成を試みる:**

アカウントを作成しようとして、その後メールアドレス: <7990131@delivery.htb>、名前: jordan1、パスワード: Jordan1234# を使用します

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-14ed6fb9f657eb4cd89d2ba69fa2a30a8d685221%2F%7B08E0C8B3-F7E1-43BA-B28A-8CAAA206B347%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

検証メッセージを受信し、そこには **token** アカウントを有効化するための

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-80e4bccfe75fa0f66111bae824df89aed37670e6%2F%7BF545C6A6-80E3-49A4-BC01-CCDCEEC92F19%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

{% code overflow="wrap" %}

```
http://delivery.htb:8065/do_verify_email?token=hs36amqfpkm3hcguxsmrton83e7a9k7xp595rga6zhwzd35awf1krpftfqink3go&email=7990131%40delivery.htb 
```

{% endcode %}

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-227fca13f3d9885b9a577961d587a2c5fbd4ac5e%2F%7B0231EB37-8E78-4441-AEC8-73D3796A5582%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

検証後、資格情報でログインし、Mattermost の **管理パネルにアクセスする**.

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-da7e288869b98202ba8c4018ff15d937e0493c4a%2F%7B9A62E0C9-F9A7-4243-AB2C-A76090AC0618%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**資格情報の回収**

その **「チャンネルを切り替える」** セクションで、ユーザー名とパスワードを含むメッセージを見つける：

* **ユーザー名**: `maildeliverer`
* **パスワード**: Youve/\_G0t/\_Mail!

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

その後、これらの資格情報で SSH 接続を試みる：

```bash
ssh maildeliverer@delivery.htb
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-646566bd8126b49ca038c67d77c8051e8cc885f7%2F%7B508B9289-B626-4B26-8F8B-41372EE0148E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### フラグ user.txt :)

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e514e780cc3a8d545d8177da4591fc08a9725da2%2F%7B53F43C13-99E5-4DE3-8182-78E8398EAD51%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

## **権限昇格**

システムのルートへ移動し、 `/var/www/html/osticket` フォルダ内で、単語 **パスワード**:

```bash
grep -ir "password"
```

特に興味深いものは見つからない。

これから、次の情報を探す： **Mattermost** 実行中のプロセスを絞り込むことで：

```bash
ps -faux
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-50dad9f9d5b851685ef9893776491ebdecd1ac58%2F%7B5CC7E834-B210-45C9-9EF2-31FCC3A089A5%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Mattermost が次の場所にインストールされていることに気づく `/opt` そして **config.json** ファイルに存在するユーザーに対して試します。

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

開くと、SQL データベースの資格情報が見つかる：

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

* ユーザー名: `mmuser`
* パスワード: `Crack_The_MM_Admin_PW`

### MySQL への接続

これらの資格情報を使ってデータベースに接続する：

```bash
mysql -u mmuser -p
```

データベースを一覧表示する：

```sql
show databases;
use mattermost
```

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

利用可能なテーブルを一覧表示し、次の構造を確認する： **ユーザー** テーブル:

```sql
show tables;
describe Users;
```

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

最後に、次を選択する： **ユーザー名** および **パスワード** 列:

```sql
select Username, Password from Users;
```

その結果、次が見つかる： **root のパスワードのハッシュ：**

`$2a$10$VM6EeymRxJ29r8Wjkr8Dtev0O.1STWb4.4ScG.anuu7v0EFJwgjjO`

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

### 1. 総当たり攻撃 - ハッシュ

次を使用します **hashid** ハッシュの種類を識別するには:

```bash
hashid ハッシュ
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-8448e0fe7b5464461840cdfa5e400bc18bc52aec%2F%7B1694F1C2-3C17-42FB-9D7D-9BF0B3B59F4C%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

このハッシュは次のように識別されます **bcrypt**.

次の **John the Ripper**、次を指定して総当たり攻撃を開始する： **bcrypt** 形式：

```bash
john --format=bcrypt hash -w /usr/share/wordlists/rockyou.txt
```

しかし、次ではうまくいかない： **rockyou.txt**、パスワードは見つからない。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-817634bd743225fbfa7615f86df4ce121ba09fff%2F%7B38E73751-9A32-4FF2-8775-74B6670BA6A1%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

グループチャットを観察すると、パスワードが **「PleaseSubscribe!」** が再利用されていると直接述べていることに気づく。このパスワードは **rockyou.txt**には見当たらないが、攻撃者は **hashcat** を使って派生形を生成できる。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-8b663765f8ae1a6da874930ff669e4ba5ea7fea4%2F%7BE041B89E-F414-4042-9D2A-D44922A37A3B%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### パスワードのバリエーション - Hashcat

**Hashcatによるバリアントの生成**

次の **hashcat**、パスワードのバリエーションを作成します:

```bash
hashcat --stdout -r /usr/share/hashcat/rules/best64.rule password
```

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

次に、以下を使用してハッシュのクラックを試みます **hashcat** および新しい辞書を使用して:

```bash
hashcat -m 3200 -a 0 hash passwords
```

見つかったパスワードは: **PleaseSubscribe!21**

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

### 2. 「su」に対する総当たり攻撃 - sucrack

〜に対して攻撃を開始します **su**:

```bash
sucrack -w 20 -u root passwords
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-aa63c15efc8aa14c8aa278bec6dab271b1f171be%2F%7B13E1E46B-97BA-494D-A41B-77447BA3BFCB%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

これでパスワードが正しいことがわかります： **PleaseSubscribe!21**

〜として正常にログインしました **root**.

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-27f90a751a4d03bfb14d167b2b9808e8c2200480%2Fimage%20(743).png?alt=media" alt="" width="563"><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-ad23ad300c58f5976ba5d5f1cc18f111f1b89fa1%2Fimage%20(744).png?alt=media" alt="" width="530"><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-007cdc3dcb7f5c727487ac11fd1c5efda78991ee%2F%7BC516A959-09B3-4DAB-B667-FB312770BC66%7D.png?alt=media" alt="" width="498"><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/delivery-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.
