NTLM Overview
NTLM authentication uses a challenge-response mechanism:- Client requests authentication
- Server sends an 8-byte random challenge
- Client encrypts the challenge with the user’s password hash
- Server verifies the response
Computing NTLM Hashes
NT Hash Computation
The NT hash (also called NTLM hash) is an MD4 hash of the user’s password in UTF-16LE encoding:LM Hash Computation
NTLMv1 vs NTLMv2
NTLMv1 (Legacy)
NTLMv1 is the original NTLM protocol. It’s vulnerable to various attacks:NTLMv2 (Recommended)
NTLMv2 provides enhanced security with stronger cryptography:NTLM Message Exchange
Type 1: Negotiate Message
Client initiates authentication:Type 2: Challenge Message
Server responds with challenge:Type 3: Authenticate Message
Client proves identity:Pass-the-Hash with NTLM
Authenticate using only the NT hash (no plaintext password needed):NTLM Relay Protection
When implementing NTLM authentication, be aware of relay attacks:NTLM Flags and Options
Common NTLM negotiation flags:Working with NTLM Session Keys
Session keys provide message integrity and confidentiality:Practical Examples
Example 1: SMB Authentication with Hashes
Example 2: Extract NT Hash from User Input
Security Best Practices
NTLM is considered a legacy protocol. Microsoft recommends disabling NTLM and using Kerberos for all modern Windows environments. However, NTLM remains useful for:
- Workgroup (non-domain) environments
- Legacy application compatibility
- Security testing and research
- Situations where Kerberos is unavailable
See Also
Pass-the-Hash
Learn techniques for reusing NTLM hashes
Kerberos Auth
Upgrade to Kerberos for better security