Simple CTF header on TryHackMe with the ‘beginner level’ description.

This guide walks through the steps to tackle the Simple CTF challenge available on TryHackMe, suitable for beginners in the field of cybersecurity and hacking.

Reconnaissance

Any hacker’s first step upon encountering a target involves reconnaissance. This phase involves exploring and gathering information about the target to obtain the necessary flags, answer questions, and complete the challenge.

Let’s begin.

Scanning with Nmap

Upon scanning our target with Nmap, we discover three open ports:
- Port 21 (FTP): Accessible with the “anonymous” login
- Port 80 (HTTP)
- Port 2222 (SSH): Requires a username and password

A screenshot of the results of the Nmap scan.

Answering the first and second question is easy after we have reviewed our nmap result. We can tell how many services are running under port 1000 and what service is running on the higher port.

FTP Exploration

Connecting via FTP using the “anonymous” login without a password, we execute the ‘ls -al’ command, obtaining a directory listing.

A screenshot displaying the results of accessing ftp, downloading a text file and viewing the contents.

Navigating into the “pub” directory, we locate a file named “ForMitch.txt.” Viewing its contents reveals a message addressed to someone named Mitch, hinting that this user has a potentially easily crackable password. We file that knowledge for later.

HTTP Investigation

Using dirsearch, we uncover several web pages such as ‘/index.html,’ ‘/robots.txt,’ and ‘/simple.’

A screenshot displaying the dirsearch results.

Analyzing these pages, we discover that ‘/simple’ is powered by CMS Made Simple.

We check out the web pages we have available and we don’t really see anything interesting enough from the first two available.

A screenshot displaying the results of the curl command on the target IP Address.

Checking the ‘/simple’ page we scroll through to see if there’s anything we can use and we find something at the end of the page. We can see that it is powered by ‘CMS Made Simple’.

A screenshot displaying the results of the curl command on the target IP Address/simple page.
A screenshot displaying the results of the curl command on the target IP Address/simple page with ‘this site is powered by CMS Made Simple’ highlighted.

Is there anything special about this?

Researching known exploits related to the version of CMS Made Simple powering this website, we discover an exploit that can be utilized. This addresses both the ‘What CVE are you using against the application?’ and ‘What kind of vulnerability is the application susceptible to?’ questions.

A screenshot displaying the exploit found on Exploit-db.

Exploiting

Utilizing searchsploit, we locate and download the exploit.

A screenshot displaying the searchsploit results, highlighting the found exploit.

It is a Python script, and when we execute it, the AttackBox provided allows for smooth execution without any problems. However, if you’re using Python version 3 or higher, a few modifications are necessary. Specifically, you’ll need to include brackets () wherever the script uses the print option.

Running this ‘python (script) -u (url),’ we uncover a hashed password, username, email, and salt for an account.

A screenshot displaying the results of running the downloaded exploit.

Utilizing hashcat and the wordlist we have available, we are able to successfully crack Mitch’s password.

A screenshot displaying the hashcat command and the starting process of cracking the password.
A screenshot displaying the hashcat results and the cracked password.

Like the person who left the message for Mitch said, it was really easy to crack.

Now we have our password and our username.

SSH Access

With the acquired username and password, we gain access to the system via ssh on port 2222. Exploring the directories using ‘ls -al,’ we discover a file named ‘user.txt.’

Checking the contents of the file, we can see that it contains the user flag.

A screenshot displaying directories post a successful SSH login and capturing the user flag.

That done, we can now move on to exploring the system and answering other questions.

We list out the contents of ‘home’ using — ‘ls -al /home’ and we can see that there is another user besides mitch. That answers the question that wants to know if there is any other user in the home directory.

A screenshot displaying the contents of the ‘/home’ directory.

Elevating Privileges

One of the questions pertains to the root flag. As we lack logins for the root account, we explore alternative methods to gain root access. Additionally, another question inquires about what we can utilize to create a privileged shell.

We investigate available privileges using ‘sudo -l’ and discover that we can execute ‘sudo vim’ without requiring a password. This access enables us to leverage vim and spawn a privileged shell.

A screenshot displaying the result of the ‘sudo -l’ command and the privileges the current user has on the system.

Executing ‘sudo vim’ and entering ‘:!bash’ enables us to spawn the privileged shell, facilitating the search for the root flag.

A screenshot displaying the ‘:!bash’ command in vim that will be used to launch a privileged shell.

We search through the system to locate the root flag, and it doesn’t take long before we find it.

A screenshot displaying directories after a successful privileged shell creation and capturing the root flag.

And that’s it! We have completed the challenge and found all the flags!

A screenshot displaying ‘Congratulations! You have completed the room! Share with your friends’ with options for Twitter, Facebook, and LinkedIn. As well as a share feedback option.

--

--