Security-Relevant Registry Settings
Most hardening guides for Windows (Microsoft's security baselines, the CIS Benchmarks, the DISA STIGs) end up as a few hundred Registry values, usually set through Group Policy. A reviewer can't check them all by hand on every machine, but a dozen of them decide how credentials are stored, which authentication protocols are accepted and whether a stolen password works across the network. This lesson picks those out and checks two machines' exports against a baseline in PowerShell, with the one complication that makes it interesting: a missing value is not the same as a safe value, because the default depends on the Windows version.
The Registry itself (hives, keys, values, reg query, the HKLM: drive) is in The Windows Registry; autostart keys and Run-key hunting are in The Windows Registry and Event Log. This lesson is about configuration, not persistence.
The values that matter most
Value (under HKLM\SYSTEM\CurrentControlSet\… unless stated) |
Safe setting | What it controls |
|---|---|---|
Control\Lsa\RunAsPPL |
1 or 2 |
LSA protection: LSASS runs as a protected process, so even admins can't simply open its memory (1 = with a UEFI lock, 2 = without) |
Control\Lsa\LsaCfgFlags |
1 or 2 |
Credential Guard (with / without UEFI lock); see LSASS and Credential Guard |
Control\SecurityProviders\WDigest\UseLogonCredential |
0 |
1 makes WDigest keep the cleartext password in LSASS memory; default 0 since Windows 8.1 / Server 2012 R2 |
Control\Lsa\LmCompatibilityLevel |
5 |
send NTLMv2 only, refuse LM and NTLMv1 (NTLM Step by Step) |
Control\Lsa\NoLMHash |
1 |
don't store the LM hash of new passwords (default since Vista) |
Control\Lsa\RestrictAnonymous, RestrictAnonymousSAM |
1, 1 |
no anonymous listing of accounts and shares |
Services\LanmanServer\Parameters\RequireSecuritySignature |
1 |
SMB server requires signing (stops NTLM relay to SMB) |
Services\LanmanWorkstation\Parameters\RequireSecuritySignature |
1 |
SMB client requires signing |
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA |
1 |
UAC on |
…\Policies\System\LocalAccountTokenFilterPolicy |
0 (or absent) |
remote UAC restrictions for local accounts stay on (SIDs and tokens) |
HKLM\SOFTWARE\Policies\Microsoft\Windows NT\DNSClient\EnableMulticast |
0 |
LLMNR off (AD DNS and Name Poisoning) |
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\CachedLogonsCount |
4 or fewer (string) |
how many domain logons are cached for offline sign-in (default 10) |
Services\NTDS\Parameters\LDAPServerIntegrity (DCs) |
2 |
DC requires LDAP signing |
Services\NTDS\Parameters\LdapEnforceChannelBinding (DCs) |
2 |
DC requires channel binding on LDAPS |
Checking exports against a baseline
In a lab you would collect the values with Get-ItemProperty or reg query on each machine (or let a configuration-management tool report them). Here the exports of WS01 and DC01 are embedded as CSV. The baseline says, for every value, what is acceptable and what a missing value means: ok when the default is known to be safe on every supported version, fail when the default is unsafe, check when it depends on version and edition, so the value should be set explicitly.
$baseline = @'
Name,Want,IfMissing,Scope
RunAsPPL,1|2,check,all
LsaCfgFlags,1|2,check,member
UseLogonCredential,0,ok,all
LmCompatibilityLevel,5,fail,all
NoLMHash,1,ok,all
RestrictAnonymousSAM,1,ok,all
Server.RequireSecuritySignature,1,check,all
Workstation.RequireSecuritySignature,1,check,all
EnableLUA,1,ok,all
LocalAccountTokenFilterPolicy,0,ok,all
EnableMulticast,0,fail,all
CachedLogonsCount,0|1|2|3|4,fail,all
LDAPServerIntegrity,2,fail,dc
LdapEnforceChannelBinding,2,fail,dc
'@ | ConvertFrom-Csv
$export = @'
Host,Name,Value
WS01,RunAsPPL,2
WS01,UseLogonCredential,1
WS01,LmCompatibilityLevel,3
WS01,RestrictAnonymousSAM,1
WS01,Workstation.RequireSecuritySignature,1
WS01,EnableLUA,1
WS01,LocalAccountTokenFilterPolicy,1
WS01,CachedLogonsCount,10
DC01,RunAsPPL,1
DC01,LsaCfgFlags,0
DC01,LmCompatibilityLevel,5
DC01,NoLMHash,1
DC01,Server.RequireSecuritySignature,1
DC01,Workstation.RequireSecuritySignature,1
DC01,EnableMulticast,0
DC01,CachedLogonsCount,0
DC01,LDAPServerIntegrity,1
'@ | ConvertFrom-Csv
$roles = @{ WS01 = 'workstation'; DC01 = 'dc' }
foreach ($h in 'DC01', 'WS01') {
$values = @{}
$export | Where-Object Host -eq $h | ForEach-Object { $values[$_.Name] = $_.Value }
$rows = foreach ($b in $baseline) {
if ($b.Scope -eq 'dc' -and $roles[$h] -ne 'dc') { continue }
if ($b.Scope -eq 'member' -and $roles[$h] -eq 'dc') { continue }
if ($values.ContainsKey($b.Name)) {
$v = $values[$b.Name]
$verdict = if (($b.Want -split '\|') -contains $v) { 'ok' } else { 'FAIL' }
[pscustomobject]@{ Name = $b.Name; Value = $v; Verdict = $verdict }
} else {
[pscustomobject]@{ Name = $b.Name; Value = '(missing)'; Verdict = $b.IfMissing.ToUpper() -replace '^OK