12 - Windows Hashes
Topics
Introduction to the Windows Shells
Windows Permissions
Reverse Shells in Windows
SeImpersonatePrivilege Exploitation
On Cross Compilation
Windows Services
Weak Service Permissions
Unquoted Service Path
DLL Hijacking
Always Install Elevated
Files with Sensitive Data
Windows Hashes
Stored Credentials and the Windows Vault
Scheduled Task
Critical Registry Paths
Useful Tools
AMSI Bypass
Hash Functions
Hash functions are cryptographic tools that transform input data (e.g., passwords) into fixed-length values called hashes. These are one-way functions, meaning it is computationally infeasible to retrieve the original input from the hash.
Example using sha256
:
Authentication
Hash functions are widely used in authentication to protect user credentials. Passwords are hashed before storage, ensuring that even if the database is compromised, the plaintext passwords remain undisclosed.
Authentication Workflow:
User provides password
P
.Application computes
H(P)
(hash of the password).The hash
H(P)
is compared to the stored hash.Authentication succeeds if the hashes match.
Windows Hashes
Windows uses several hash formats for authentication and data protection.
LM (LAN Manager) Hash
Legacy hash format, disabled by default since Windows Vista.
Algorithm:
Convert the password to uppercase.
Pad to 14 characters.
Split into two 7-character chunks.
Use each chunk as a DES key to encrypt "KGS!@#$%".
Concatenate the results.
Check LM Hash Configuration:
NTLM Hash
Modern Windows systems store passwords as NTLM hashes.
Algorithm:
Example: NTLM hash of "password" is:
Net-NTLMv1
Used in challenge/response authentication protocols.
Algorithm:
C
: 8-byte server challenge.K1
,K2
,K3
: Derived from the NT hash.
Net-NTLMv2
Improved version of NTLMv1, leveraging HMAC-MD5 for better security.
Algorithm:
Check NTLM Compatibility:
Kerberos
Used for authentication in Active Directory environments.
Employs ticket-based authentication with encrypted Ticket Granting Tickets (TGTs) and Service Tickets (TGSs).
DPAPI
Windows Data Protection API (DPAPI) uses hashes to encrypt user data such as browser credentials and encryption keys.
Obtaining Hashes
LM, NTLM: SAM Dump with SeBackupPrivilege + Mimikatz
Dump hashes from the Security Accounts Manager (SAM):
Net-NTLM: Using Responder
Responder captures Net-NTLM hashes via SMB:
Install Responder:
Start Responder:
Trigger SMB Connection from Victim:
Captured Net-NTLMv2 hash:
Cracking Windows Hashes
Required Tools:
John the Ripper
Hashcat
Common Wordlist:
Download rockyou.txt
:
Cracking Commands:
LM Hash:
NTLM Hash:
Net-NTLMv1:
Net-NTLMv2:
Other Resources
LM, NTLM, Net-NTLMv2: Medium Article
Windows Privilege Escalation (SeBackupPrivilege): Hacking Articles
NTLM Hashes in Windows 10: Technical Writeup
Disclaimer
❗ Never use tools and techniques on real IP addresses, hosts or networks without proper authorization!❗
Last updated