Deploy The Machine
For the number of open ports run nmap.
There are 2 ports are open: ssh and http.
Apache version 2.4.29 is running. I get this info thru wappalyzer.
secure shell or ssh is running on port 22.
Apache info also can get by running gobuster.
Here for hidden directory I am running gobuster tool
$ gobuster dir -u http://10.10.51.16/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
Correct answer for hidden directory is /panel/
This means we can upload any file in this /panel page. I think this is the way to getting the shell. reverse shell or binding shell? For that I need to do some google. Oh there is reverse shell mention in that room also. So need to find reverse shell code thru google and upload from that. And access that server's shell thru my machine.Getting a shell
I need to upload php reverse shell code in upload section. and need to make a listener in my pc.
I use this file https://github.com/pentestmonkey/php-reverse-shell
Turn to upload the file. But I got this error. I think It does not give permission to upload php.
I change .php to .php5 and then file is uploaded.
Create a listener in attack device then click on this reverse shell file. Then it provides connection back to attack machine.
Either you can run following command in terminal or can click into recently uploaded malicious code thru /uploads. Then the reverse shell php code executed. At the same time we are listening on port 1234 in attack machine. Hence we got the reverse shell.
Now search and find user.txt, there we got flag. I got user.txt in /usr/www
Privilege Escalation
Q. Search for files with SUID permission, which file is weird?
Ans: /usr/bin/python
I found python is install in our target with SUID bit. So that we can use it to get higher privilege.
We can use https://gtfobins.github.io
as mentioned in the hint.
Now I am searching for python and there I get SUID section and code. With the hint in THM this code can do something for us.
In our case we do not need to run first command. Run second command which will give root shell to us.
First navigate into /usr/bin and then run the command
Now I got root. Its time to search and find root flag.
First go into root's home directory and there is the flag
Okey everything is done. Now terminate the target machine.
Happy Hackers !!
Comments
Post a Comment