Hack The Box Writeup - Delivery
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/delivery-htb-cover.jpg?resize=720%2C340&ssl=1)
Delivery is easy box from Hack The Box (HTB). Those who don't know, HTB is online practice platform to learn penetration testing.
Summary
- Run nmap to find open ports
- As port 80 opens, check in browser
- Click on HelpDesk and Contact Us page
- Open a new ticket on HelpDesk page
- Click on Mattermost on Contact Us page
- Sign up using @delivery.htb email address on Mattermost generated after creation of new ticket
- Check Ticket Status
- Login on Mattermost
- Use username and password to SSH
- Found user.txt
- Check config file and found mysql username, password
- Login mysql and check User table
- Found username and hashed password (bcrypt)
- Use hashcat tool to decrypt password from hash
- SSH to box and found root.txt
Start with Nmap
nmap 10.10.10.222
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/nmap-ip.jpg)
Run default scripts available in Nmap Database using -sC option, -sV is used to enumerate versions
nmap -sC -sV 10.10.10.222
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/nmap-sC-SV.jpg)
Scan all ports with Nmap by using -p- options
nmap -p- 10.10.10.222
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/nmap-p-1.jpg)
Run UDP scan with Nmap by using -sU option
nmap -sU 10.10.10.222
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/nmap-udp-1.jpg)
Do below entry in /etc/hosts
10.10.10.222 delivery.htb
Browse http://delivery.htb on Firefox
http://delivery.htb
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/delivery-htb-2.jpg)
Click on Contact us.
Read message on page carefully
"For unregistered users, please use our HelpDesk to get in touch with our team. Once you have an @delivery.htb email address, you'll be able to have access to our MatterMost server."
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/delivery-contactus-htb.jpg)
As mentioned in webpage, Click on HelpDesk.
Click on Open a New Ticket
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/helpdesk-delivery-htb-1.jpg)
Fill form and Create a new ticket. You received a below message after successful creation of ticket.
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/help-desk.jpg)
Click on MatterMost server. As you don't have a account, Click on Create one now. Remember to use @delivery.htb email id for creation of account.
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/delivery-htb-8065-1.jpg)
After successful creation of account, Check status again and you got a new message.
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/test-issue-summary.jpg)
As suggest in message, activate email by copying url and paste it in browser. You got below message if you have paste correctly.
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/mattermost-email-verified.jpg)
After successful login, Found credentials to the server.
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/mattermost-internal-1.jpg?resize=1024%2C485)
As SSH port is also open, use credentials to connect remote host.
ssh maildeliverer@10.10.10.222
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/ssh-user-1.jpg)
Just do ls and you found user.txt flag.
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/user-1.jpg)
Privilege escalation
For privilege escalation, check config file. Config file contains a mysql username and password
Refer /opt/mattermost/config/config.json. Use below command for mysql credentials:
cat /opt/mattermost/config/config.json | grep user
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/db-password-1.jpg?resize=1024%2C47)
Connect mysql
mysql -u mmuser -p
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/mysql-db.jpg)
Display available databases
show databases;
Use database mattermost
use mattermost;
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/database-mattermost.jpg)
Use below command to display tables and Users table seems to be interesting.
show tables;
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/show-tables.jpg)
Just display username and password from table Users
select Username, Password from Users;
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/root-password-db.jpg)
Save username and password in hash file. If you rehttp://allabouttesting.org/wp-content/uploads/2021/05/root-password-db.jpgfer messages, last message is saying related to password "PleaseSubscribe!"
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/mattermost-internal-1.jpg?resize=1024%2C485)
Save it in file password.
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/hash-password.jpg)
Use hashcat command to create a wordlist and bruteforce to find match of exact password.
hashcat -m 3200 hash password --
user -r /usr/share/hashcat/rules/best64.rule
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/hashcat-1.jpg?resize=1024%2C573)
Finally got matched password
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/hashcat-2.jpg)
Now just type su - to root
su -
![](https://i0.wp.com/allabouttesting.org/wp-content/uploads/2021/05/root.jpg)
Subscribe us to receive more such articles updates in your email.
If you have any questions, feel free to ask in the comments section below. Nothing gives me greater joy than helping my readers!
Disclaimer: This tutorial is for educational purpose only. Individual is solely responsible for any illegal act.