> 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 解题报告

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

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

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

## 侦察

**工作区设置：**

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

<figure><img src="/files/448d3d1a9f4ae6d10adc070a09f5fdf60226348b" alt="" width="563"><figcaption></figcaption></figure>

**VPN 连接检查**

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

<figure><img src="/files/e4c63c4b0d69547b1aa08a5a04be5868c0306080" 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="/files/56cc29b81c77405f659fbc07f5d5573c4540bf8c" alt=""><figcaption></figcaption></figure>

**使用 extractPorts 分析开放端口：**

使用 extractPorts 函数以简洁格式显示开放端口，并将它们复制到剪贴板（22,80,8085）

<figure><img src="/files/7a0c527e2fb93dd2963e164691b8309210642e73" alt="" width="563"><figcaption></figcaption></figure>

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

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

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

<figure><img src="/files/ce17890cdc3d2e9957d0ac19080656564161c3bf" alt=""><figcaption></figcaption></figure>

### 80 端口：

<figure><img src="/files/8d055d4109ceab73f2aedc676ba6852a9868c434" alt=""><figcaption></figcaption></figure>

**使用 WhatWeb 识别信息：**

运行 WhatWeb 后发现一个用户 **jane** 以及电子邮件地址 **<jane@untitled.tld>**.

```bash
whatweb 10.10.10.222
```

<figure><img src="/files/e7b5a8d2ef32ce736ccd51019baa9af9fafc698b" alt=""><figcaption></figcaption></figure>

我们还找到了一个域名 **delivery.htb** 以及一个子域名 **helpdesk.delivery.htb**.

<figure><img src="/files/d981af9ec82caf6670ae6bfc5e6676a3fe22e97b" alt="" width="563"><figcaption></figcaption></figure>

**/etc/hosts 文件的配置**

我们将目标的 IP 地址添加到我们的 `/etc/hosts` 文件中，以便于本地 DNS 解析。

<figure><img src="/files/122b67d8ed9bcb6503f6b0785060b19fb9f931f2" alt="" width="563"><figcaption></figcaption></figure>

## **支持中心 - HelpDesk：**

该 `helpdesk.delivery.htb` 该子域名允许你创建支持工单。我们尝试使用以下信息创建一个账户：

<figure><img src="/files/c1b77e2019d9e1caa40beef909a69a7f582d6b44" alt=""><figcaption></figcaption></figure>

**打开工单**

* `jordan@delivery.com`

<figure><img src="/files/8b9298ae7d73fb78a851971a66c9d3769aebfda4" alt=""><figcaption></figcaption></figure>

一个新工单被打开，我们收到一封包含标识符的电子邮件：

* **电子邮件** : <7990131@delivery.htb>
* **工单 ID**: 7990131

<figure><img src="/files/c1165b0ae2bc607978ba9a8e4b16f8e6158a420c" alt=""><figcaption></figcaption></figure>

在检查工单时，我们使用自己的电子邮件地址（**<jordan@delivery.com>**），尽管它不是我们创建的，以及收到的工单编号（**7990131**).

<figure><img src="/files/66d7206aff02cbc487e01778082e603ca1333906" alt=""><figcaption></figcaption></figure>

这使我们能够访问相关邮箱。

<figure><img src="/files/bb9243bae95a1524facb97fda923afa84986d6ce" alt=""><figcaption></figcaption></figure>

### 8065 端口 - Mattermost

**Mattermost 的发现：**

端口 **8065** 托管了一个 **Mattermost** CMS。

<figure><img src="/files/cabac4f9b50ad62eec48df0c844947d3034244fe" alt=""><figcaption></figcaption></figure>

**尝试创建账户：**

我们尝试创建一个账户，然后使用以下电子邮件地址：<7990131@delivery.htb>，名称：jordan1，密码 Jordan1234#

<figure><img src="/files/53c80e3bd83dfb02a686c75e1f5f203383448dc6" alt=""><figcaption></figcaption></figure>

我们收到一条包含一个 **令牌** 用于激活账户的验证消息：

<figure><img src="/files/7aef93d0c2ad7bd2269b6431720e61f3795a9022" 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="/files/ebdd4c7b1b8d2d7fd023f3fedad8018683adcec2" alt=""><figcaption></figcaption></figure>

验证后，我们使用凭据登录并访问 Mattermost **管理面板**.

<figure><img src="/files/9890026d704304de88fadae86737b04936411e0e" alt=""><figcaption></figcaption></figure>

**凭据恢复**

在 **“切换频道”** 部分中我们找到一条包含用户名和密码的消息：

* **用户名**: `maildeliverer`
* **密码**: Youve/\_G0t/\_Mail!

<figure><img src="/files/aa84955c855c2a87bc6458044db3bd1caf8a5311" alt=""><figcaption></figcaption></figure>

然后我们尝试使用这些凭据进行 SSH 连接：

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

<figure><img src="/files/dc2ce588faa8fe03d799ed0a1698dc3f43b22ea8" alt=""><figcaption></figcaption></figure>

### user.txt 标志 :)

<figure><img src="/files/021ca505334148c18851a0b1519ef53ab4e798ac" alt="" width="563"><figcaption></figcaption></figure>

## **权限提升**

我们进入系统根目录，在 `/var/www/html/osticket` 文件夹中，并按单词筛选 **密码**:

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

我们没有找到任何有趣的内容。

现在我们将通过以下方式筛选运行中的进程来搜索 **Mattermost** 的信息：

```bash
ps -faux
```

<figure><img src="/files/00a3c1e6739670238e6800bd5cad37f7d000fe87" alt=""><figcaption></figcaption></figure>

我们注意到 Mattermost 安装在 `/opt` 并找到一个 **config.json** 文件中的用户进行测试。

<figure><img src="/files/66e06a6b5d85b71750563f727656ed3bbddd47de" alt=""><figcaption></figcaption></figure>

打开后，我们发现了 SQL 数据库的凭据：

<figure><img src="/files/16106c3c40fa3d091ceec0f4b1dcd744e2953073" alt=""><figcaption></figcaption></figure>

* 用户名： `mmuser`
* 密码： `Crack_The_MM_Admin_PW`

### 连接到 MySQL

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

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

我们列出数据库：

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

<figure><img src="/files/dd50485831b68a8965cbf5f9dfae646b8ee06d30" alt="" width="563"><figcaption></figcaption></figure>

我们列出可用的表，并描述该表的结构 **Users** 表：

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

<figure><img src="/files/c7e3caf6e35aea84b380b9b5e485fbc80fd01c33" alt=""><figcaption></figcaption></figure>

最后，我们选择 **用户名** 和 **密码** 列：

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

然后我们找到了 **root 密码的哈希：**

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

<figure><img src="/files/6b6052d93259e788627354381f8fec4b6716c36b" alt=""><figcaption></figcaption></figure>

### 1. 暴力破解 - 哈希

我们使用 **hashid** 用于识别哈希类型：

```bash
hashid 哈希
```

<figure><img src="/files/9beb9b2468f7da2d54e9d237224c72800d6de67f" 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="/files/e4e124ed6f1427058685a32f0d045cc16351dfdd" alt=""><figcaption></figcaption></figure>

观察群聊时，我们注意到他们直接说密码 **"PleaseSubscribe!"** 被重复使用了。这个密码并不出现在 **rockyou.txt**中，但黑客可以使用 **hashcat** 来生成变体。

<figure><img src="/files/83889d5dae5d70700f62037bcc5a5394afb7708b" alt=""><figcaption></figcaption></figure>

### 密码变体 - Hashcat

**使用 Hashcat 生成变体**

使用 **hashcat**，我们将创建密码的变体：

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

<figure><img src="/files/2f43318ad701bf34657f42448dac8a475a9cbbc8" alt=""><figcaption></figcaption></figure>

然后我们将尝试使用 **hashcat** 以及新字典：

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

找到的密码是： **PleaseSubscribe!21**

<figure><img src="/files/68a1c8485ac085fe042d1b48d280cf5a6501d612" alt=""><figcaption></figcaption></figure>

### 2. 对 "su" 进行暴力破解 - sucrack

我们将对……发起攻击 **su**:

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

<figure><img src="/files/6a9eda2d29d7269dd837300120e4ce1f162dbaa2" alt=""><figcaption></figcaption></figure>

这告诉我们密码是正确的： **PleaseSubscribe!21**

我们成功以……身份登录 **root**.

<figure><img src="/files/a323713f6dee92576f893ca0c1b31ab08d8fd590" alt="" width="563"><figcaption></figcaption></figure>

### root.txt flag :)

<figure><img src="/files/12d6a749529f81960bf9a834cb4763d528613090" alt="" width="530"><figcaption></figcaption></figure>

<figure><img src="/files/6de38634025635f0e3c9785498c568b36de2e78b" 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/zh/writeups-ctf/hackthebox/linux-easy/delivery-hackthebox-writeup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
