Vulnveristy
This room is based on basic learning related to reconnaissance, web app attacks and simple privilege escalation.
[Task 1] Deployment
The first and most important task is to deploy the machine on which we can perform the attacks and complete all the subsequent tasks. Once deployed, we are provided with the machine title, it's IP address and the time expiry time which can be extended as well.
[Task 2] Reconnaissance
As the name suggests this task is related to recon and the best tools for that is none other than nmap which is practiced in this task. A few nmap flags and their description are already provided but other than that man nmap
is always there for your help.
I read all the tasks and ran only a single command as it takes a lot of time to perform the nmap scan and running different commands for each and every question would consume a large amount of time. The command that can be used is: nmap -A -sV -p- -T4 <machine IP>
Flag
Description
-A
Performs OS and version detections, also check various in-built scripts
-sV
Performs service version detection
-p-
Checks all the open ports
-T4
Running speed at level 4 with 1 slowest and 5 fastest
Scan Result:
From the scan results, we get the following answers: 1. 6 ports are open 2. Squid version 3.5.12 is running 3. Ubuntu 4. The web server is running on port 3333
Answers to some other questions are: 1. -p-400
will check the first 400 ports 2. The flag -n
will not perform DNS resolution
[Task 3] GoBuster
This task is all about learning basics related to GoBuster which is a directory discovery tool. In case, if we don't have the tool on our attacking machine, in the task itself installation is explained. Moving forward, we run the GoBuster to check all the directories.
We run the following command to get a list of all the directories: gobuster dir -u http://<machine IP>:3333 -w <wordlist path>
Flag
Description
-u
To determine the URL that is to be enumerated
-w
To specify the path where our wordlist is stored
We are running the command on port 3333 as from nmap results we observed that the web server was running on that port itself. Otherwise, in a real-world scenario, we would usually go for ports 80 and 443.
GoBuster Result:
From the results, we can see that the form can be uploaded at: ./internal
.
[Task 4] Compromising Web Server
Now that we know a point from where we can enter into the target machine, we start testing various files that can be uploaded to the server. We can try files like .txt, .html, .md and other but the one that gets blocked is .php.
The next task is to create a list of files with various extensions that are mentioned and use it with Burp Intruder. After running the attack as described in the task, one extension is found to be allowed and that is .phtml.
As per the instructions on the task, we need to download the reverse PHP shell and perform the following task. 1. Rename the file (payload.phtml) and make changes related to IP and port 2. Start listening using netcat command: nc -nvlp 1234
3. Upload the shell payload at /internal
4. Visit: http://<machine IP>:3333/internal/uploads/payload.phtml
Once we open the link, a netcat session starts on our listener with shell access to the machine. To check the user who manages the web server, we can go to /home directory and find the user there. The flag is present in the directory of that user itself in a file named user.txt
.
[Task 5] Privilege Escalation
As we were able to access the user's folder, this means that we are currently having user-level access but not root level. And to gain root-level access we need to perform privilege escalation. After some googling, we can find over the internet that the permissions value for SUID files is 4000 and we can run a search accordingly: find / -perm /4000 2> /dev/null
Flag
Description
/
The path for the directory that is to be searched
-perm
Find files related the specified permission value
2> /dev/null
Helps to omit the files we don't have access to from the resulting output
The output containes many files which are given below:
The one file that stands out is /bin/systemctl. Now the next task is totally upon us. To solve this question and get the root flag there is only one source for our help and that is Google. After searching for systemctl privilege escalation
, we can find results related to GTFOBins.
Using GTFOBins for systemctl, exploitation can be performed as:
We need to make some changes to the commands provided in the GTFOBins which are given below: 1. Replace id
with cat /root/root.txt
2. Executing /bin/systemctl
instead of ./systemctl
as we are not in /bin
.
And that is how we get the root flag and solve the room.
Last updated
Was this helpful?