Dog¶
Initial Scan¶
Port 22 is SSH, port 80 is HTTP.
Enumeration¶
The web server runs Backdrop CMS version 1.27.1. A file at http://10.10.11.58/files/shell.tar leaks the CMS version information.
The .git directory is exposed. Using git_dumper to extract it:
From the dumped files, we find credentials in settings.php and update configuration:
Email found: tiffany@dog.htb
Credential: tiffany@dog.htb:BackDropJ2024DS2024
Exploitation¶
Backdrop CMS Module Upload RCE¶
Using Exploit-DB 52021, we upload a malicious Backdrop CMS module to get a shell as www-data.
Database Enumeration¶
Query the users table through the uploaded webshell:
| name | pass |
|---|---|
| jPAdminB | $S$E7dig1GTaGJnzgAXAtOoPuaTjJ05fo8fH9USc6vO87T./ffdEr/. |
| jobert | $S$E/F9mVPgX4.dGDeDuKxPdXEONCzSvGpjxUeMALZ2IjBrve9Rcoz1 |
| tiffany | $S$EEAGFzd8HSQ/IzwpqI79aJgRvqZnH4JSKLv2C83wUphw0nuoTY8v |
| ... | ... |
Password Reuse¶
The MySQL password BackDropJ2024DS2024 works for SSH as johncusack:
Privilege Escalation¶
johncusack can run /usr/local/bin/bee as root. The bee binary is a PHP CLI tool for Backdrop CMS:
ls -la /usr/local/bin/bee
# lrwxrwxrwx 1 root root 26 Jul 9 2024 /usr/local/bin/bee -> /backdrop_tool/bee/bee.php
The bee tool supports executing PHP scripts via the php-script command. Create a payload:
This drops a root shell.
Flags¶
user.txt: 781fc02a7521ecab978aae1635f3f097 root.txt: 83d741ce5e844bf3dd2e6b68e72405e6