Auditing and Restricting NTLM Use: The Order of Work in the Field

How do you find and restrict NTLM use? A dependency inventory with events 8004 and 4624, turning off NTLMv1, SMB/LDAP signing, channel binding and recorded exceptions.
Technical summary
Technology
NTLM, NTLMv2, Kerberos, SMB signing, LDAP signing, LDAP channel binding, Group Policy, PowerShell
Topic
NTLM inventory and phased restriction in Active Directory
Level
Intermediate–advanced
Prerequisites
  • GPO management rights on the Domain Controllers and server OUs
  • Access to DC event logs, or a SIEM
  • A pilot group of servers and clients for testing
In this article8 sections

Wherever Kerberos doesn’t work, Windows silently falls back to NTLM and nobody notices. A network drive connected by IP address, a scanner outside the domain, a service account with a missing SPN: all of them keep NTLM alive. In this guide we explain, in the order we apply it in the field, how to find NTLM dependencies in an Active Directory environment with audit policies, turn off NTLMv1 and LM, cut relay on the SMB and LDAP side, and manage exceptions for applications that can’t be switched off.

Why NTLM is still a problem

NTLM is a challenge–response protocol: the server sends a random value, and the client processes it with a key derived from the user’s password hash (NT hash) and sends it back. The structural consequences of this design are:

  • The hash stands in for the password. Producing the response doesn’t require the clear-text password; the NT hash is enough. A hash stolen from one machine can be used to authenticate on other systems.
  • There is no mutual authentication. The client doesn’t verify that the server it’s talking to is really the server it intended. That’s why intercepting the authentication and passing it on to another target (relay) is possible.
  • NTLMv1 and LM are cryptographically weak. Getting the NT hash from captured NTLMv1 responses is feasible in practice. The LM hash should never be used at all.
  • Verification happens via the DC. For domain accounts, the server turns to the DC to verify the response (pass-through). That’s why the trail of NTLM traffic is clearest on DCs.

Microsoft has added all versions of NTLM to its list of deprecated features; in the long run it aims to cover the scenarios NTLM handles with Kerberos extensions such as IAKerb, and NTLMv1 support is also being narrowed separately in new Windows versions. Verify the current per-version status in Microsoft’s NTLM overview documentation. The practical conclusion is simple: NTLM won’t be switched off in a day. First it becomes visible, then it shrinks.

Relay and pass-the-hash: what we’re cutting

Turning on GPOs without knowing which attack each restriction step targets is flying blind. Let’s look at two scenarios from the defender’s side.

NTLM relay

The attacker gets a client on the network to authenticate to them: through LLMNR/NBT-NS poisoning, or through RPC calls that force a server to authenticate (coercion). They pass the incoming NTLM messages on to another target in real time: an SMB server where signing isn’t required, a DC that accepts unsigned LDAP, or the AD CS web enrollment (certsrv) interface that accepts authentication over HTTP. If the victim is a DC’s computer account and the target is AD CS, it goes as far as a full domain compromise. The controls that cut relay are well known: SMB signing, LDAP signing, LDAP channel binding, and Extended Protection for Authentication (EPA) on HTTP services.

Pass-the-hash

An attacker who is local administrator on a workstation collects the NT hashes of accounts signed in on that machine from LSASS memory and uses them to reach other servers over NTLM. NTLM restriction alone isn’t enough here. The real controls are limiting which machines administrator accounts sign in on (Active Directory tier model), using a different local administrator password on every machine (Windows LAPS), Credential Guard, and putting privileged accounts in the Protected Users group. Protected Users members can’t authenticate with NTLM; the group is also a good NTLM restriction tool.

Policies for auditing NTLM use

Inventory before restriction. The relevant settings are under Computer Configuration\Windows Settings\Security Settings\Local Policies\Security Options, with the prefix “Network security: Restrict NTLM”. Nothing is blocked during the audit phase; events are only generated.

Setting Where Audit value
Audit NTLM authentication in this domain Domain Controllers GPO Enable all
Audit Incoming NTLM Traffic Servers, DCs Enable auditing for all accounts
Outgoing NTLM traffic to remote servers Clients, servers Audit all

Events go to the Applications and Services Logs → Microsoft → Windows → NTLM → Operational log. Event 8004 on DCs for domain-wide NTLM verifications, and event 8001 on the client side for outgoing NTLM traffic, are the most useful sources. This log’s default size is small. That’s also the mistake we see often: auditing is turned on, the log overwrites itself within a few hours, and weeks later there’s no meaningful data. Increase the size for the audit period or forward the events to the SIEM.

The second source is the Security log. In successful sign-in event 4624, the Authentication Package and Package Name (NTLM only) fields show which protocol and NTLM version were used. On DCs, event 4776 records NTLM credential validation.

# Recent NTLM verifications on a DC (8004) - source workstation and target server
Get-WinEvent -LogName 'Microsoft-Windows-NTLM/Operational' -MaxEvents 5000 |
  Where-Object Id -eq 8004 |
  Select-Object TimeCreated, Message |
  Export-Csv .\ntlm-8004.csv -NoTypeInformation -Encoding UTF8

# Sign-ins made with NTLMv1 on any server
Get-WinEvent -LogName Security -FilterXPath "*[System[EventID=4624] and EventData[Data[@Name='LmPackageName']='NTLM V1']]" -MaxEvents 500 |
  ForEach-Object { $x = [xml]$_.ToXml()
    [pscustomobject]@{
      Time    = $_.TimeCreated
      Account = ($x.Event.EventData.Data | Where-Object Name -eq 'TargetUserName').'#text'
      Source  = ($x.Event.EventData.Data | Where-Object Name -eq 'IpAddress').'#text'
    } }

Reduce the collected data to source device – target server – account triples and group them. The same suspects always come out at the top of the list: network drives mapped by IP address (since the Kerberos SPN is tied to the name, access by IP falls back to NTLM), the “scan to folder” feature of multifunction printers, devices that aren’t domain members, service accounts with missing or duplicate SPNs, servers behind DNS CNAMEs and old application servers. Most of these are fixed before touching NTLM: a correct SPN record, access by name, cleaning up duplicate SPNs with setspn -X. Half of the inventory is configuration errors.

Turning off NTLMv1 and LM

NTLMv1 and LM can, and should, be turned off long before full NTLM restriction. The controlling setting is Network security: LAN Manager authentication level (in the registry, HKLM\SYSTEM\CurrentControlSet\Control\Lsa\LmCompatibilityLevel).

Value Meaning Note
3 Send NTLMv2 response only The client side is safe; the DC still accepts v1
5 Send NTLMv2 only; refuse LM and NTLM Target value; DCs refuse v1

The order is: first find the sources using NTLMv1 with the 4624 query above, fix them, then apply value 5 to all systems, starting with the DCs. When the value is 5 on the DC, NTLMv1 verification for domain accounts is refused whatever the client sends. The DC is what decides. In the same GPO, also tighten these:

  • Network security: Do not store LAN Manager hash value on next password change → Enabled (on by default in current Windows versions; enforcing it explicitly provides evidence in audits).
  • Network security: Minimum session security for NTLM SSP based clients / servers → Require NTLMv2 session security and Require 128-bit encryption.

SMB signing, LDAP signing and channel binding

Relay depends on the relayed authentication signing in on the target. Signing makes integrity protection of the session with a key derived from the authentication mandatory; the party in the middle can’t produce a valid signature. The relay comes to nothing.

Check GPO setting Target value
SMB server signing Microsoft network server: Digitally sign communications (always) Enabled
SMB client signing Microsoft network client: Digitally sign communications (always) Enabled
LDAP signing (DC) Domain controller: LDAP server signing requirements Require signing
LDAP client Network security: LDAP client signing requirements Negotiate signing or Require signing
LDAP channel binding Domain controller: LDAP server channel binding token requirements First When supported, then Always

Before enforcing LDAP signing, find the clients that do unsigned binds. On DCs, event 2887 in the Directory Service log gives a 24-hour summary; when you turn on diagnostic logging, event 2889 lists each client IP and account doing an unsigned bind:

# On the DC, set the LDAP Interface Events diagnostic level to 2 (for 2889 events)
reg add "HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics" /v "16 LDAP Interface Events" /t REG_DWORD /d 2 /f

# Clients doing unsigned binds
Get-WinEvent -LogName 'Directory Service' -FilterXPath "*[System[EventID=2889]]" -MaxEvents 1000 |
  Select-Object TimeCreated, Message

Channel binding protects against relay over LDAPS (TLS) and closes the gap signing doesn’t cover. When detection is complete, set the diagnostic level back to 0; diagnostic logging left on is unnecessary load and noise on the DC. Where we get stuck with SMB signing is usually old NAS devices and printers: some models don’t support signed SMB, and some do but slow down. SMB signing defaults have been tightened in new Windows versions; check the default behavior of the versions in your environment. If you use AD CS, turn on EPA with HTTPS on HTTP endpoints such as web enrollment and CES/CEP, and remove the web enrollment role if it’s unused.

Application compatibility and the exception list

For each NTLM dependency that comes out of the audit, a single decision is made: fix, replace or grant an exception. An exception is the last option. It’s kept as a record with an owner, a justification and an end date; otherwise it becomes permanent.

  • Fixable: access by IP, a missing SPN, SPN mismatches caused by CNAMEs, application settings that support Kerberos but are forced to NTLM.
  • To be replaced: devices and software using NTLMv1 that are no longer supported by their vendor.
  • Exception: business-critical systems that can’t be replaced in the near term.

There are two settings for exceptions: on DCs, Network security: Restrict NTLM: Add server exceptions in this domain, and on the client/server side, Add remote server exceptions for NTLM authentication. Server names (FQDN or NetBIOS) are written into the list one entry per line; the * wildcard can be used at the start of a name. Be careful: broad wildcard patterns effectively spread the exception across the domain. Keeping the excepted server in a separate VLAN, allowing access only from the necessary clients and not signing in to that server with administrator accounts limits the risk.

A phased restriction plan

The order below narrows the attack surface at every step while keeping the risk of outages low. Let at least one month-end close and one patch cycle pass between phases. That’s the only way a monthly payroll job or a quarterly report becomes visible.

  1. Visibility: Turn on all audit settings, send the NTLM and Security logs to the SIEM, and build the inventory table.
  2. Quick wins: Turn off LLMNR and NBT-NS, disable the Print Spooler service on DCs, and apply the Protected Users group to privileged accounts.
  3. NTLMv1 and LM: Set LmCompatibilityLevel to 5.
  4. Signing: Enforce SMB signing on servers and clients; turn on LDAP signing and channel binding first in compatibility mode, then in enforced mode.
  5. Targeted blocking: Block outgoing NTLM from Tier 0 systems (DCs, AD CS, backup and identity infrastructure) with Outgoing NTLM traffic to remote servers = Deny all; add exceptions if needed.
  6. Domain-wide: As the inventory is cleaned up, apply the NTLM authentication in this domain setting first at a narrow level such as “Deny for domain accounts to domain servers”, then at broader levels.

Each phase is verified the same way: watch the number of 8004 events and unique source–target pairs go down, and match help desk tickets after blocking against NTLM. When an “I can’t access the share” call comes in, the first place to look is that client’s 8001 and that server’s 8004 records. For the complementary work on the Kerberos side, see the Kerberoasting detection and protection guide, and for general audit items, the Active Directory security controls. An NTLM inventory and restriction plan across the whole environment is a natural part of an Active Directory security audit; the GPO settings should also go into the server hardening standards.

Frequently asked questions

Is it possible to turn off NTLM completely across the domain?

Technically yes, but in most environments it first takes a long inventory and remediation process. The realistic goal is this: NTLMv1 and LM completely off, NTLM blocked from Tier 0 systems, relay cut with signing, and the remaining NTLM use reduced to exceptions with known owners.

Does turning on audit mode affect performance?

Audit settings only generate events; they don’t block authentication. In busy environments the NTLM Operational log fills up quickly; increase the log size or forward the events to the SIEM.

Does SMB signing slow down file servers?

Signing adds processing overhead; its impact depends on the hardware, SMB version and workload. Measure on a pilot before enforcing it on high-traffic file servers, and separately test signed SMB support on old NAS units and printers.

Does the Protected Users group replace NTLM restriction?

No. Protected Users only blocks member accounts from authenticating with NTLM. For service accounts and normal users, auditing, turning off NTLMv1, signing and the Restrict NTLM settings are still needed.

Support

Contact us for support or a discovery session on this topic.

Contact form
[email protected]

Eretek Cybersecurity

Firewall, VPN, endpoint security and threat prevention. We reduce the attack surface and measure and report the risks.

Knowledge Center

Other articles