_blackb3ard/pwn_exhibit$

pwn notes from an exploit dev wannabe

Home CTF Writeups

HackTheBox: Delivery

TL;DR

Skills Learned

Reconnaisance

Starting of with a simple nmap scan, we see two open ports namely ssh and http:

Browsing into the website reveals not much that can be potentially exploited. Running scans using gobuster did not find any directories.

Ticket Tricks

Searching for vulnerabilities/exploits on OSTicket (which is used by the helpdesk) didn’t return much that we can use. Playing around by creating a support ticket gives us a potential tool for our attack as it gives us our very own @delivery.htb email address.

To view this confirmation email, we can simply view the status of our ticket on the helpdesk:

Foothold + User

Now that we have access to the mattermost server, we can continue to view their ‘internal’ channel and there we are presented with credentials and some hints regarding password variations.

We can use the maildeliverer:Youve_G0t_Mail! credential to login into the box using ssh and from this foothold we can simply get the user.txt file.

Privesc, pt.1

While doing some manual enumeration on the file system, we can find another set of credentials in the mattermost configuration files, this time credentials to the mysql database where mattermost stores its user data.

With simple query work, we can retrieve the password hashes of all the users in the mattermost instance.

Privesc, pt.2

Now it boils down to the task of cracking the root hash. If we recall the message on the internal channel: 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.

I decided to use the d3adhob0 ruleset which took quite some time to crack it, but crack it it did. Command used: hashcat -a 0 -m 3200 root.hash rockyou.txt -r d3adhob0.rule -o cracked.hash

Took almost an hour, but it’s worth the wait as it cracked the hash and returned the password as PleaseSubscribe!21. We can now use this password to su into the root account of the box and get the corresponding flag.

Resources

How I hacked hundreds of companies through their helpdesk