For the complete documentation index, see llms.txt. This page is also available as Markdown.

Domain Controllers

Basics

  • Find the NETBIOS Domain Name

nbtscan -v 10.10.8.1-254
  • Should also be in nmap output

3389/tcp  open  ms-wbt-server syn-ack ttl 125 Microsoft Terminal Services
| rdp-ntlm-info: 
|   Target_Name: THM-AD
|   NetBIOS_Domain_Name: THM-AD
|   NetBIOS_Computer_Name: ATTACKTIVEDIREC
|   DNS_Domain_Name: spookysec.local
|   DNS_Computer_Name: AttacktiveDirectory.spookysec.local
|   DNS_Tree_Name: spookysec.local
|   Product_Version: 10.0.17763
|_  System_Time: 2021-08-20T18:00:52+00:00
| ssl-cert: Subject: commonName=AttacktiveDirectory.spookysec.local
| Issuer: commonName=AttacktiveDirectory.spookysec.local
  • Add to /etc/hosts

Kerbrute

  • Find valid users

  • Example Syntax

  • what a successful tool run looks like where no valid users are found

Impacket

  • Location:

  • If we have IPC$ access without authentication we are able to list the domain users as anonymous

  • Isolate the users with SidTypeUser

  • Now, let’s use GetNPUsers.py to find users without Kerberos pre-authentication:

  • Should retrive a hash if the command is sucessful

  • Crack the hash with john

SMB Samba authenticated access

  • Cat out files with smb

Dump hashes

  • Use secretsdump.py with impacket

  • 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.

  • Creds used need to be domain admin for this to work

spooky

Alt Method

  • Open cmd.exe

  • Run ntdsutil from the command prompt, enter these commands

  • Takes a snapshot of the DC

  • Will show you the UUID of the newly created snapshot.

  • ntdsutil is using Volume Shadow Copy for the snapshot creation, but also ensures the database consistency. Use the UUID for the following command:

  • The output will show the path where the snapshot was mounted. Start another cmd.exe as Administrator and copy NTDS.dit (located in Windows\NTDS\NTDS.dit by default).

  • Create a copy of the SYSTEM registry hive:

  • Go back to the cmd.exe window with ntdsutil running, and unmount (and optionally delete) the snapshot and exit:

  • Using the two saved files (NTDS.dit and SYSTEM registry hive) you can use the same secretsdump.py script to extract password hashes offline (doesn’t need to be done on the domain controller):

Secretsdump Local

  • Exfil the registry hives

  • Extract hashes from exfiled SECURITY SAM and SYSTEM

Another Cheatsheet

  • https://gist.github.com/TarlogicSecurity/2f221924fef8c14a1d8e29f3cb5c5c4a

DCSync via Pass the Certificate (ADCS Relay)

When ADCS (Active Directory Certificate Services) exposes a web enrollment endpoint, relay NTLM authentication to request a certificate for the DC machine account.

Step 1: Start ntlmrelayx targeting the ADCS enrollment endpoint:

Step 2: Coerce the DC to authenticate to your relay using PrinterBug:

Step 3: When the certificate is captured, convert it to a TGT:

Step 4: Use the TGT to DCSync:


If you have write access to a user's msDS-KeyCredentialLink attribute (identify via BloodHound), use pywhisker to add a key credential and authenticate as that user.

Step 1: Add a shadow credential:

Step 2: Use the generated PFX to get a TGT:

Step 3: Use the TGT:


Invoke-SMBExec — Remote Command Execution with Hash


Invoke-ShareFinder

Last updated