CPTS labs - 01 Getting Started
Getting Started
Pentesting Basics
Service scanning
Perform an Nmap scan of the target. What does Nmap display as the version of the service running on port 8080?
Results: Apache Tomcat
Perform an Nmap scan of the target and identify the non-default port that the telnet service is running on.
Results: 2323
List the SMB shares available on the target host. Connect to the available share as the bob user. Once connected, access the folder called 'flag' and submit the contents of the flag.txt file.
Results: dceece590f3284c3866305eb2473d099
Web Enumeration
Try running some of the web enumeration techniques you learned in this section on the server above, and use the info you get to get the flag.
Go to http://94.237.55.246:55655/robots.txt and you will notice http://94.237.55.246:55655/admin-login-page.php
Visit it and, hardcoded in the site you will see:
Login into the app.
Results: HTB{w3b_3num3r4710n_r3v34l5_53cr375}There are many retired boxes on the Hack The Box platform that are great for practicing Metasploit. Some of these include, but not limited to:
Public Exploits
Access to the web app at http://ip:36883
The title of the wordpress post is "Simple Backup Plugin 2.7.10", which is a well-known vulnerable plugin.
Results: HTB{my_f1r57_h4ck}
Privilege Escalation
SSH to $ip with user "user1" and password "password1". SSH into the server above with the provided credentials, and use the '-p xxxxxx' to specify the port shown above. Once you login, try to find a way to move to 'user2', to get the flag in '/home/user2/flag.txt'.
Results: HTB{l473r4l_m0v3m3n7_70_4n07h3r_u53r}
Once you gain access to 'user2', try to find a way to escalate your privileges to root, to get the flag in '/root/flag.txt'.
Once you are user2, go to /root:
So we have read access in .ssh folder. We can access and copy the private key
In our attacker machine we save that id_rsa key in our folder
And now we can login as root
And cat the flag:
Results: HTB{pr1v1l363_35c4l4710n_2_r007}
Attacking your first box
Nibbles - Enumeration
Run an nmap script scan on the target. What is the Apache version running on the server? (answer format: X.X.XX)
Results: 2.4.18
Nibbles - Initial Foothold
Gain a foothold on the target and submit the user.txt flag
Enumerate resources
There are a lot of directory listing enabled. And eventually we can browser to: http://$ip/nibbleblog/content/private/users.xml
We can identify the user admin.
We could also enumerate http://$ip/nibbleblog/admin.php
Login access is admin:nibbles.
Go to Plugins tab and locate MyImage one: http://$ip/nibbleblog/admin.php?controller=plugins&action=config&plugin=my_image
Upload a PHP reverse shell, go to http://$IP/nibbleblog/content/private/plugins/my_image/
Set a netcat listener
Click on the reverse shell "image.php" and we will get a reverse shell.
Results: 79c03865431abf47b90ef24b9695e14879c03865431abf47b90ef24b9695e148
Nibbles - Privilege Escalation
Escalate privileges and submit the root.txt flag.
Results:
The nibbler
user can run the file /home/nibbler/personal/stuff/monitor.sh
with root privileges. Being that we have full control over that file, if we append a reverse shell one-liner to the end of it and execute with sudo
we should get a reverse shell back as the root user.
In the attacker machine, open a new netcat:
Run monitor.sh with sudo
In the new netcat connection you are root.
Results: de5e5d6619862a8aa5b9b212314e0cdd
Alternative way: Metasploit
Knowledge Check
Spawn the target, gain a foothold and submit the contents of the user.txt flag.
Go to http://$ip/robots.txt
Go to http://$ip/admin
Enter admin:admin
Go to Edit Theme: http://$ip/admin/theme-edit.php
Add a pentesmonkey shell and set a netcat listener on port 1234
Add gettingstarte.htb to your hosts file
Open the blog and you will get a reverse shell
Results: 7002d65b149b0a4d19132a66feed21d8
After obtaining a foothold on the target, escalate privileges to root and submit the contents of the root.txt flag.
Check out our permissions
Results:
Grab a simple php reverse shell such as:
Set up a netcat listener on port 4444:
Run as sudo:
You are root in the listener. Now
Results: f1fba6e9f71efb2630e6e34da6387842
Last update: 2025-01-26 Created: January 26, 2025 19:15:53