How the attack works
dSHeuristics is an attribute of the object CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration in the forest root. It is a string in which each character position is a switch for the behavior of every domain controller in the forest. By default the attribute is not set and every position counts as 0. A new value replicates with the configuration partition and takes effect without a restart.
Several positions carry security weight. The seventh character set to 2 allows anonymous LDAP operations beyond searches of the rootDSE. The eighth allows anonymous calls to the address book (NSPI) interface. The sixteenth is a mask that takes Account Operators, Server Operators, Print Operators and Backup Operators out of the groups AdminSDHolder protects, so that the access control lists of their members are no longer reset every hour. The twenty-first can switch off the uniqueness checks for user principal names and service principal names. The twenty-eighth and twenty-ninth control the permission checks Microsoft added for CVE-2021-42291, and the thirty-first can drop the encryption requirement for confidential attributes on Windows Server 2025.
An attacker who can write to the configuration partition changes the string to open a door for later, for example anonymous reads of the directory, or an operator group on which a planted permission is no longer removed. The change is a single directory write and looks like configuration. With an audit entry (SACL) on the Directory Service object, the domain controller that receives the write logs event 5136 with the previous string (Value Deleted) and the new one (Value Added).
What an attacker needs
- Write access to the Directory Service object in the configuration partition. That is normally limited to forest-level administrators, so the change usually follows the compromise of such an account, or relies on an access control entry in the configuration partition that is too broad.
Impact
The effect depends on the position that was changed. Anonymous LDAP or NSPI access lets anyone on the network read directory data without credentials. Taking operator groups out of AdminSDHolder protection lets a permission planted on one of their members survive, which keeps a path to accounts that can sign in to domain controllers. Switching off the uniqueness checks or the 2021 permission checks reopens the attacks those checks were added against. The setting applies to the whole forest and tends to stay unnoticed.
Detection rules
dSHeuristics Attribute Changed
Detects a write to the dSHeuristics attribute (event 5136), the forest-wide string on the Directory Service object of the configuration partition whose characters control, among other things, anonymous LDAP and NSPI access and which operator groups AdminSDHolder protects. The rule matches every operation type, so that clearing the attribute is seen as well. A replacement therefore produces two events, Value Deleted with the previous string and Value Added with the new one, linked by OpCorrelationID. Requires the audit subcategory Audit Directory Service Changes and an audit entry (SACL) for writes on the Directory Service object.
title: dSHeuristics Attribute Changed
id: dd6bf451-608a-40a2-a0a2-22cd7798e6a3
status: experimental
description: >-
Detects a write to the dSHeuristics attribute (event 5136), the forest-wide
string on the Directory Service object of the configuration partition whose
characters control, among other things, anonymous LDAP and NSPI access and
which operator groups AdminSDHolder protects. The rule matches every
operation type, so that clearing the attribute is seen as well. A replacement
therefore produces two events, Value Deleted with the previous string and
Value Added with the new one, linked by OpCorrelationID. Requires the audit
subcategory Audit Directory Service Changes and an audit entry (SACL) for
writes on the Directory Service object.
references:
- https://attack.mitre.org/techniques/T1484/
- https://learn.microsoft.com/en-us/windows/win32/adschema/a-dsheuristics
- https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-adts/e5899be4-862e-496f-9a38-33950617d2c5
- https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-5136
author: Forestall
date: 2026-11-14
tags:
- attack.defense-impairment
- attack.privilege-escalation
- attack.t1484
logsource:
product: windows
service: security
detection:
selection:
EventID: 5136
AttributeLDAPDisplayName: dSHeuristics
condition: selection
falsepositives:
- Planned changes by forest administrators, such as turning on list object mode, the enforcement mode of KB5008383, or settings a product installation guide asks for. They are rare. Match the new string to a change record and to Microsoft's table of positions.
level: high
False positives
- Planned changes by forest administrators, such as turning on list object mode, the enforcement mode of KB5008383, or settings a product installation guide asks for. They are rare. Match the new string to a change record and to Microsoft's table of positions.
Triage
- Compare the Value Deleted and Value Added events that share an OpCorrelationID, position by position. The tenth, twentieth and thirtieth characters are fixed (1, 2 and 3) and carry no setting.
- Look up every changed position in Microsoft's dSHeuristics table and decide whether it weakens security. Positions 7, 8, 16, 21, 28, 29 and 31 are the ones to check first.
- Identify the writer (SubjectUserName, SubjectLogonId) and the matching logon (4624) with its source address. Ask the forest administrators whether the change was planned, for example list object mode or the KB5008383 enforcement.
- If the change is not explained, restore the previous value and look for what the new one allowed, such as anonymous LDAP sessions, or access control changes on members of the operator groups.
Response
Once the attack is confirmed:
- Disable the account that wrote the attribute. Write access to the Directory Service object is normally limited to forest-level administrators, so treat the account as compromised at that level.
- After the previous string has been restored, confirm on domain controllers in every domain that the restored value has replicated. The setting takes effect without a restart, in both directions.
- Clean up what the changed position allowed. For the sixteenth character, review and correct the access control lists of the members of Account Operators, Server Operators, Print Operators and Backup Operators. For the twenty-first, look for duplicate user principal names and service principal names created in that time.
- If anonymous LDAP or NSPI access was opened, assume that directory data such as account names was read without credentials, and watch for password guessing against those accounts.
- Review the access control entries on the Services container of the configuration partition, and remove write access that goes beyond the forest administrators.
Mitigation
- Keep
dSHeuristicsunset or limited to documented values, and record the approved string so that any difference stands out. - Leave the seventh and eighth characters at 0 so that anonymous LDAP and NSPI access stay blocked. If a legacy application needs anonymous access, isolate that application instead of opening the forest.
- Leave the sixteenth character at 0 so that AdminSDHolder protects the operator groups.
- Set the twenty-eighth and twenty-ninth characters to 1 (enforcement) as Microsoft describes in KB5008383, and never to 2 (disabled).
- Keep the number of forest-level administrators small and review the access control entries on the Services container of the configuration partition.
- Add an audit entry (SACL) for Everyone, Write all properties, on the Directory Service object and enable the audit subcategory Audit Directory Service Changes on domain controllers, so that event 5136 is written.
Frequently asked questions
Does a dSHeuristics change need a restart of the domain controllers to take effect?
No. The new value replicates with the configuration partition and takes effect on every domain controller in the forest without a restart. The exposure begins as soon as replication has delivered the change, and a restored value takes effect in the same way.
Which positions of the string should be checked first?
Positions 7 and 8 (anonymous LDAP and NSPI access), 16 (operator groups taken out of AdminSDHolder protection), 21 (uniqueness checks for user and service principal names), 28 and 29 (the permission checks added for CVE-2021-42291) and 31 (encryption for confidential attributes on Windows Server 2025). The tenth, twentieth and thirtieth characters are fixed and carry no setting.
Why does one change of the attribute produce two events?
The rule matches every operation type, so that clearing the attribute is seen as well. A replacement is logged as two 5136 events, Value Deleted with the previous string and Value Added with the new one, linked by the same OpCorrelationID. Read them together and compare the strings position by position.
Is there a legitimate reason to change dSHeuristics?
Yes, but rarely. Forest administrators change it to turn on list object mode, to enable the enforcement mode of KB5008383, or because a product installation guide asks for a setting. Each of these is planned. Match the new string to a change record and to Microsoft's table of positions before closing the alert.
References
- MITRE ATT&CK T1484: Domain or Tenant Policy Modification
- DS-Heuristics attribute
- MS-ADTS 6.1.1.2.4.1.2: dSHeuristics (meaning of each character)
- Anonymous LDAP operations to Active Directory are disabled on domain controllers
- Delegated permissions are not available and inheritance is automatically disabled (AdminSDHolder exclusion bits)
- KB5008383: Active Directory permissions updates (CVE-2021-42291)
- Unexpected results for operations on confidential attributes on Windows Server 2025 domain controllers
- Event 5136: A directory service object was modified