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

# Delivery HackTheBox 复盘

Delivery HackTheBox 简单 Linux 机器复盘，涵盖虚拟主机枚举、滥用支持工单系统、访问 MatterMost、信息泄露，并包含实用的枚举、利用、

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

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

* 虚拟主机枚举
* 滥用支持工单系统
* 访问 MatterMost
* 信息泄露
* 数据库枚举 - MySQL
* 破解哈希
* 使用 hashcat 规则生成密码
* 使用 sucrack 尝试找出某用户的密码
  {% endhint %}

## 侦察

**工作区设置：**

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

<figure><img src="https://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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`
* 密码： `破解_MM_管理员密码`

### 连接到 MySQL

我们使用这些凭据连接到数据库：

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

我们列出数据库：

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

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

我们列出可用的表并描述以下对象的结构： **Users** 表：

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

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

找到的密码是： **请订阅！21**

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

这告诉我们密码是正确的： **请订阅！21**

我们成功以 **root**.

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