CTFroom: Simple CTF — Time-Based Blind SQLi & Vim Sudo Escape
Discovering CMS Made Simple 2.2.8, executing a time-based blind SQL injection exploit (CVE-2019-9053) to exfiltrate administrative password hashes, and escaping a restricted sudo vim session to achieve root privilege.
Challenge Overview
Simple CTF is an essential room for mastering web application vulnerability research and interactive sudo breakouts. It showcases identifying specific CMS versions, extracting database information character-by-character via time-based SQL injection, and executing shell commands from within interactive text editors.
Phase 1: Port Scanning & Service Discovery
Discovered services:
Running directory enumeration against port 80:
Discovered path: /simple/ — leading to a CMS Made Simple installation.
Checking footer notes and /simple/doc/CHANGELOG.txt:
CMS Made Simple — Version 2.2.8
Phase 2: Exploiting CVE-2019-9053 (Time-Based Blind SQLi)
CMS Made Simple version 2.2.8 is vulnerable to an unauthenticated time-based blind SQL injection in the m1_idlist parameter of the News module (CVE-2019-9053).
Because the database does not return query results in the HTTP response, the exploit infers each character of the database credentials by measuring sleep delays:
We run the public Python exploit with the rockyou.txt wordlist:
Exploit output:
Phase 3: SSH Login on Non-Standard Port
We log in via SSH using the cracked credentials on port 2222:
User flag recovered from /home/mitch/user.txt.
Phase 4: Sudo Vim Breakout to Root
We inspect sudo privileges:
Output:
User mitch can run /usr/bin/vim as root without a password.
Vim allows executing external shell commands directly from command mode (:!). Because Vim runs as root, any command executed through its prompt inherits root privileges:
Or inside an active Vim editor:
Execution:
We are root. Root flag recovered from /root/root.txt.
Defense Remediation
vim, nano, less, man) have documented shell escape sequences. Use restricted alternatives like sudoedit instead of sudo vim.