hackthebox
tutorials
Granny
CTF
hacking
easy
The granny is simple hackthebox in which we will exploit the improper permissions on the HTTP methods to get RCE and then leverage it with malicious ASPX file to gain the meterpreter session. For privilege escalation we will use windows CVE ms14_070_tcpip_ioctl. So lets get started
we start with the nmap scan for to find all the port. Also i will run a nmap scan for all ports in background to have some enumeration running in the background.
nmap scan for all ports in background
we get output of the first nmap scan as follows
we have only one port open i.e 80. Checking it out we have nothing but a Under Construction Page there. On further analysing the nmap output, we see the HTTP methods such as DELETE, COPY, MOVE, PUT are open to public users. Lets examine them.
The public PUT allows us the to upload html files. Thus the following request allows us to upload html files but not the aspx files. This does us no good unless we can leverage to upload aspx files.
I had take the shell.aspx file from [here](https://raw.githubusercontent.com/xl7dev/WebShell/master/Aspx/ASPX Shell.aspx)
We are trying to upload aspx files not php files to gain RCE as this is windows box and server is WebDAV so safe guess is php is not installed on the box and will not be executed by the server.
We see that we have HTTP methods such as MOVE also, so if we could upload a html file and move it file with aspx extension that will solve our problem. So upload the aspx file as shell.html and then move it shell.aspx.
Now moving the file
Now if we go to http://10.10.10.15/shell.aspx we should get our shell. As shown below.
With the help of the msfvenom we will get out meterpreter shell now. The following command will create a staged meterpreter payload in aspx format.
Fire up the meterpreter and run the commands
make a get request to http://10.10.10.15/nice.aspx and you should a meterpreter shell.
We have the SeImpersonateToken available to us so the logical path is to Juicy Potato, Dirty Potato or some potato this box (too many potato exploits, smh). But they did'nt worked for me. With Fuck-Ton of searching around gave me this exploit ms14_070_tcpip_ioctl , so i ran up the msf exploit for this and it gave me a system shell. yay!
So that was the granny box, i am doing all the OSCP similar boxes on the hackthebox and will be writing stuff on them.