1. Resources
  2. Detection rules
  3. DSRM Administrator Password Set

DSRM Administrator Password Set detection rules

Each domain controller has a local Directory Services Restore Mode administrator. Setting its password and letting it log on while AD DS runs gives an attacker a hidden local admin on the DC.

Platform
Active Directory
Severity
High
Log source
Windows Security event log
Last updated
MITRE ATT&CK technique
T1098Account Manipulation
Rule formats
Sigmaand queries for: SplunkMicrosoft SentinelIBM QRadar
What an attacker needs
Administrative rights on a domain controller, which allow setting the DSRM password and the registry value that lets the account log on at any time.
Impact
The attacker keeps administrator access to the domain controller, and through it to the domain, even after every domain account password has been reset.
Response
Set DsrmAdminLogonBehavior back to 0 on the affected domain controller first, then reset the DSRM password on every domain controller and disable the account that set it.
Mitigation
Manage the DSRM password with Windows LAPS, keep DsrmAdminLogonBehavior unset or 0 on all domain controllers, and restrict administrative logon to Tier 0 administrators.
Event IDs
46574794

How the attack works

Every domain controller has a local Administrator account for logging on in Directory Services Restore Mode (DSRM). It lives in the DC's local SAM database rather than in Active Directory, its password is set at promotion, and changes to it are invisible in the directory.

An attacker with administrative rights on a domain controller can set the DSRM password to a known value and set the DsrmAdminLogonBehavior registry value under HKLM\System\CurrentControlSet\Control\Lsa to 2, which allows the DSRM account to log on at any time, including over the network. The result is a local administrator on the domain controller that survives domain password resets. Setting the password is logged as event 4794 on the DC; the registry change is logged as event 4657 when the Lsa key has a SACL that audits Set Value.

What an attacker needs

  • Administrative rights on a domain controller.

Impact

The attacker keeps administrator access to the domain controller, and through it to the domain, even after every domain account password has been reset.

Detection rules

DSRM Administrator Logon Behavior Changed

Detects a change to the DsrmAdminLogonBehavior registry value (HKLM\System\CurrentControlSet\Control\Lsa) in event 4657. A value of 2 lets the DSRM administrator log on to the domain controller at any time, including over the network, turning the DSRM account into a persistent local administrator. Requires Audit Registry and a SACL that audits Set Value on the Lsa key.

LevelHighStatusExperimentalLog sourceWindows Security event log
title: DSRM Administrator Logon Behavior Changed
id: 91f45b05-37e2-4c5c-a66b-b461e198839e
status: experimental
description: >-
  Detects a change to the DsrmAdminLogonBehavior registry value
  (HKLM\System\CurrentControlSet\Control\Lsa) in event 4657. A value of 2 lets
  the DSRM administrator log on to the domain controller at any time, including
  over the network, turning the DSRM account into a persistent local
  administrator. Requires Audit Registry and a SACL that audits Set Value on the
  Lsa key.
references:
  - https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4657
  - https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-r2-and-2008/cc732714(v=ws.10)
author: Forestall
date: 2026-11-10
tags:
  - attack.persistence
  - attack.t1098
logsource:
  product: windows
  service: security
detection:
  selection:
    EventID: 4657
    ObjectValueName: DsrmAdminLogonBehavior
  condition: selection
falsepositives:
  - Single-domain-controller or isolated environments where an administrator deliberately set the value to 1 for recovery; values other than 0 should still be documented.
level: high

False positives

  • Single-domain-controller or isolated environments where an administrator deliberately set the value to 1 for recovery; values other than 0 should still be documented.

Directory Services Restore Mode Administrator Password Set

Detects an attempt to set the DSRM administrator password on a domain controller (4794). Microsoft recommends alerting on every occurrence: the DSRM account is a local administrator of the domain controller that is not managed in Active Directory, and setting its password is a known persistence step. Requires Audit User Account Management.

LevelHighStatusExperimentalLog sourceWindows Security event log
title: Directory Services Restore Mode Administrator Password Set
id: f614fa3d-ffca-413d-894f-438b16bd9279
status: experimental
description: >-
  Detects an attempt to set the DSRM administrator password on a domain
  controller (4794). Microsoft recommends alerting on every occurrence: the
  DSRM account is a local administrator of the domain controller that is not
  managed in Active Directory, and setting its password is a known persistence
  step.
  Requires Audit User Account Management.
references:
  - https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4794
author: Forestall
date: 2026-11-10
tags:
  - attack.persistence
  - attack.t1098
logsource:
  product: windows
  service: security
detection:
  selection:
    EventID: 4794
  condition: selection
falsepositives:
  - Scheduled DSRM password rotation by Tier 0 administrators. Windows LAPS can also manage the DSRM password; Microsoft does not document whether its rotations raise 4794 or with which subject, so check this in your environment before treating such events as expected. Verify against the change record or LAPS configuration rather than excluding the event.
level: high

False positives

  • Scheduled DSRM password rotation by Tier 0 administrators. Windows LAPS can also manage the DSRM password; Microsoft does not document whether its rotations raise 4794 or with which subject, so check this in your environment before treating such events as expected. Verify against the change record or LAPS configuration rather than excluding the event.

Detection logic

Patterns that need more than one event, a baseline or knowledge of your own environment. Each is a hypothesis to build and tune in your SIEM, not a ready rule.

Domain controller's local DSRM administrator logs on while the directory is running

Detection hypothesisNeeds your own lists

The DSRM administrator is the only local account of a domain controller. Outside a restore it should not log on at all, so a successful logon with it is the backdoor being used, whatever way the password and the registry value were set. The logon event names a local account by the computer's name in the account domain field, which separates it from the domain Administrator that shares RID 500.

  1. On every domain controller, take successful logons (event 4624) whose TargetUserSid ends in -500.
  2. Keep those whose TargetDomainName is the domain controller's own computer name rather than the domain's NetBIOS name, or whose TargetUserSid does not start with one of your domain SIDs. Microsoft documents that for a local account this field holds the computer name.
  3. Report each one with LogonType, IpAddress and WorkstationName; a network logon (type 3) or a remote interactive logon (type 10) is the strongest sign.
  4. On that domain controller, read DsrmAdminLogonBehavior and look for event 4794 or event 4657 before the logon.

Events462447944657

LimitsA planned restore in Directory Services Restore Mode, and maintenance with DsrmAdminLogonBehavior set to 1 while AD DS is stopped, produce the same logon and need a change record. The list of domain SIDs has to cover every domain in the forest. Audit Logon must be enabled on the domain controllers.

Triage

  • Check whether a DSRM password rotation was scheduled and who performed it (SubjectUserName and Workstation in 4794).
  • On the same domain controller, check DsrmAdminLogonBehavior and look for network logons by the DC's local Administrator account (4624 with a TargetUserSid ending in -500 that is not the domain Administrator).
  • If not explained, reset the DSRM password, set DsrmAdminLogonBehavior to 0 and investigate the account that made the change.

Response

Once the attack is confirmed:

  1. Set DsrmAdminLogonBehavior back to 0 on the affected domain controller before anything else. That closes the logon path while AD DS is running, even if the attacker still knows the DSRM password.
  2. Disable the domain account that set the password or changed the registry value, and isolate the hosts from which the local Administrator account of the domain controller logged on.
  3. Check the registry value and reset the DSRM password on every domain controller, not only the one that raised the alert. An account with administrative rights on one domain controller may have them on the others.
  4. Treat the domain controller, and through it the domain, as compromised for the time the backdoor existed.
  5. Confirm afterwards that the local Administrator account of a domain controller no longer logs on while AD DS is running.

Mitigation

  • Manage the DSRM password with Windows LAPS, or set a unique long password per domain controller, store it in a vault and rotate it after any compromise.
  • Keep DsrmAdminLogonBehavior unset or 0 on all domain controllers, enforce it through Group Policy and audit the Lsa key with a SACL.
  • Restrict administrative logon to domain controllers to Tier 0 administrators.

Frequently asked questions

Does resetting every domain password remove a DSRM backdoor?

No. The DSRM administrator is a local account in the SAM database of each domain controller, not an Active Directory account, so domain password resets do not touch it. The DSRM password has to be reset on the domain controller itself, and DsrmAdminLogonBehavior has to be returned to 0.

Is a new DSRM password alone enough for the attacker to log on?

Not while the domain controller runs normally with the default setting. By default the DSRM administrator can log on only when the domain controller is started in Directory Services Restore Mode. With DsrmAdminLogonBehavior set to 2 the account can log on at any time, including over the network. That is why the registry value matters as much as the password.

Why is the registry change not logged on our domain controllers?

Event 4657 is written only when Audit Registry is enabled and the Lsa key has a SACL that audits Set Value. Both have to be configured. Event 4794 for the password itself needs only Audit User Account Management, so the password change can be visible while the registry change is not.

Do Windows LAPS rotations of the DSRM password raise event 4794?

Microsoft does not document whether rotations by Windows LAPS raise event 4794 or with which subject. Check it in your own environment before treating such events as expected, and verify an event against the LAPS configuration or a change record instead of excluding it.

References

We respect your privacy

We use cookies to keep this site secure and working properly. With your permission, we also use optional cookies to understand usage and improve the experience. Cookie Policy

You can change your choice at any time.