Hardening a Windows Server 2025 Domain Controller, and Proving It

I built a Windows Server 2025 domain controller in a Hyper-V home lab, applied the Microsoft Security Baseline, and then tried to prove the baseline had done something. That turned out to be the interesting part: a vulnerability scanner showed no difference at all, so I wrote a configuration check that did, and it found three gaps the baseline leaves open.

Everything ran on a 16 GB laptop, with an evaluation licence and free tools only: Hyper-V, Kali Linux and Greenbone (OpenVAS) Community Edition. Hyper-V checkpoints let me scan the same DC in its clean and hardened states, so each comparison changes one thing. Part 2 syncs this DC to Entra ID and tests my IAM automation against it.

Overview

What I Built

  • A Server 2025 DC (Gen 2, Secure Boot, vTPM) in a new forest
  • The Microsoft Security Baseline v2602, imported and linked by GPO
  • A Kali scanner VM with Greenbone Community Edition
  • Five scans: unauthenticated and authenticated, before and after
  • Get-HardeningState.ps1, a read-only check of 19 settings
  • A GPO fix for one gap, proven by a rescan and a recheck

Skills Demonstrated

  • Windows Server and AD build and hardening
  • Group Policy and security baselines
  • Vulnerability scanning and finding triage
  • Measuring a control instead of assuming it
  • PowerShell for configuration auditing
  • Working inside hard limits (16 GB RAM, one laptop)
ResultValue
Scan findings, before vs afterNo change (Server 2025 defaults already pass)
Config check, at targetClean 8 → hardened 16 → hardened v2 17 of 19
Gaps found3: Print Spooler on the DC (fixed), Kerberos ticket audit reduced, LSA protection not active

The Domain Controller

DC01 is a Generation 2 VM with Secure Boot and a virtual TPM, on an external Hyper-V switch. I gave it a static address, promoted it to a new forest (hawkode.lab, Windows Server 2025 functional level), and added DNS forwarders so it could resolve the internet. Then I took the first checkpoint, Clean DC: the “before” state every later comparison goes back to.

Build

  • Windows Server 2025 Standard evaluation, Desktop Experience
  • 2 vCPU, 4 GB at build time, 60 GB disk
  • Static IP, DNS pointing at itself
  • New forest and domain: hawkode.lab
  • Forwarders to public resolvers

Security Angle

  • Abuse: a DC is Tier 0: whoever controls it controls the domain
  • Detect: a known-clean checkpoint gives a baseline to compare against
  • Harden: Secure Boot and vTPM from the start, before any software goes on
Hyper-V settings for DC01: Secure Boot enabled with the Microsoft Windows template and the Trusted Platform Module enabled
DC01 VM security: Secure Boot (Microsoft Windows template) and a virtual TPM.
Get-ADDomain output showing hawkode.lab at Windows2025Domain functional level
The new domain at the Windows Server 2025 functional level.

Hyper-V • Windows Server 2025 • Active Directory • DNS

The Microsoft Security Baseline

I downloaded the Security Compliance Toolkit baseline for Server 2025 (v2602) and imported its GPOs with Baseline-ADImport.ps1. The first run was refused: the scripts came from the internet and the execution policy blocked them, so I unblocked the files rather than lowering the policy. I linked the Domain Controller GPO to the Domain Controllers OU and the Domain Security GPO to the domain, ran gpupdate /force, rebooted, and confirmed with gpresult. Checkpoint: Hardened DC.

AreaWhat the baseline changesAttack it closes
SMBSigning required, SMBv1 offNTLM relay, EternalBlue-class exploits
LDAPSigning and channel bindingLDAP relay to take over AD
Legacy authNTLMv2 only, LM off, WDigest offWeak hashes, cleartext credential caching
LoggingAdvanced audit policy, PowerShell script block loggingAttacks leaving no trace
User rightsTighter logon, RDP and service rightsFewer accounts able to try

What Can Break

  • Devices doing unsigned LDAP binds, such as older printers and MFPs looking up address books
  • Anything still on SMBv1 or NTLMv1
  • Fix: LDAPS and firmware updates, tested on a non-critical server first

Security Angle

  • Abuse: NTLM and LDAP relay, credential theft from memory
  • Detect: the audit policy the baseline turns on (logon, Kerberos, directory changes)
  • Harden: Microsoft’s own baseline, linked by GPO so it reapplies
Baseline-ADImport.ps1 importing the Windows Server 2025 v2602 baseline GPOs into hawkode.lab
Importing the v2602 baseline GPOs into the domain.
gpresult showing the MSFT Windows Server 2025 v2602 Domain Controller and Domain Security GPOs applied
gpresult on DC01: the Domain Controller and Domain Security baseline GPOs applied.

Microsoft Security Baseline • Security Compliance Toolkit • Group Policy • LDAP Signing • NTLM

Kali and Greenbone on 16 GB

KALI01 runs Greenbone Community Edition. It will also be the attacker in the next phase. The first feed sync takes one to two hours, and a 16 GB host with two VMs and a browser leaves little room, so most of the work in this phase was making it fit.

ProblemCauseFix
VM won’t start: unable to allocate 6144 MBStatic memory needs the full amount free at startDC01 at 2 GB, Kali at 3-4 GB, host apps closed
No boot imageSecure Boot on for a Linux guestSecure Boot off for KALI01 only
Start greyed out: feed syncingAfter a reboot the scanner reloads its tests (about 4 min)Wait for “Finished loading VTs” in the log
Feed download stallsHost went to sleepSleep off and charger in during the sync
DC01 won’t start after a checkpointThe checkpoint restores its old memory settingRemove saved state, set memory again
Hyper-V error: KALI01 failed to start, unable to allocate 6144 MB of RAM
The 16 GB limit, early on. Both VMs only fit with DC01 on 2 GB and Kali on 3-4 GB.
Greenbone feed status: NVTs current, SCAP, CERT and data objects updating
Feed sync in progress: the vulnerability tests are current, the rest still loading.

Kali Linux • Greenbone (OpenVAS) • Hyper-V • Troubleshooting

Five Scans, No Difference

I scanned DC01 in each state with the same target and config (Full and fast, all IANA TCP ports, quality of detection 70 and above), changing only the checkpoint. Authenticated scans log in over SMB with a dedicated domain account, svc-scan. It needs admin rights to read the registry, which makes it a Tier 0 account, so I deleted it before the DC was ever synced to the cloud.

ScanCriticalHighMediumLow
Unauthenticated, clean0011
Unauthenticated, hardened0011
Authenticated, clean0122
Authenticated, hardened0122
Authenticated, hardened v20122
Greenbone severity counts: 0 critical, 0 high, 1 medium, 1 low
Unauthenticated scan of the hardened DC: 1 Medium, 1 Low. The clean DC scored the same.
Greenbone results: DCE/RPC services enumeration (medium) and TCP timestamps (low)
The two findings: RPC enumeration (a DC needs RPC) and TCP timestamps. Both accepted. IP replaced with a documentation address.

Triage. Logging in added three findings, all file-presence or version checks. I worked through each one instead of taking the scanner’s word for it:

FindingCVSSReal riskDecision
IExpress untrusted search path7.8Low: needs an installer run from a writable folderAccept, nobody builds installers on a DC
HID over USB code execution6.9Close to none on a VMAccept on the VM, USB control on hardware
RPC services enumeration5.0Expected on a DCAccept
Snipping Tool disclosure3.3None: the CVE affects the Store app, which isn’t installedProved false positive, overridden
TCP timestamps2.6Uptime can be estimatedAccept
Greenbone new target with the svc-scan SMB credential selected
The authenticated target: SMB (NTLM) login with the svc-scan domain account.
Greenbone results dashboard: 136 results, mostly log level, a few low, medium and high
Authenticated results: 136 in total, 118 of them information only.
PowerShell showing only the legacy SnippingTool.exe and no Store Snipping Tool packages
The check behind the false positive: only the legacy SnippingTool.exe, no Store packages.
Greenbone new override setting the finding's severity to False Positive
The override, so the finding stops coming back in every report.

What this shows. Server 2025 already ships with SMB signing required, SMBv1 off and LDAP signing on, so an unauthenticated scan has nothing to report. The baseline’s real changes (NTLM level, LDAP channel binding, UAC, logging, audit policy) live inside Windows, and a vulnerability scanner checks patches and software, not configuration. A scan can’t prove hardening.

Vulnerability Scanning • Authenticated Scans • Triage • False Positives • CVSS

A Configuration Check That Can See It

So I wrote Get-HardeningState.ps1: read-only, run elevated on the DC, it reads the settings the baseline is meant to change and scores them against a target. I ran it on each checkpoint.

SettingCleanHardened
LDAP channel bindingNot setAlways
LmCompatibilityLevelNot set (OS default 3)5, NTLMv2 only
LSA protectionNot setConfigured, UEFI lock
UAC admin token filteringNot setOn
PowerShell script block loggingNot setOn
Audit: Credential ValidationSuccessSuccess and Failure
Audit: Directory Service ChangesNo auditingSuccess
Audit: Kerberos Service Ticket OperationsSuccessFailure only
Audit subcategories with no auditing4330
Print SpoolerAutomaticAutomatic
StateAt target (19 checks, v1.1)
Clean8
Hardened (baseline)16
Hardened v2 (+ Print Spooler GPO)17

Version 1.0 of the script scored clean 7 and hardened 13. Checking the misses, three were my targets being wrong for Server 2025 (the legacy LDAP value, WDigest, the LSA value name), not the DC. Version 1.1 fixed them, which is why the screenshots below show different numbers from the table.

Get-HardeningState.ps1 output for the clean DC: 7 of 19 checks at target
Clean DC, script v1.0: 7 of 19 (8 with the v1.1 targets).
Get-HardeningState.ps1 output for hardened v2: 17 of 19 checks at target
Hardened v2, script v1.1: 17 of 19. The two misses are the open gaps below.

PowerShell • Configuration Audit • Audit Policy • Registry

What the Baseline Leaves Open

Print Spooler on the DC (fixed). The scan’s RPC list showed spoolsv.exe listening, before and after the baseline. On a DC that’s the PrintNightmare path, and the PrinterBug lets any domain user force the DC to authenticate to a host they control. I added a GPO to disable it on the Domain Controllers OU, after the four baseline scans so that comparison stayed clean. The v2 scan no longer lists the spooler or its named pipe.

Group Policy setting: Print Spooler service Disabled
The lab GPO: Print Spooler service disabled.
gpresult showing the Lab - DC Disable Print Spooler GPO applied
Applied on DC01: Lab - DC Disable Print Spooler.

Kerberos ticket auditing cut to Failure (open). The clean DC logs successful service ticket requests (event 4769). The baseline trims that noisy event and loses Kerberoasting visibility with it. The fix is an audit setting above the baseline, which belongs with the detection work in the next phase.

LSA protection configured, not active (open). The baseline sets LSA protection with a UEFI lock, and DC01 rebooted after. But an elevated session can still read the LSASS process, and the event that confirms protection never appears. So LSASS dumping is still possible. I haven’t found the cause yet; the next phase proves it with a dump attempt, then fixes and rechecks.

RunAsPPLBoot is 1 and the DC rebooted, but Get-Process can still read lsass.exe modules
Configured (RunAsPPLBoot = 1, rebooted) but not protected: LSASS modules are still readable.

Gaps

  • Print Spooler on DCs: fixed and proven
  • 4769 success auditing: next phase
  • LSA protection: prove, then fix

Security Angle

  • Abuse: PrinterBug / forced authentication (T1187), Kerberoasting (T1558.003), LSASS dumping (T1003.001)
  • Detect: event 4769 with success auditing back on; LSASS access events
  • Harden: Spooler off on every DC, audit above the baseline, LSA protection verified, not assumed

PrintNightmare • Kerberoasting • LSA Protection • MITRE ATT&CK • Group Policy

One Change per Checkpoint

Every state on this page is a checkpoint, so any scan or check can be rerun against it. The tree grew as the project did: clean, hardened, scan-ready copies of each with the scan account, hardened v2 with the spooler fix, then the states for Part 2.

Hyper-V Manager with DC01 and KALI01 running and the DC01 checkpoint tree
DC01 and KALI01 running side by side, with the checkpoint tree behind the comparisons.

Lab vs Production

Checkpoints on a DC: safe here because there is one DC. Reverting a DC in a multi-DC domain causes USN rollback.

Scan account: svc-scan had admin rights for authenticated scans and was deleted after. In production a scan account is Tier 0, gets a long random password, and is restricted to the scanner’s address.

Rollout: the baseline went straight onto the only DC. In production it goes to a test server first, after checking for unsigned LDAP binds and NTLMv1.

Evaluation licence: 180 days. The lab is documented so it can be rebuilt from the repo.

Part 2: Hybrid IAM

The hardened DC is synced to Entra ID with Entra Connect, and my joiner, mover and leaver automation is tested against it end to end. After that, the attack phase: Kerberoasting and LSASS dumping from KALI01, to close the two open gaps above with detection and proof.

Part 2: Hybrid IAM View on GitHub Back to Projects