1. Resources
  2. Detection sources
  3. Event ID 3040

Event ID 3040: During the previous 24 hour period, # of unprotected LDAPs binds were performed

Daily summary of a domain controller that does not validate LDAP channel binding tokens (policy Never): the number of binds over TLS in the past 24 hours that channel binding did not protect. Written at the default level.

Log source
Directory Service log
Detection value
Context
Volume
Low
Last updated
Log
Directory Service log (Microsoft-Windows-ActiveDirectory_DomainService, on by default)
Logged on
Domain controllers only
Event versions
Not published
Detects
Not read by our detection rules yet

When it is written

A domain controller writes 3040 to its Directory Service log every 24 hours when its policy Domain controller: LDAP server channel binding token requirements is Never and at least one unprotected LDAPS bind completed in that period (Microsoft's wording; it does not say whether binds protected by STARTTLS on port 389 are counted as well). KB4520412 added it with the March 10, 2020 updates and lists it at minimum diagnostic level 0, so it needs no change to be written. Microsoft's description gives the number of such binds; it does not print the rest of the message, does not name the clients and does not define "unprotected" further. Microsoft's channel binding overview calls the event a 24-hour summary of completed, unprotected LDAPS binds.

Never is the default on Windows Server 2022 and earlier, so most domain controllers that serve LDAP over TLS write it. Microsoft states that new Windows Server 2025 deployments default to When supported, where the event is not expected.

Why a defender reads it next to the events the rules read: the library's NTLM relay rules read 3039, 3074 and 3075, and Microsoft states that a domain controller generates those only when the channel binding policy is When supported or Always. At Never, 3040 is the only sign that LDAP over TLS is in use without channel binding, and Microsoft's channel binding overview rates a SASL bind over TLS without a channel binding token as open to NTLM relay.

How to turn it on

Microsoft-Windows-ActiveDirectory_DomainService writes the event to the Directory Service log (Event Viewer > Applications and Services Logs > Directory Service), which is on by default. Microsoft

The log needs nothing to be turned on: a domain controller writes it from the moment it is promoted. What Active Directory writes there depends on its diagnostic logging levels, one REG_DWORD value per category under HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics (for example 16 LDAP Interface Events), each from 0 (None) to 5 (Internal). Microsoft's default for every category is 0, which it describes as recording only critical and error events; several warning and information events of this library are nonetheless documented as written at that level (the CVE-2021-42291 events, the daily LDAP summaries). Some events, such as the per-client LDAP signing and channel binding events, are written only at level 2 or higher of their category; their pages say so.

Microsoft recommends keeping the levels at 0 unless you investigate an issue, notes that a higher level adds detail and events, and advises against 3 or more because it costs resources and can slow the server. The levels are set per domain controller, so set them on every domain controller whose events you need. AD LDS instances write the same kind of events to their own instance log, which this library does not cover.

Show the diagnostic logging levels of this domain controller
reg query "HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics"
Based on vendor documentation.
Show the log's settings (size and retention)
wevtutil gl "Directory Service"
Based on vendor documentation.

Nothing to turn on: KB4520412 lists the event at diagnostic level 0. It appears only while the channel binding policy is Never. Read the policy's registry value (LdapEnforceChannelBinding: 0 Never, 1 When supported, 2 Always):

reg query "HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Parameters" /v LdapEnforceChannelBinding

A missing value means the policy is not set; Microsoft states that Windows Server 2022 and earlier are at Never and that new Windows Server 2025 deployments default to When supported.

Fields

The template of this event is not part of client Windows and Microsoft does not publish its XML field names, so the fields are named by the labels of Microsoft’s documentation.

FieldWhat it holds
DescriptionThe event text as KB4520412 gives it, with the number of unprotected binds over TLS in place of #. Microsoft does not print the rest of the message: the event names no client, address or account.

Values to know

Description

ValueMeaningSignal
A stable count from known LDAPS clientsApplications and appliances that bind over TLS without channel bindingMicrosoft's remedy: identify each device type and update or reconfigure it, then move the policy to When supported and later Always.Noise
A count on a domain controller that never wrote 3040, or a jumpA new source of binds over TLS without channel bindingAt Never there is no per-client event: Microsoft lists none for this policy. Network captures on the domain controller or the When supported policy with diagnostic level 2 name the clients.Worth knowing

Volume and noise

Domain controllers that serve LDAP over TLS write 3040 every day while the policy is Never: applications, appliances and systems that do not run Windows bind over LDAPS, and few of them send channel binding tokens. The count follows how much LDAP over TLS the domain controller serves.

Keeping it manageable

  • Collect 3040 from every domain controller and keep the count as a number, so that a jump or a domain controller that starts writing it stands out.
  • Use it as a configuration finding: a domain controller that writes 3040 does not generate the channel binding events 3039, 3074 and 3075 that the library's relay rules read.
  • Plan the move to When supported: Microsoft's recommended actions are diagnostic level 2 and monitoring 2889, 3039, 3074 and 3075, which this policy makes possible. Under When supported a client that is capable of channel binding and sends no token fails (3039), so find such clients first.

Attacks this event reveals

No detection rule or detection logic in our library reads this event yet. It is documented here because it sits next to the events they read: it explains them, follows from them or is the trace a defender looks for around them (see Related events).

Frequently asked questions

What does event 3040 mean?

The domain controller does not validate LDAP channel binding tokens (policy Never), and in the previous 24 hours clients completed binds over LDAP with TLS that channel binding did not protect. The event gives their number and no client.

Why do I see event 3040 but never 3039, 3074 or 3075?

Microsoft states that 3039, 3074 and 3075 are generated only when the channel binding policy is When supported or Always, and they also need the 16 LDAP Interface Events diagnostic level at 2. At Never, the default on Windows Server 2022 and earlier, the domain controller writes only the daily count 3040 and the reminder 3041.

How do I find the clients counted in event 3040?

Microsoft documents no per-client event under the Never policy. Its guidance is to set the diagnostic level to 2 and use the channel binding events, which need When supported or Always, and to use network captures and tracing to identify what binds. Under When supported, a client that is capable of channel binding and sends no token is rejected (3039), so check first which clients that could be.

Is event 3040 a sign of an NTLM relay?

Not on its own: it is a daily count of binds that are common wherever LDAP over TLS is used without channel binding. It does show that the domain controller accepts SASL binds over TLS without a channel binding token, which Microsoft's channel binding overview rates as open to NTLM relay.

References