NTLM
NTLM is Microsoft's challenge-response authentication protocol. It is the fallback when Kerberos cannot be used, and the main target of relay and hash attacks.
Overview
NTLM (NT LAN Manager) is a challenge-response authentication protocol from Microsoft. A server sends a random challenge, the client answers with a value computed from that challenge and a hash of the user's password, and the server (or a domain controller on its behalf) checks the answer. The password itself never crosses the network.
In an Active Directory domain, Kerberos is the preferred protocol. NTLM is what Windows falls back to when Kerberos cannot be used: when a client connects to a server by IP address instead of name, when no domain controller is reachable, when the account is a local account, or when an application asks for NTLM directly. In most enterprise networks that still adds up to a large share of all authentication.
NTLM has no port of its own. Its three messages travel inside other protocols: SMB, HTTP, LDAP, RPC, SQL Server, SMTP, and the Remote Desktop credential exchange.
Defenders care because NTLM's design makes several attacks possible that Kerberos makes hard. The client cannot verify which server it is talking to, so an attacker in the middle can forward (relay) a victim's authentication to another server. The password hash is enough to log on, so a stolen hash works like a password (pass-the-hash). And captured challenge-responses can be cracked offline. Relay, coercion, and pass-the-hash remain common steps in real intrusions, including ones that end in ransomware.
History and evolution
| Era | Version | What changed |
|---|---|---|
| Late 1980s | LAN Manager (LM) | The LM hash: password converted to upper case, padded or cut to 14 characters, split into two 7-character halves, each used as a DES key. Very weak |
| 1993 | NTLM (version 1) | Shipped with Windows NT 3.1. Introduced the NT hash: MD4 of the password in UTF-16 little-endian. Responses still built with DES |
| 1998 | NTLMv2 | Introduced in Windows NT 4.0 Service Pack 4. Responses built with HMAC-MD5 over the server challenge, a client challenge, a timestamp, and target information |
| 2000 | Kerberos becomes the default | Windows 2000 Active Directory uses Kerberos first. NTLM stays as the fallback |
| 2007 onward | Hardening defaults | Windows Vista and Server 2008 stop storing LM hashes by default and send only NTLMv2 responses by default |
| 2019 | Drop the MIC (CVE-2019-1040) | A flaw that let attackers strip NTLM's integrity check and relay across protocols. Patched in June 2019 |
| 2024 | Deprecation | Microsoft listed all NTLM versions as deprecated and removed NTLMv1 from Windows 11 version 24H2 and Windows Server 2025 |
The protocol is documented in Microsoft's open specification MS-NLMP. The pass-through validation between a server and a domain controller is documented in MS-NRPC (Netlogon).
Where NTLM is used in enterprise networks
NTLM shows up wherever Kerberos is not possible or not attempted:
- Connections by IP address, such as
\\10.0.4.20\share. There is no service principal name for an IP, so Kerberos cannot issue a ticket - Local accounts on workstations and servers, including the built-in Administrator account
- Workgroup machines, appliances, and devices that are not domain-joined
- Applications and web servers configured for NTLM, or for
Negotiatewhere Kerberos fails and NTLM takes over - Older line-of-business applications, scanners, multifunction printers, and network storage that only support NTLM
- Cross-forest access where the trust or name resolution does not support Kerberos
- Remote Desktop and WinRM connections that fall back when Kerberos fails
Two facts make NTLM traffic valuable for detection. First, most organizations have far more of it than they think; Microsoft's own guidance is to audit before restricting, for exactly that reason. Second, legitimate NTLM traffic is repetitive: the same service accounts, the same servers, the same applications. New sources, new destinations, and NTLM leaving the network are what stand out.
Architecture and components
| Component | What it is | What it holds |
|---|---|---|
| Client | The machine and user trying to log on | The user's NT hash, cached in memory by the Local Security Authority (LSASS) after logon |
| Server | The service being accessed: a file server, web server, or SQL Server | Nothing about domain users. For domain accounts it forwards the response to a domain controller |
| Domain controller | Validates responses for domain accounts | The NT hash of every domain account, in the directory database (NTDS.dit) |
| SAM database | Local account database on each Windows machine | The NT hashes of local accounts |
| Netlogon secure channel | An authenticated channel between each domain member and a domain controller | Used for pass-through validation (MS-NRPC) |
| NT hash | MD4 of the UTF-16LE password, 16 bytes | The secret that NTLM proves knowledge of. It is equivalent to the password for NTLM |
| Server challenge | 8 random bytes chosen by the server per authentication | Makes each response unique |
| Session keys | Keys derived during authentication | Used for signing and sealing, when the application protocol turns those on |
The key point is in the NT hash row. Kerberos also derives keys from the password, but NTLM uses the hash directly as the proof. Whoever has the hash can complete NTLM authentication without ever knowing the password.
How NTLM works step by step
- NEGOTIATE (type 1). The client tells the server it wants to use NTLM and lists the features it supports as flags: Unicode, signing, sealing, extended session security, 128-bit keys, and others.
- CHALLENGE (type 2). The server replies with an 8-byte random server challenge, the flags it agrees to, and a block of target information: its NetBIOS and DNS names, the domain names, and a timestamp.
- AUTHENTICATE (type 3). The client computes its response from the server challenge, its own random client challenge, the timestamp, the target information, and the user's NT hash. It sends the response together with the user name, domain name, and its own workstation name, plus a message integrity code (MIC) covering all three messages.
- Validation. For a local account, the server checks the response against its SAM database. For a domain account, the server sends the challenge and response to a domain controller over its Netlogon secure channel. The domain controller recomputes the expected response from the stored NT hash and replies with success or a failure code, along with the user's group memberships and a session key.
- Access. If validation succeeds, the server grants access. If signing was negotiated and is required, all further messages on the connection are signed with the session key.
Notice what is missing: at no point does the client verify the server's identity. The client answers whichever server sent the challenge. That gap is the root of relay attacks.
sequenceDiagram participant C as Client participant S as Server participant DC as Domain controller C->>S: NEGOTIATE with supported flags S->>C: CHALLENGE with server challenge and target info C->>S: AUTHENTICATE with response, user, domain, workstation, MIC S->>DC: Netlogon pass-through with challenge and response DC->>S: Success, group memberships, session key S->>C: Access granted
Packet-level anatomy
Transport and encapsulation
NTLM messages ride inside the application protocol:
| Carrier | Where NTLM appears | How to spot it |
|---|---|---|
| SMB (445/TCP) | Session Setup requests and responses, usually inside SPNEGO | The NTLMSSP mechanism OID 1.3.6.1.4.1.311.2.2.10 inside the security blob |
| HTTP (80 or 443/TCP) | Authorization: NTLM <base64> or Authorization: Negotiate <base64> headers, and WWW-Authenticate challenges | Base64 of the NTLM signature starts with TlRMTVNTUA |
| LDAP (389/TCP) | SASL bind with GSS-SPNEGO, or the Microsoft "sicily" bind | Bind requests carrying NTLMSSP |
| RPC and DCOM (135 plus dynamic ports) | Bind and alter-context authentication | NTLMSSP in the auth verifier |
| SQL Server (1433/TCP) | Login with integrated security | NTLMSSP in the login packet |
| Remote Desktop (3389/TCP) | CredSSP during Network Level Authentication | NTLMSSP inside CredSSP when Kerberos fails |
Pass-through validation from a member server to a domain controller uses Netlogon RPC, not NTLMSSP. The domain controller sees the user name, domain, workstation name, and the challenge and response, and logs Event 4776.
Common header
Every NTLM message starts with the same 12 bytes:
| Offset | Size | Field | Value |
|---|---|---|---|
| 0 | 8 bytes | Signature | NTLMSSP\0 (hex 4E 54 4C 4D 53 53 50 00) |
| 8 | 4 bytes | MessageType | 1 (NEGOTIATE), 2 (CHALLENGE), or 3 (AUTHENTICATE), little-endian |
Variable-length fields such as names and responses are not stored inline. Each is described by an 8-byte security buffer: a 2-byte length, a 2-byte maximum length, and a 4-byte offset into the payload that follows the fixed fields.
NEGOTIATE message (type 1)
| Field | Size | Purpose | Security note |
|---|---|---|---|
| Signature, MessageType | 12 bytes | Header, type 1 | None |
| NegotiateFlags | 4 bytes | Features the client supports | A client that does not offer extended session security or 128-bit keys is old or misconfigured |
| DomainNameFields | 8 bytes | Optional domain name | Usually empty in modern clients |
| WorkstationFields | 8 bytes | Optional workstation name | Usually empty in modern clients |
| Version | 8 bytes | Windows version and build, if the version flag is set | Lets passive sensors fingerprint the client operating system |
CHALLENGE message (type 2)
| Field | Size | Purpose | Security note |
|---|---|---|---|
| TargetNameFields | 8 bytes | The server's domain or computer name | Visible in clear text |
| NegotiateFlags | 4 bytes | Flags the server accepts | Signing and sealing are only as strong as what is agreed here |
| ServerChallenge | 8 bytes | Random nonce for this authentication | A fixed, repeated challenge such as 1122334455667788 is the signature of tools that try to capture crackable NTLMv1 responses |
| Reserved | 8 bytes | Must be zero | None |
| TargetInfoFields | 8 bytes | Points to a list of attribute-value pairs (AV_PAIRs) | Carries the names and timestamp that NTLMv2 binds the response to |
| Version | 8 bytes | Server Windows version | Fingerprints the server |
The AV_PAIR list in TargetInfo uses these IDs:
| ID | Name | Contents |
|---|---|---|
| 1 | MsvAvNbComputerName | Server NetBIOS name |
| 2 | MsvAvNbDomainName | Domain NetBIOS name |
| 3 | MsvAvDnsComputerName | Server DNS name |
| 4 | MsvAvDnsDomainName | Domain DNS name |
| 5 | MsvAvDnsTreeName | Forest DNS name |
| 6 | MsvAvFlags | Flags. Value 0x2 means the client includes a MIC |
| 7 | MsvAvTimestamp | Server time, used in the NTLMv2 response |
| 9 | MsvAvTargetName | The service name the client intends to reach, such as cifs/fs01.corp.local (added by the client in the AUTHENTICATE message) |
| 10 | MsvAvChannelBindings | A hash of the TLS channel, for Extended Protection for Authentication (added by the client) |
| 0 | MsvAvEOL | End of list |
AUTHENTICATE message (type 3)
| Field | Size | Purpose | Security note |
|---|---|---|---|
| LmChallengeResponseFields | 8 bytes | LM or LMv2 response | With NTLMv2 and a server timestamp present, this is 24 bytes of zeros |
| NtChallengeResponseFields | 8 bytes | NT response | Its length tells you the version: exactly 24 bytes is NTLMv1, longer is NTLMv2 |
| DomainNameFields | 8 bytes | User's domain | Clear text |
| UserNameFields | 8 bytes | User name | Clear text, so sensors see every account that authenticates |
| WorkstationFields | 8 bytes | Client's claimed computer name | Chosen by the client. In a relay it names the victim, not the machine that actually connected |
| EncryptedRandomSessionKeyFields | 8 bytes | Session key exchange | Used when key exchange is negotiated |
| NegotiateFlags | 4 bytes | Final agreed flags | None |
| Version | 8 bytes | Client version | Fingerprinting |
| MIC | 16 bytes | HMAC-MD5 over all three messages, keyed with the session key | Stops tampering with the flags. Its removal was the core of CVE-2019-1040 |
Key negotiate flags
| Flag | Value | Meaning |
|---|---|---|
| NTLMSSP_NEGOTIATE_UNICODE | 0x00000001 | Strings in UTF-16LE |
| NTLMSSP_REQUEST_TARGET | 0x00000004 | Server should send its target name |
| NTLMSSP_NEGOTIATE_SIGN | 0x00000010 | Message signing |
| NTLMSSP_NEGOTIATE_SEAL | 0x00000020 | Message encryption |
| NTLMSSP_NEGOTIATE_NTLM | 0x00000200 | NTLM authentication |
| NTLMSSP_NEGOTIATE_ALWAYS_SIGN | 0x00008000 | Signature on every message, even if no signing key |
| NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY | 0x00080000 | NTLM2 session security. Mixes a client challenge into NTLMv1 and strengthens keys |
| NTLMSSP_NEGOTIATE_TARGET_INFO | 0x00800000 | TargetInfo is present |
| NTLMSSP_NEGOTIATE_VERSION | 0x02000000 | Version field is present |
| NTLMSSP_NEGOTIATE_128 | 0x20000000 | 128-bit session keys |
| NTLMSSP_NEGOTIATE_KEY_EXCH | 0x40000000 | Explicit session key exchange |
| NTLMSSP_NEGOTIATE_56 | 0x80000000 | 56-bit keys |
A typical modern Windows client sends 0xe2888215, which combines Unicode, request target, signing, NTLM, always sign, extended session security, target info, version, 128-bit, key exchange, and 56-bit.
How the responses are built
NTLMv1 encrypts the 8-byte server challenge three times with DES, using the 16-byte NT hash padded to 21 bytes and split into three 7-byte keys. The result is a 24-byte response. Because DES keys are small and the scheme is fixed, an NTLMv1 response can be turned back into the NT hash, which is then usable for pass-the-hash.
NTLMv2 works in two steps:
- The client derives a per-user key: NTOWFv2 = HMAC-MD5 of the upper-cased user name and the domain name, keyed with the NT hash.
- It builds a blob containing a timestamp, an 8-byte client challenge, and the target information, then computes NTProofStr = HMAC-MD5 of the server challenge plus that blob, keyed with NTOWFv2. The NT response is NTProofStr followed by the blob.
The NTLMv2 response cannot be replayed to a different challenge, and it cannot be reversed into the NT hash directly. It can still be cracked offline by guessing passwords, which is fast against weak ones.
| Captured material | Hashcat mode | What cracking gives you |
|---|---|---|
| NT hash (from SAM, NTDS.dit, or memory) | 1000 | The password. The hash itself already works for pass-the-hash |
| NetNTLMv1 response | 5500 | The password, or with DES key recovery, the NT hash itself |
| NetNTLMv2 response | 5600 | The password, if it is weak enough |
Example decoded AUTHENTICATE message
This is an illustrative NTLMv2 AUTHENTICATE message as Wireshark shows it, from an SMB session setup.
NTLM Secure Service Provider
NTLMSSP identifier: NTLMSSP
NTLM Message Type: NTLMSSP_AUTH (0x00000003)
Lan Manager Response Length: 24 (all zeros, timestamp present)
NTLM Response Length: 330
NTLMv2 Response
NTProofStr: 4d1e7c...
Response Version: 1
Hi Response Version: 1
Time: Nov 9, 2026 08:12:44 UTC
NTLMv2 Client Challenge: 9b5c02...
Attribute: NetBIOS domain name: CORP
Attribute: DNS computer name: fs01.corp.local
Attribute: Flags: 0x00000002 (MIC present)
Attribute: Target Name: cifs/fs01.corp.local
Attribute: Channel Bindings: 00000000...
Domain name: CORP
User name: jdoe
Host name: WS-0142
Negotiate Flags: 0xe2888215
MIC: 9e1fa3...
Zeek writes one line per NTLM authentication to ntlm.log, with fields including username, hostname, domainname, server_nb_computer_name, server_dns_computer_name, and success. An illustrative line:
username=jdoe hostname=WS-0142 domainname=CORP server_dns_computer_name=fs01.corp.local success=T
Configuration in practice
| Setting | Default | Recommended | Why |
|---|---|---|---|
| Network security: LAN Manager authentication level (LmCompatibilityLevel) | Send NTLMv2 response only (level 3) on modern Windows | Send NTLMv2 response only. Refuse LM and NTLM (level 5) | Stops the domain controller from accepting LM and NTLMv1 responses |
| Network security: Do not store LAN Manager hash value on next password change | Enabled | Enabled | Keeps the weak LM hash out of the database |
| Network security: Minimum session security for NTLM SSP (clients and servers) | Require 128-bit encryption on recent versions | Require NTLMv2 session security and 128-bit encryption | Prevents weak session keys |
| Microsoft network server: Digitally sign communications (always) | Required on domain controllers. On member servers it depends on the Windows version | Enabled everywhere | SMB signing makes relay to SMB fail. Recent Windows releases require it by default |
| Domain controller: LDAP server signing requirements | Varies by version and update level | Require signing | Blocks relay to LDAP over unencrypted connections |
| LDAP channel binding (LdapEnforceChannelBinding) | Varies by update level | Always (value 2) | Blocks relay to LDAPS |
| Extended Protection for Authentication on IIS, including AD CS web enrollment | Off for many applications | Required | Binds NTLM to the TLS channel, which defeats relay to HTTPS services |
| Turn off multicast name resolution (LLMNR) | LLMNR enabled | Enabled (which turns LLMNR off) | Removes the most common source of captured hashes on internal networks |
| NetBIOS over TCP/IP on network adapters | Enabled by default | Disabled, through DHCP option or adapter settings | Removes NBT-NS, the other common poisoning target |
| Network security: Restrict NTLM policies | Not defined | Audit first, then deny with exceptions | The only safe route to reducing NTLM: find what depends on it before blocking it |
Restricting NTLM is a project, not a switch. The sequence that works in practice:
- Turn on "Network security: Restrict NTLM: Audit NTLM authentication in this domain" on domain controllers, and the matching incoming and outgoing audit policies on servers and clients.
- Collect the events from the Microsoft-Windows-NTLM/Operational log for several weeks. On Windows 11 24H2, Windows Server 2025, and recent updates for Windows Server 2019 and later, also turn on the newer "NTLM Enhanced Logging" policy (Microsoft KB5064479). Its events add the process that started each NTLM attempt, which makes finding the responsible application much faster.
- Fix the sources: add SPNs, switch connections from IP addresses to names, update or replace applications.
- Block NTLM for the most sensitive accounts first by adding them to the Protected Users group.
- Deny NTLM by policy with an exception list for what cannot be fixed yet.
Security model and common misconfigurations
NTLM rests on these assumptions:
- The NT hash stays secret. In practice it is cached in memory on every machine the user logs on to, and it is enough to authenticate.
- The response proves the client knows the hash for this challenge. It does not prove which server the client meant to reach, unless the target name and channel bindings are checked.
- Signing protects the session after authentication. It only works if both sides require it.
The misconfigurations behind most NTLM attacks in enterprise networks:
- SMB signing not required on member servers and workstations
- LDAP signing and channel binding not enforced on domain controllers
- AD CS web enrollment reachable over HTTP, or over HTTPS without Extended Protection
- LLMNR and NBT-NS left on across the network
- Outbound SMB (445/TCP) allowed to the internet
- The same local administrator password on many machines, so one hash opens them all
- The Print Spooler service running on domain controllers, which helps attackers force the domain controller to authenticate to them
- Applications and scripts that authenticate by IP address, which forces NTLM even where Kerberos would work
Attacks against NTLM
Name resolution poisoning
How it works: when a Windows host fails to resolve a name through DNS, it asks the local network using LLMNR (UDP 5355) and NBT-NS (UDP 137). An attacker on the same network answers, "that is me." The victim then connects and authenticates to the attacker, handing over a NetNTLMv2 response.
Prerequisites: a foothold on the same network segment, and LLMNR or NBT-NS left on.
Tools: Responder, Inveigh.
ATT&CK: T1557.001 (Adversary-in-the-Middle: Name Resolution Poisoning and SMB Relay).
On the wire and in logs: LLMNR or NBT-NS responses from a host that is not a DNS server, followed by SMB or HTTP authentication to that host. Mistyped share names in user activity make this attack productive without any further action from the attacker.
Forced authentication (coercion)
How it works: instead of waiting for victims, the attacker makes a machine authenticate on demand. Several RPC interfaces accept a file path and will connect to it, including the printer interface (MS-RPRN, the "printer bug"), the encrypting file system interface (MS-EFSRPC, known as PetitPotam, CVE-2021-36942), and the DFS namespace interface (MS-DFSNM). Files can also do it: a shortcut or document on a shared folder with an icon path pointing to \\attacker\share triggers authentication when someone browses the folder. CVE-2023-23397 let an attacker trigger it from an Outlook calendar reminder with no user interaction.
Prerequisites: network access to the target's RPC interfaces (some need a domain account), or the ability to place a file where users will see it.
Tools: PetitPotam, Coercer, SpoolSample.
ATT&CK: T1187 (Forced Authentication).
On the wire and in logs: RPC calls to efsrpc, spoolss, or netdfs from unusual sources, followed by the target connecting out over SMB or HTTP to that source. Domain controllers connecting to workstations is the clearest signal.
NTLM relay
How it works: the attacker receives an authentication attempt (from poisoning or coercion) and forwards each message to a different server in real time. The relayed server sends its challenge, the attacker passes it to the victim, the victim answers, and the attacker forwards the answer. The server logs the victim in, and the attacker now holds an authenticated session as the victim.
Where it goes depends on what the target allows:
- SMB targets without required signing: command execution as the victim, if the victim is a local administrator there
- LDAP without signing, or LDAPS without channel binding: changes to the directory, such as creating a computer account, setting resource-based constrained delegation, or adding shadow credentials
- AD CS web enrollment without Extended Protection (known as ESC8): a certificate for the victim. Combined with coercing a domain controller, this gives a certificate for the domain controller, and from there full domain compromise
A machine cannot be relayed back to itself over the same protocol; Microsoft closed that path in 2008 (MS08-068). Cross-protocol relay, such as SMB to LDAP, was helped by CVE-2019-1040, which let attackers remove the MIC.
Prerequisites: a source of victim authentication, and a target that does not enforce signing, channel binding, or Extended Protection.
Tools: Impacket ntlmrelayx.py, Responder in relay mode.
ATT&CK: T1557.001.
On the wire and in logs: the same user authenticating to two different servers within a second, once from the real workstation to the attacker and once from the attacker to the target. On the target, Event 4624 with logon type 3 and NTLM, where the Workstation Name field does not match the computer at the source IP address.
Pass-the-hash
How it works: NTLM proves knowledge of the NT hash, so a stolen hash works like the password. Attackers dump hashes from memory (LSASS), from the local SAM database, or from NTDS.dit, then authenticate to other machines with the hash directly.
Prerequisites: administrator rights on a machine where privileged users have logged on, or access to a credential database.
Tools: Mimikatz (sekurlsa::pth), Impacket (psexec.py, wmiexec.py with -hashes), and many post-exploitation frameworks.
ATT&CK: T1550.002 (Pass the Hash). Hash theft from memory is T1003.001 (LSASS Memory).
On the wire and in logs: on the attacker's machine, Event 4624 with logon type 9 (NewCredentials) and logon process seclogo, which is what sekurlsa::pth and runas /netonly create. On targets, NTLM network logons by privileged accounts from machines they do not normally use. The same local administrator account logging on to many machines in a short time.
Offline cracking of captured responses
How it works: a captured NetNTLMv2 response can be checked against password guesses at high speed. NetNTLMv1 is worse: with a known challenge, the DES-based response can be reversed into the NT hash itself.
Prerequisites: a captured response, from poisoning, coercion, or a packet capture.
Tools: Hashcat (modes 5500 and 5600), John the Ripper.
ATT&CK: T1110.002 (Password Cracking).
On the wire and in logs: cracking happens offline and leaves nothing. Detect the capture step instead. Also find any NTLMv1 in use (Event 4624 with Package Name NTLM V1), because those responses are the most valuable to an attacker.
Password spraying over NTLM
How it works: the attacker tries one or two common passwords against many accounts through any NTLM endpoint: SMB, Exchange web services, or internal web applications.
ATT&CK: T1110.003 (Password Spraying).
On the wire and in logs: on domain controllers, bursts of Event 4776 with error 0xC000006A (wrong password) across many accounts from the same workstation name. Watch for 0xC0000064 (no such user) as well, which shows the attacker is guessing account names.
Detection engineering
Log sources
| Source | Event or field | What to look for |
|---|---|---|
| Domain controller Security log | 4776, credential validation | Error codes: 0xC000006A wrong password, 0xC0000064 unknown user, 0xC0000234 locked out, 0xC0000072 disabled, 0xC0000071 expired password |
| Member server Security log | 4624, logon type 3 | Authentication Package NTLM, Package Name NTLM V1 or NTLM V2, Workstation Name, Source Network Address |
| Attacker's or admin workstation | 4624, logon type 9 | Logon process seclogo: alternate credentials used for network access, including pass-the-hash |
| Microsoft-Windows-NTLM/Operational | 8001 to 8004 | NTLM audit events once the Restrict NTLM audit policies are on. Event 8004 on domain controllers lists the server (as Secure Channel name), user, domain, and workstation for each pass-through |
| Microsoft-Windows-NTLM/Operational (enhanced logging) | 4020 and 4021, 4022 and 4023, 4032 and 4033 | Outgoing NTLM from a machine, incoming NTLM to a machine with the process involved, and pass-through requests a domain controller handled. |
| Microsoft-Windows-NTLM/Operational | 4024 and 4025 | NTLMv1-derived credentials used for single sign-on (4024, audit mode) or blocked (4025, enforce mode), controlled by the BlockNtlmv1SSO registry value (Microsoft KB5066470) |
Zeek ntlm.log | username, hostname, domainname, server_*_name, success | New user and server pairs, workstation names that do not match the source address |
Zeek conn.log | Destination port 445 or 139 to public addresses | NTLM leaking out of the network |
Zeek http.log | Authorization headers starting with NTLM or Negotiate | NTLM to external or unusual web servers |
Example detections
Relay indicator: claimed workstation does not match the real source, as pseudo-SQL:
-- NTLM network logons where the workstation name in the message
-- does not match the host that actually connected
SELECT e.TargetUserName, e.WorkstationName, e.IpAddress, a.hostname AS actual_host
FROM security_4624 e
JOIN asset_inventory a ON a.ip = e.IpAddress
WHERE e.LogonType = 3
AND e.AuthenticationPackageName = 'NTLM'
AND upper(e.WorkstationName) <> upper(a.hostname);
Expected false positives: VPN concentrators and NAT, which hide the real client address, and stale inventory after DHCP changes. Build an exclusion list for those ranges.
NTLMv1 in use, as Sigma-style YAML:
title: NTLMv1 network logon
logsource:
product: windows
service: security
detection:
selection:
EventID: 4624
AuthenticationPackageName: NTLM
LmPackageName: 'NTLM V1'
condition: selection
falsepositives:
- Old devices and applications. Each one is a finding to fix, not to tune out.
level: medium
Pass-the-hash on the source machine, as Sigma-style YAML:
title: Logon with alternate credentials for network use
logsource:
product: windows
service: security
detection:
selection:
EventID: 4624
LogonType: 9
LogonProcessName: 'seclogo'
condition: selection
falsepositives:
- Administrators using runas /netonly on purpose. Review the account and the machine.
level: high
NTLM leaving the network, as pseudo-SQL over Zeek data:
SELECT orig_h, resp_h, COUNT(*) AS connections
FROM conn_log
WHERE resp_p IN (139, 445)
AND NOT is_private(resp_h)
AND ts > now() - INTERVAL '1 day'
GROUP BY orig_h, resp_h;
Any result here deserves a look: internal Windows machines have almost no legitimate reason to speak SMB to the internet, and this pattern is exactly how hashes leaked in the CVE-2023-23397 attacks.
Prevention and hardening
In order of impact:
- Block outbound SMB (139 and 445/TCP) to the internet at the firewall. This one rule stops hash leaks to external servers.
- Require SMB signing on every server and workstation, not only domain controllers.
- Enforce LDAP signing and LDAP channel binding on all domain controllers.
- Require Extended Protection for Authentication on AD CS web enrollment and other IIS applications that use Windows authentication, or turn off HTTP enrollment where it is not needed.
- Turn off LLMNR and NetBIOS over TCP/IP everywhere you can.
- Set the LAN Manager authentication level to "Send NTLMv2 response only. Refuse LM and NTLM", after confirming no device still needs NTLMv1.
- Stop the Print Spooler service on domain controllers and on servers that do not print, and apply the patches and RPC filters for the coercion methods above.
- Give every machine a unique local administrator password with Windows LAPS, so one stolen hash does not open the whole fleet.
- Add privileged accounts to the Protected Users group, which stops NTLM for them entirely.
- Turn on Credential Guard where supported, which keeps NT hashes out of reach of tools that read LSASS memory.
- Audit NTLM, fix what depends on it, then restrict it, following the sequence in the configuration section.
- Monitor with the detections above, and treat any NTLMv1, any outbound SMB, and any workstation-name mismatch as findings to investigate.
Incident response and remediation
When NTLM abuse is suspected:
- Scope. Pull Events 4624, 4776, and 4625 from domain controllers and affected servers, and
ntlm.logandconn.logfrom network sensors. Identify the accounts used, the machines they came from, and where they went. - Find the source of the credentials. A poisoning host on the network, a coerced server, or a dumped hash each need a different fix. Isolate any host that was answering LLMNR or NBT-NS, and any host that relayed authentication.
- Reset the affected passwords. For accounts whose hashes were stolen, a password change makes the old hash useless. For local administrator accounts, rotate them across all machines, ideally by deploying Windows LAPS.
- Undo what the relay changed. If LDAP was reached, look for new computer accounts, changes to
msDS-AllowedToActOnBehalfOfOtherIdentity, newmsDS-KeyCredentialLinkvalues (shadow credentials), and new group memberships. - Revoke certificates. If AD CS web enrollment was abused, revoke the certificates issued during the attack window. Certificates keep working after password resets.
- Close the path that was used: signing, channel binding, Extended Protection, LLMNR, the Print Spooler, or outbound SMB.
- Watch for return. Keep the detections at high priority for several weeks.
Real-world cases
- CVE-2023-23397: an Outlook flaw let attackers send a calendar item whose reminder sound pointed to an external SMB path. Outlook connected and leaked the user's NetNTLMv2 response with no user interaction. Microsoft reported that a Russia-based threat actor exploited it against government, transportation, energy, and military organizations in Europe, and later attributed the activity to the group it tracks as Forest Blizzard, also known as APT28. Microsoft also noted that Windows sent these hashes to internet hosts only over SMB, which is why Microsoft listed blocking outbound port 445 as a mitigation for machines not yet patched.
- CVE-2021-36942, PetitPotam: coercion through the encrypting file system RPC interface. Combined with relay to AD CS web enrollment, it gave a path from network access to full domain compromise, and pushed many organizations to enable Extended Protection on certificate services.
- CVE-2019-1040, Drop the MIC: a flaw that let attackers strip NTLM's message integrity check and relay authentication across protocols, such as from SMB to LDAP.
- Responder: the open-source tool that made LLMNR and NBT-NS poisoning a routine first step in internal penetration tests. It remains one of the fastest ways testers find credentials on networks where those protocols are still on.
Framework mappings
NTLM in the news
News stories tagged with NTLM. This list updates on its own while the page is open.
No news stories are tagged with this topic yet.
Frequently asked questions
Do we still use NTLM if we have Kerberos?
Almost certainly. Connections by IP address, local accounts, non-domain devices, and many applications still use NTLM. Turn on NTLM auditing to see how much, before planning any restriction.
What is the difference between an NT hash and a NetNTLMv2 hash?
The NT hash is the stored secret, MD4 of the password, and it can be used directly for pass-the-hash. A NetNTLMv2 response is what crosses the network during one authentication. It cannot be passed, but it can be relayed in real time or cracked offline.
Does SMB signing stop NTLM relay?
It stops relay to SMB servers that require signing. Relay to LDAP, LDAPS, and HTTPS needs its own defenses: LDAP signing, LDAP channel binding, and Extended Protection for Authentication.
Can we turn NTLM off completely?
Not safely in one step. Audit NTLM use, fix the sources, block it for privileged accounts through Protected Users, then deny it by policy with a short exception list. Microsoft has deprecated NTLM, so the work pays off over time.
How does network detection spot NTLM relay?
The clearest signs are one user authenticating to two servers almost at the same moment, a workstation name in the NTLM message that does not match the machine that connected, and authentication arriving from hosts that answered LLMNR or NBT-NS queries.
References and further reading
- Microsoft Learn: NTLM overview
- Microsoft Learn: Event 4776, the computer attempted to validate the credentials for an account
- Microsoft Learn: Event 4624, an account was successfully logged on
- Zeek script reference: NTLM analyzer (base/protocols/ntlm)
- Responder (LLMNR, NBT-NS and mDNS poisoner)
- Microsoft KB5064479: NTLM auditing enhancements in Windows 11 24H2 and Windows Server 2025
- Microsoft KB5066470: Manage NTLMv1 changes in Windows
- MITRE ATT&CK Enterprise matrix
- MITRE CWE list
- NIST Computer Security Resource Center glossary
Found a technical error in this entry? Tell us and we will fix it.