TExcelTAD
Home › Windows & Active Directory Security › Security-Relevant Registry Settings

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.

powershell · try it yourself
$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
  

, 'ok' }
    }
  }
  $bad = @($rows | Where-Object Verdict -ne 'ok')
  "== $h ($($roles[$h])): $($bad.Count) of $(@($rows).Count) need attention"
  $bad | ForEach-Object { "  {0,-5} {1,-37} {2}" -f $_.Verdict, $_.Name, $_.Value }
}
== DC01 (dc): 2 of 13 need attention
  FAIL  LDAPServerIntegrity                   1
  FAIL  LdapEnforceChannelBinding             (missing)
== WS01 (workstation): 7 of 12 need attention
  CHECK LsaCfgFlags                           (missing)
  FAIL  UseLogonCredential                    1
  FAIL  LmCompatibilityLevel                  3
  CHECK Server.RequireSecuritySignature       (missing)
  FAIL  LocalAccountTokenFilterPolicy         1
  FAIL  EnableMulticast                       (missing)
  FAIL  CachedLogonsCount                     10

WS01 is the worrying machine. UseLogonCredential = 1 means anyone who reads LSASS memory there gets cleartext passwords: it is a value attackers set themselves after gaining admin, to harvest the next logon, so on a reviewed machine it is both a finding and a possible indicator of compromise. LocalAccountTokenFilterPolicy = 1 and CachedLogonsCount = 10 make a stolen local or cached credential more useful, and LLMNR is on by default. DC01 has LSA protection and accepts unsigned LDAP binds. Its LsaCfgFlags = 0 is not checked at all (scope member): Microsoft doesn't recommend Credential Guard on domain controllers (it adds no protection there and can break applications), so a baseline that failed DCs for it would only teach people to ignore the report.

How it is detected

  • Configuration drift: run the same comparison on a schedule (or use Microsoft's Policy Analyzer with the security baseline, or the CIS-CAT tool) and alert on changes. The script's output is the report.
  • Live changes: Sysmon event 13 (registry value set) with a rule for the keys above; or a SACL on the key plus 4657 (a registry value was modified). A write of UseLogonCredential = 1, RunAsPPL = 0 or DisableRestrictedAdmin by anything other than Group Policy processing is an alert.
  • Group Policy events: if the values come from GPOs, a change appears as 5136 on the GPO object and in SYSVOL (GPO Abuse).

How it is fixed or prevented

  • Set every value explicitly through Group Policy, starting from the Microsoft Security Baseline for your Windows version (part of the Security Compliance Toolkit). Explicit values make the review independent of defaults.
  • Roll out risky changes in audit mode first: NTLM restrictions and LDAP signing have audit events (NTLM operational log; Directory Service 2889) that show which clients would break.
  • Remove local admin rights so users and malware can't change HKLM in the first place.

Pitfalls

  • Reading the wrong hive. Group Policy writes many settings under HKLM\SOFTWARE\Policies\…, which overrides the "normal" location. Check both, or use gpresult /h to see the effective policy.
  • Treating "missing" as "safe". LmCompatibilityLevel absent means 3 on current Windows (NTLMv2 sent, but LM and NTLMv1 still accepted when the machine is the server).
  • One baseline for all roles. Domain controllers, servers and workstations need different values (Credential Guard, cached logons, LDAP settings).
  • Strings vs numbers. CachedLogonsCount is a REG_SZ; comparing it as a number in some tools silently fails.

Practice

1. Why does the baseline mark a missing RunAsPPL as "check" instead of "fail"?

The default depends on version and on how the machine was installed (newer Windows 11 releases enable LSA protection by default on some new installations). A missing value tells you nothing reliable, so set it explicitly and record it.

2. Add a rule that a DC must have RestrictAnonymous = 1. Which two lines change?

Add RestrictAnonymous,1,check,dc to the baseline (missing → check, since the effective default differs between DCs and members), and add DC01,RestrictAnonymous,1 to the export when the DC has it.

3. You find UseLogonCredential = 1 on a workstation where nobody admits to setting it. What next?

Treat it as a possible compromise: find when the key was last written (Sysmon 13 or the key's last-write time), which process wrote it, who has signed in since (their passwords may be exposed: reset them), and set the value back to 0 through Group Policy.

Test yourself

What does WDigest\UseLogonCredential = 1 cause?

  1. Faster logons
  2. LSASS keeps users' cleartext passwords in memory
  3. WDigest is disabled
  4. SMB signing is required

Which LmCompatibilityLevel sends only NTLMv2 and refuses LM and NTLMv1?

  1. 0
  2. 3
  3. 5
  4. Missing

Which Sysmon event ID reports a registry value being set?

  1. 1
  2. 3
  3. 13
  4. 22

Why should a review not fail a domain controller for missing Credential Guard?

  1. DCs don't store credentials
  2. Microsoft doesn't recommend Credential Guard on DCs: it adds no protection there and can cause compatibility problems
  3. It is always on for DCs
  4. DCs have no LSASS