Credential dumping
Technique
Credential Dumping involves extracting credential material from various sources on a Windows system, including:
-
LSASS Memory: The Local Security Authority Subsystem Service (LSASS) process stores credentials in memory, including plaintext passwords, NTLM hashes, and Kerberos tickets.
-
SAM Database: The Security Account Manager (SAM) database stores local user account credentials.
-
NTDS.dit: The Active Directory database file containing domain user credentials.
-
Kerberos Tickets: Authentication tickets cached in memory or on disk.
These extracted credentials can be used for lateral movement, privilege escalation, and persistence in an environment.
Prerequisites
Access Level: - For local credential dumping: Local administrator privileges on the target system - For domain credential dumping (NTDS.dit): Domain Administrator privileges or local administrator access to a Domain Controller
System State: Target system must be accessible and the relevant services must be running.
Local Credential Dumping
Using Mimikatz
Dump credentials from LSASS memory:
Output to file:
.\mimikatz.exe "log C:\path\to\mimikatz.log" "privilege::debug" "sekurlsa::logonpasswords" "log" "exit"
Dump SAM database (local credentials):
Dump LSA secrets (on a Domain Controller):
Target krbtgt account (for golden ticket creation):
Using Rubeus for Kerberos Tickets
List cached tickets:
Specify a service to filter tickets:
Dump tickets:
# Non-elevated: Dumps current user's tickets
Rubeus.exe dump
# Elevated: Dumps all tickets by targeting krbtgt
Rubeus.exe dump /service:krbtgt
Alternative Methods
Save registry hives and extract locally:
reg.exe save hklm\sam C:\sam.save
reg.exe save hklm\system C:\system.save
reg.exe save hklm\security C:\security.save
Then extract credentials using Impacket:
Dump LSASS with Task Manager: 1. Open Task Manager 2. Select the Processes tab 3. Find & right-click the Local Security Authority Process 4. Select "Create dump file"
The dump file will be saved to:
Rundll32.exe & Comsvcs.dll Method:
Get LSASS PID:
orCreate dump file with rundll32:
Extract credentials with Pypykatz:
NTDS.dit Dumping
Using Volume Shadow Copy:
Copying NTDS.dit from the shadow copy:
cmd.exe /c copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy2\Windows\NTDS\NTDS.dit c:\NTDS\NTDS.dit
Extract credentials with Impacket:
Remote Credential Dumping
Using NetExec
Dump LSA secrets:
Dump SAM database:
Dump NTDS.dit:
Using Impacket
Dump everything remotely:
Detection & Mitigation
Detection
- Monitor for process access to LSASS (Event ID 4656, 4663)
- Watch for creation of memory dump files
- Monitor for suspicious use of rundll32.exe with comsvcs.dll
- Look for Mimikatz-like activity (memory pattern matching)
- Monitor for registry save operations on SAM, SYSTEM, SECURITY hives
- Watch for Volume Shadow Copy creation on Domain Controllers
Mitigation
- Implement credential guard to protect LSASS memory
- Use Protected Process Light (PPL) for LSASS
- Restrict local administrator access
- Implement Just-In-Time (JIT) administration for privileged access
- Configure Windows Defender Credential Guard (for compatible systems)
- Implement Attack Surface Reduction (ASR) rules
- Ensure proper patch management
- Use strong passwords that resist offline cracking
- Implement network segmentation to limit lateral movement capabilities