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

# Delivery HackTheBox Writeup

Delivery HackTheBox Easy Linux machine writeup covering Virtual Hosting Enumeration, Abusing Support Ticket System, Access to MatterMost, Information Leakage, with practical enumeration, exploitation,

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

{% hint style="warning" %}
**Skills:**

* Virtual Hosting Enumeration
* Abusing Support Ticket System
* Access to MatterMost
* Information Leakage
* Database Enumeration - MYSQL
* Cracking Hashes
* Playing with hashcat rules in order to create passwords
* Playing with sucrack to find out a user's password
  {% endhint %}

## Reconnaissance

**Workspace Setup:**

Set up the workspace by creating three folders to store important content, exploits, and Nmap reconnaissance results.

<figure><img src="https://131707722-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 Connectivity Check**

Check VPN connectivity to ensure stable communication with the target machine.

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

**Open Port Discovery with Nmap:**

Enumerate open ports and export the results to the "allPorts" file in the Nmap directory:

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

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

**Open Port Analysis with extractPorts:**

Use the extractPorts function to display open ports in a concise format and copy them to the clipboard (22,80,8085)

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

**Port Version Scan with Nmap:**

Use Nmap to scan service versions and save the output in the "targeted" file:

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

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

### Port 80:

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

**Identification of information with WhatWeb:**

Running WhatWeb reveals a user **jane** with the email address **<jane@untitled.tld>**.

```bash
whatweb 10.10.10.222
```

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

We also find a domain **delivery.htb** and a subdomain **helpdesk.delivery.htb**.

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

**Configuration of the /etc/hosts file**

We add the target's IP address to our `/etc/hosts` file to facilitate local DNS resolutions.

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

## **Support Center - HelpDesk :**

The `helpdesk.delivery.htb` subdomain allows you to create support tickets. We are trying to create an account with the following information:

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

**Opening a Ticket**

* `jordan@delivery.com`

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

A new ticket is opened, and we receive an email containing an identifier:

* **Email** : <7990131@delivery.htb>
* **Ticket ID**: 7990131

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

When checking the ticket, we use our own email address (**<jordan@delivery.com>**), although we did not create it, as well as the number of the ticket received (**7990131**).

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

This allows us to access the associated mailbox.

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

### Port 8065 - Mattermost

**Discovery of Mattermost:**

Port **8065** hosts a **Mattermost** CMS.

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

**Attempting to create an account:**

We are trying to create an account, we then use the email address: <7990131@delivery.htb> name: jordan1 password Jordan1234#

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

We receive a verification message containing a **token** to activate the account:

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

After validation, we connect with our credentials and access the Mattermost **management panel**.

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

**Recovery of credentials**

In the **"Switch Channels"** section we find a message containing a username and password:

* **Username**: `maildeliverer`
* **Password**: Youve/\_G0t/\_Mail!

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

We then attempt an SSH connection with these credentials:

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

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

### Flag user.txt :)

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

## **Privilege Escalation**

We go to the root of the system, in the `/var/www/html/osticket` folder, and we filter by the word **password**:

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

We don't find anything interesting.

We will now search for information for **Mattermost** by filtering the running processes:

```bash
ps -faux
```

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

We notice that Mattermost is installed in `/opt` and find a **config.json** file.

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

Opening it, we discover credentials for the SQL database:

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

* Username: `mmuser`
* Password: `Crack_The_MM_Admin_PW`

### Connecting to MySQL

We use these credentials to connect to the database:

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

We list the databases:

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

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

We list the available tables and describe the structure of the **Users** table:

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

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

Finally, we select the **Username** and **Password** columns:

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

We then find the **hash of root's password:**

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

<figure><img src="https://131707722-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. Brute Force - Hash

We use **hashid** to identify the hash type:

```bash
hashid hash
```

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

The hash is identified as **bcrypt**.

With **John the Ripper**, we will launch a brute force attack by specifying the **bcrypt** format:

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

However, it doesn't work with **rockyou.txt**, no password found.

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

Observing the group chat, we notice that they directly say that the password **"PleaseSubscribe!"** is reused. This password does not appear in **rockyou.txt**, but a hacker could use **hashcat** to generate variations.

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

### Password Variants - Hashcat

**Generation of variants with Hashcat**

With **hashcat**, we will create variations of the password:

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

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

We will then attempt to crack the hash using **hashcat** and the new dictionary:

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

The password found is: **PleaseSubscribe!21**

<figure><img src="https://131707722-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. Brute Force on "su" - sucrack

We will launch an attack against **su**:

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

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

It tells us that the password is correct: **PleaseSubscribe!21**

We successfully log in as **root**.

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

### Flag root.txt :)

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