Simple CTF
Beginner Level Ctf

Nmap Scan
We will begin with an nmap scan.
nmap -A -T4 -p- 10.10.190.75

FTP Service
Let us start by exploring the ftp service since anonymous login is allowed.

Once we download the file, let us view it in our attack machine.

Hmm, interesting. Perhaps there is a user named Mitch, and probably their password is the same as that of root. Let us enumerate some more.
HTTP Service
Since there is a web server running, let us open it and see what is there.

In our nmap scan results, there is a robots.txt file with 2 disallowed entries. Let us have a look at it.

Let us navigate to /openemr-5_0_1_3

That's strange. Okay, let us search for hidden directories.
gobuster dir -u http://10.10.25.54 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,txt,bak,zip,htmlAnd we get our results back.

Let us navigate to /simple
We come across a website named CMS Made Simple. Some googling reveals that it is a free, open source content management system to provide developers, programmers and site owners a web-based development and administration area.
Scrolling to the bottom of the web page, we find its version number.

While going through the web page, we are informed of an admin console.

And sure enough, we find a login page at /admin.

The instructions mention that logging in requires the username/password mentioned during installation. So the site does not have default credentials. However, I will still try using common username/password combinations to see if I could be lucky.
I wasn't.

Luckily, there is a forgot password feature. Let me see if we can enumerate usernames.

When I use the username admin, I get an error.

However, when I use the username Mitch (remember him?), I get a blank screen. Does this mean Mitch might be a potential user? Let us try brute-forcing the password with his username.
We will use hydra for our brute-force attack.
hydra -l mitch -P /usr/share/wordlists/rockyou.txt 10.10.25.54 http-post-form "/simple/admin/login.php:username=admin&password=^PASS^&loginsubmit=Submit:User name or password incorrect" -t 30 -v
A quick google search reveals our CMS Made Simple version (2.2.8) is vulnerable to an Unauthenticated SQL Injection (CVE-2019-9053). Let us download the exploit code and exploit that.
python 46635.py -u http://simple.local/simple --crack -w /usr/share/wordlists/rockyou.txt
And we get the following details:
username: Mitch
password: secret
email: admin@admin.com
etc...
Let us go ahead and login with the credentials.
Success!!!

SSH Service
Before we enumerate the website, let us recall from our nmap scan results that we had ssh open on port 2222. From the image below, we also see Mitch being criticized that he set the same password for the system user.

We should see if we can use the his credentials to login to the server via ssh.

And success. Let us retrieve the user flag.

We are unable to retrieve the root flag since we do not have full system privileges.

Privilege Escalation
Let us run sudo -l to see if there are any commands we can run as root, and see how we can escalate our privileges.

We see that vim can be run as root with no password. Referring to GTFOBins, we see that there is a vim command which can allow us to escalate our privileges.

Let us run it, escalate our privileges to root and retrieve the root flag.

Lessons Learnt
Always try to login via ssh using any credentials found.
Refer to notes regularly to recall any 'hints' e.g. the note to Mitch about setting the same password in system.
Enumerate all running services.
Last updated
Was this helpful?