This was a cybersecurity bootcamp which also had a CTF running by the end of the bootcamp. I was among the ctf-coordinators, I created 2 challenges for this CTF. One was a mobile reverse engineering challenge and another was a machine.
I'll be explaining how the machine was solved till getting root access.
As the description states, Our task is to verify if it's safe to launch. Means we need to find vulnerabilities around this webapp before it goes live. Unfortunately it had 0 solves
We have 3 ports open, with NMAP or rustscan you will find :
Visiting port 5000 on a browser :
The /login
and /register
endpoints are the only available endpoints on that port but nothing juicy from there. Taking alook at port 8080
Inspecting the source code, you shall find something interesting:
[home-ip]
probably means localhost, and from the input
tag we can see that the input taken should be a url
. let's try requesting something like google.com
So there is a possible SSRF vulnerability existing on this webapp hosted on port 8080. With a hint provided http://[home-ip]:[port]/data?name=tahaa
we surely have to try to bruteforce the port. I will be using burpsuite for this:
I'll send the request to Intruder and start bruteforcing the ports
I did two bruteforcing at a time , one with a step of 1000 and another with a step of 1 , the port found is 3000
.
Trying to send a request on port 8080
to see how the response comes:
We have a SSTI vulnerable to the internal web application, now road to RCE
I now host a malicious script which gives me reverse shell after it being executed on the target server with SSTI
and then I set a listener on my hosting system and execute the payload:
where 0.0.0.0
is your IP
And now we have user, the flag is in /home/tahaafarooq/user.txt
FLAG : flag{SSRF_TO_SSTI_1nt3rM3DIATE}
I first try checking for privileges that I can run as sudo with the command sudo -l
Unfortunately I do not know the password. Next I read the /etc/passwd
file
Another user in the system at /home/admin
:
The admin's password can be bruteforced with rockyou.txt
where you can use hydra to perform bruteforcing , the password is 2025admin
Fortunately user admin
can run any command as sudo:
FLAG : flag{w43k_p@ssword_n0t_gOOD}
The unintended method of getting root directly is with bruteforcing the password of the user admin which is of course guessed as default user.
This machine had 2 ways of gaining initial foot hold the first way is by exploiting SSRF + SSTI to get initial shell and from there discovering other users in the system and bruteforcing the password of the other user available in the system. And the second way was to directly guess the username as admin
and bruteforce the password then directly get root privileges from the user admin