Event ID 4794: dsrm administrator password set
What Event ID 4794 (dsrm administrator password set) means, the fields to check, what is normal and what is suspicious, with PowerShell and KQL queries to find it.
Event ID 4794 is logged on a domain controller when someone attempts to set the Directory Services Restore Mode (DSRM) administrator password. DSRM is the local administrator account every DC has for recovery when Active Directory is offline. It is rarely used, which makes it a good place for a backdoor: an attacker who knows the DSRM password, and has changed one registry value, can log on to the DC over the network with it even while AD is running.
The fields that matter
| Field | What it tells you |
|---|---|
| Subject > Account Name | Who ran the password change, usually through ntdsutil or setpassword. |
| Subject > Account Domain / Logon ID | Links to the logon session (4624) the change came from. |
| Additional Information > Caller Workstation | The machine the request came from. |
| Additional Information > Status Code | 0x0 when the password was set successfully. |
What is normal
DSRM password rotation during a planned maintenance window, when a new DC is promoted, or when a password vault or script rotates it on a schedule, using ntdsutil "set dsrm password", optionally with "sync from domain account".
When Event ID 4794 is suspicious
- A 4794 with no change ticket, especially outside working hours.
- The Subject is not one of your named domain admins, or the Caller Workstation is not an admin workstation.
- The registry value
HKLM\System\CurrentControlSet\Control\Lsa\DsrmAdminLogonBehaviorset to2on the same DC (look for a 4657 or Sysmon 13): that allows network logons with the DSRM account, which completes the backdoor. - Logons by the local DSRM account (the DC's local Administrator) in 4624 while the DC is running normally.
Common false positive: Scheduled DSRM password rotation by a privileged access management tool. Note its account and schedule so you can exclude exactly that.
Find Event ID 4794 with PowerShell
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4794; StartTime=(Get-Date).AddDays(-7)} -MaxEvents 50 |
ForEach-Object {
$d = [ordered]@{ Time = $_.TimeCreated; Computer = $_.MachineName }
([xml]$_.ToXml()).Event.EventData.Data | ForEach-Object { $d[$_.Name] = $_.'#text' }
[pscustomobject]$d
} | Format-List
Microsoft Sentinel (KQL)
SecurityEvent
| where TimeGenerated > ago(7d) and EventID == 4794
| project TimeGenerated, Computer, Account, Activity, EventData
| order by TimeGenerated desc
Related events
- Event ID 4624: Successful logon
- Event ID 4672: Special privileges assigned to new logon
- Event ID 4657: Registry value modified
- Event ID 4719: System audit policy changed
FAQ
Is Event ID 4794 always malicious?
No. Setting the DSRM password is normal maintenance. It becomes suspicious when nobody planned it, or when DsrmAdminLogonBehavior has been changed to 2 on the same DC.
How do I check whether a DC has the DSRM backdoor enabled?
Read DsrmAdminLogonBehavior under HKLM\System\CurrentControlSet\Control\Lsa. If it is missing or 0, the DSRM account only works in restore mode. A value of 2 lets it log on over the network at any time.
Which audit policy logs Event ID 4794?
Audit User Account Management, under Account Management in Advanced Audit Policy, on domain controllers.
Windows Event Triage reads a CSV, EVTX-to-JSON or XML export in your browser and flags brute force, new admins, suspicious services and log clearing.
IOC Triage, our free browser extension: right-click it for a verdict from 15 threat-intel sources, then copy a ready ticket note.