BUFF Write-up | HackTheBox | by Valerie23

 NMAP SCAN

Launching a nmap scan against our target machine to find open ports.


WEB ANALYSIS

On visiting port 8080 we get to know that the website is made using Gym Management Software 1.0.

On googling about the software and its version we get to know about a related exploit from exploit-db.

We can now download and run the exploit in order to gain a reverse shell.

Now we have a reverse shell but we are unable to run many commands on it.
So lets try to put nc.exe here. We will do so using the python server and "curl" command.

So now we have nc.exe here and we can use it to gain a new reverse shell where we will be able to run more commands.

Now we can grab the user flag which is located inside C:\Users\shaun\Desktop

PRIVILEGE ESCALATION

Time to explore all the directories and files inside them.

The CloudMe Version 1.11.2 is vulnerable to Buffer overflow. An exploit for the same can be found on exploit-db.
But before using the exploit, we need to verify whether this service is running on our target machine and for that we will check all the open ports using the command.
netstat
And then we check running services using the command tasklist -services.
Little bit of google search lets us know that CloudMe service creates a socket listening on port 8888 by default.
And we have checked that the port is open on our machine.
So, now we will transfer port 8888 of the target machine to our attacking machine using chisel.
And in order to do so we first need to download chisel.
Chisel for linux and windows can be downloaded from this link.
Then we can tranfer chisel to the target machine in the same way as we transfered nc.exe earlier using the curl command. After that you can type exit for exiting powershell.

Note: If the curl command doesn't work try entering powershell using command powershell and then use curl command.

PORT FORWARDING

Start a server on attacking machine using the command:
sudo ./chisel server -p 6666 --reverse



And on the target machine type:
.\chisel.exe client 10.10.15.120:6666 R:8888:127.0.0.1:8888


Time to make some changes to the exploit that we downloaded earlier for CloudMe from exploit-db.
If you read the exploit enough carefully then you can find the following command in comments.

Copy and replace the generated output in exploit, make sure you replace the word "buf" with "payload" so that it doesn't mess up with the rest of the code.

Run the exploit and start nc in the other tab to gain a reverse shell with root privilege.



Thankyou for reading.


                                                                            -by Valerie23








Comments

Popular posts from this blog

THM: Blog Room Writeup

LOOKING GLASS Write-up | TryHackMe | by Valerie23

Carpe-Diem | Tryhackme | Writeup