Writeups

Write ups and Walkthroughs about vulnerable machines

View on GitHub

LazyAdmin

Back to tryhackme page


Enumeration

Starting with nmap scan.

nmap scan

So there are only 2 open ports i.e. HTTP and SSH. So let’s first focus on HTTP.


Directory enumeration

Now let’s start directory enumeration using gobuster.

gobuster 1

/content is interesting directory. Let’s enumerate this further.

website

Website is based on sweetrice framework.

Enumerating /content further gives many more directories.

gobuster 2

/content/inc directory has mysql backup.

mysql backup


mysql backup

Downloading file and reading it gives us clue.

mysql backup

There is INSERT comment with username as “manager” and password hash.

reading db

Identifying hash using hash-identifier.

hash-identifier

It’s an md5 hash so cracking it with john the ripper.

Hash cracking

So username is manager and password is Password123. Let’s check for any possible exploit for sweetrice framework.


Reverse shell

Searching sweetrice on exploit-db gave us Unrestricted File Upload exploit.

Although it showed file uploaded successfully I was not able to get reverse shell for some reason.

failed exploit

I checked walkthrough at this point for getting reverse shell Walkthrough

So I uploaded reverse shell code in ad section and run it. To run exploit I visited link http://$ip/content/inc/ads/shell.php.

reverse shell in ad

reverse shell

Got reverse shell here.


Getting flags

Got User flag in home directory.

User flag

Also we have sudo access for running perl and backup.pl file. Checking gtfobins gives us command for perl giving root shell but didn’t work. Checking backup.pl file , it runs /etc/copy.sh file which is reverse shell. So updated code in /etc/copy.sh to reverse shell to me.

reverse shell again

Running backup.pl file gave error for sometime and it gave reverse shell but not with root priviledge. Checking another writeup , I ran sudo perl with full path gave me root reverse shell.

sudo reverse shell

Got root flag!!!

root flag


Source :