================================================================================ 02: WINDOWS SERVER HARDENING: SOLUTION WALKTHROUGH Windows Server 2025 (member server or domain controller) Training reference for virtual machines you own or are authorized to change. Three levels: L1 Doorman, L2 Watchman, L3 Hunter. Every item = COMMAND, WHY, NOTE, and the hardening AREA it belongs to; ALSO adds a second caution when an item needs one. No scripts by design: type it, read it, explain it. Item IDs match the Lockdown Drills trainer for this OS. Unofficial practice; not affiliated with or endorsed by Microsoft. COMMAND LEGEND: PS> runs in an elevated PowerShell and CMD> in an elevated Command Prompt. Type what follows the prefix, and replace each value in angle brackets, such as , with a real one. GUI: lines walk through a window, and indented lines show values to set or read. HARDENING AREAS (CIS Critical Security Controls v8.1) Account management ........ CIS Control 5 Access control ............ CIS Control 6 Secure configuration ...... CIS Control 4 (software inventory: Control 2) Patching .................. CIS Control 7 Malware defenses .......... CIS Control 10 Audit logging ............. CIS Control 8 Also tagged: Data protection (CIS Control 3); Investigation (forensics basics: answer questions and preserve evidence before you change things). ================================================================================ ------------------------------ DOORMAN ----------------------------------------- Lock the doors. Find the role first (standalone, member server, or domain controller), then users, admins, passwords, and policy where it takes effect: local or domain. Learn it first: Defense Ladder s2, "Desktop, member server, or domain controller." https://freeapp4that.store/defense-ladder/#sophomore/s2 -------------------------------------------------------------------------------- [B-00] Scenario brief and evidence first AREA: Investigation (forensics basics) GUI: open the scenario brief (the documented requirements for this machine) and write down authorized users, admins, required services, and anything forbidden PS> (Get-CimInstance Win32_ComputerSystem).DomainRole 0-1 standalone or member workstation, 2-3 standalone or member server, 4-5 domain controller CMD> dsregcmd /status (AzureAdJoined and DomainJoined show who else can push settings to this server) PS> Get-WindowsFeature AD-Domain-Services,DNS,DHCP,Web-Server,Web-Ftp-Server | Select-Object Name,Installed WHY: Read the brief: removing a user, role, or service it requires is an availability failure. Evidence first: answer the investigation questions before any change (Defense Ladder f1). NOTE: Unfamiliar is distinct from unauthorized. Before removing an agent, find what starts it, who owns it, and what it does, then ask the owner (Defense Ladder s1). ALSO: Member servers use local accounts and secpol; domain controllers use Active Directory and Group Policy. [B-01] List users: local and domain AREA: Account management (CIS Control 5) PS> Get-LocalUser | Select-Object Name,Enabled,PasswordRequired,LastLogon PS> Get-ADUser -Filter * -Properties Enabled,PasswordNeverExpires,PasswordNotRequired,LastLogonDate | Select-Object Name,Enabled,PasswordNeverExpires,PasswordNotRequired,LastLogonDate CMD> net user /domain PS> Get-Command *LocalUser* (member server; on a domain controller, Get-Command -Module ActiveDirectory) PS> Get-LocalUser | Get-Member (lists every property you can select, such as Enabled) GUI: dsa.msc (Active Directory Users and Computers) on a DC; lusrmgr.msc on a member server WHY: Unauthorized accounts are backdoors. On a DC the local SAM is gone; every account is a domain account, so Get-ADUser is the list to compare with the brief. NOTE: PasswordNotRequired=True and PasswordNeverExpires=True are findings in their own right. [B-02] Remove or disable an unauthorized user AREA: Account management (CIS Control 5) PS> Get-ScheduledTask | Where-Object { $_.Principal.UserId -like '*baduser' } | Select-Object TaskPath,TaskName PS> Get-CimInstance Win32_Service | Where-Object StartName -like '*baduser' | Select-Object Name,StartName,PathName PS> Disable-ADAccount -Identity baduser PS> Enable-ADAccount -Identity keola (undo a disable once the owner confirms the account is needed) PS> Remove-ADUser -Identity baduser -Confirm:$false PS> Remove-LocalUser -Name "baduser" CMD> net user baduser /delete PS> Enable-LocalUser -Name keola (member server: undo a disable once the brief confirms the account belongs) WHY: Disable first if the brief is unclear; delete when it is clear. A disabled account keeps its SID and group memberships for the investigation question. NOTE: First, answer every investigation question that names the account. Then handle each scheduled task or service running as that account; the first two commands find them. ALSO: Deletion leaves the profile under C:\Users: search it for evidence and prohibited files, then remove it. [B-03] Audit the privileged groups AREA: Account management (CIS Control 5) PS> Get-ADGroupMember "Domain Admins"; Get-ADGroupMember "Enterprise Admins"; Get-ADGroupMember "Schema Admins"; Get-ADGroupMember "Administrators" PS> Get-ADGroupMember "Account Operators"; Get-ADGroupMember "Server Operators"; Get-ADGroupMember "Backup Operators"; Get-ADGroupMember "DnsAdmins" PS> Remove-ADGroupMember -Identity "Domain Admins" -Members baduser -Confirm:$false PS> Get-Help Get-LocalGroupMember -Examples (worked examples; run Update-Help once, online, for the full text) PS> Get-LocalGroupMember -Group Administrators CMD> net localgroup Administrators baduser /delete PS> Remove-LocalGroupMember -Group Administrators -Member baduser (member server) WHY: Domain Admins grants everything; the operator groups, Backup Operators, and DnsAdmins reach the same place quietly. Compare each group's members with the brief; on a member server, check local Administrators. [B-04] Disable Guest; protect the built-in Administrator AREA: Account management (CIS Control 5) PS> Get-LocalUser | Where-Object { $_.SID -like '*-50[01]' } | Select-Object Name,Enabled,SID (member server) PS> Get-ADUser -Filter * | Where-Object { $_.SID -like '*-50[01]' } | Select-Object Name,Enabled,SID (domain controller) CMD> whoami /user CMD> net user Guest /active:no PS> Disable-LocalUser -Name Guest (member server) PS> Disable-ADAccount -Identity Guest CMD> net user Administrator /active:no PS> Set-ADUser -Identity Administrator -PasswordNeverExpires $false PS> Get-LapsADPassword -Identity KAILUA-WS07 -AsPlainText (Windows LAPS: each computer's own local Administrator password, rotated and readable only by granted groups) WHY: Well-known names invite brute force. Disable Guest; keep Administrator enabled only when the brief uses it, with a strong password. Match SID -500 (Administrator) and -501 (Guest) to catch renames. NOTE: Keep the account the brief tells you to log in with enabled; whoami /user shows your SID, and -500 marks the built-in Administrator. ALSO: Rename Administrator and Guest last, only when the brief or policy asks (Rename-LocalUser on a member server). The SID stays, so disabling and a strong password carry the protection. [B-05] Strong passwords and forced change AREA: Account management (CIS Control 5) PS> Get-ADUser -Filter * -Properties PasswordLastSet,PasswordNeverExpires | Select-Object Name,Enabled,PasswordLastSet,PasswordNeverExpires PS> Set-ADAccountPassword -Identity alice -Reset -NewPassword (Read-Host -AsSecureString 'New password') PS> Set-ADUser -Identity alice -PasswordNeverExpires $false -PasswordNotRequired $false PS> Set-ADUser -Identity alice -ChangePasswordAtLogon $true PS> Get-ADUser -Identity alice -Properties PasswordNeverExpires,pwdLastSet | Select-Object Name,PasswordNeverExpires,pwdLastSet PS> Get-ADUser -Filter 'Enabled -eq $true' | Where-Object SamAccountName -ne $env:USERNAME | Set-ADUser -PasswordNeverExpires $false CMD> net user alice * CMD> net user alice /logonpasswordchg:yes PS> Set-LocalUser -Name alice -PasswordNeverExpires $false (member server) WHY: Weak, shared, or blank passwords let attackers in. PasswordNotRequired allows blank ones despite policy; PasswordNeverExpires defeats aging. Clear both, force a change at next sign-in, and confirm pwdLastSet is 0. NOTE: Apply B-06 and B-07 first so new passwords meet domain policy. Read-Host and net user * prompt, hiding passwords from command history; record them safely (on paper, in a lab). ALSO: The bulk line clears service accounts' PasswordNeverExpires, so their passwords expire. Exclude them by name, or handle them in A-10, updating each service's Log On tab at the same time. [B-06] Password policy where it actually lives AREA: Account management (CIS Control 5) PS> Get-ADDefaultDomainPasswordPolicy PS> Set-ADDefaultDomainPasswordPolicy -Identity (Get-ADDomain).DNSRoot -MinPasswordLength 12 -ComplexityEnabled $true -PasswordHistoryCount 24 -MinPasswordAge 1.00:00:00 -MaxPasswordAge 60.00:00:00 -ReversibleEncryptionEnabled $false GUI: gpmc.msc, Default Domain Policy, Computer Configuration, Policies, Windows Settings, Security Settings, Account Policies, Password Policy CMD> net accounts /minpwlen:12 /maxpwage:60 /minpwage:1 /uniquepw:24 (member server) GUI: secpol.msc, Account Policies, Password Policy (member server) WHY: Default Domain Policy overrides net accounts and secpol.msc on DCs only. Passwords set while reversible encryption was on stay recoverable: reset them, and check accounts with Get-ADUser -Properties AllowReversiblePasswordEncryption. NOTE: The brief sets the numbers; these are one sample. CIS Benchmark: 14 or more characters, history 24 or more, maximum age 1–365 days, minimum age 1 day or more. [B-07] Account lockout policy AREA: Account management (CIS Control 5) PS> Set-ADDefaultDomainPasswordPolicy -Identity (Get-ADDomain).DNSRoot -LockoutThreshold 5 -LockoutDuration 00:30:00 -LockoutObservationWindow 00:30:00 CMD> net accounts /lockoutthreshold:5 /lockoutduration:30 /lockoutwindow:30 (member server) PS> Search-ADAccount -LockedOut | Select-Object Name PS> Unlock-ADAccount -Identity alice WHY: Turns an online brute force from thousands of guesses a minute into five per half hour. Search-ADAccount shows who is locked out right now, which is also an investigation clue. NOTE: The brief sets the numbers. The CIS Benchmark asks for a threshold of 5 or fewer and above 0, and a duration and reset window of 15 minutes or more. ALSO: A member server's local built-in Administrator locks only with Allow Administrator account lockout Enabled (AllowAdministratorLockout = 1, Hunter A-01), only for network sign-ins like Remote Desktop. Console sign-in stays available. [B-08] Firewall on for all profiles AREA: Secure configuration (CIS Control 4) PS> Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True PS> Get-NetFirewallProfile -PolicyStore ActiveStore | Select-Object Name,Enabled,DefaultInboundAction CMD> netsh advfirewall set allprofiles state on CMD> netsh advfirewall show allprofiles GUI: Settings, Privacy and security, Windows Security, Firewall and network protection. WHY: Default-deny inbound covers the service you have not found yet. Misconfigured machines often have exactly one profile off, usually Public. NOTE: DefaultInboundAction should be Block. ActiveStore shows values in force, Group Policy included; the plain view reads NotConfigured for values left at default (Block inbound). Watchman covers allow rules. [B-09] Windows Update on a server AREA: Patching (CIS Control 7) CMD> sconfig (option 5: Update setting = Automatic; option 6: Install Updates) GUI: Win+R, ms-settings:windowsupdate (Settings, Windows Update), Check for updates PS> Set-Service -Name wuauserv -StartupType Automatic; Start-Service wuauserv PS> Get-Service wuauserv,BITS,UsoSvc | Select-Object Name,Status,StartType PS> Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 5 CMD> reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate /s CMD> reg delete HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate /v WUServer /f (only when the brief rules out an update server; delete UseWUServer with it) CMD> reg delete HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU /v UseWUServer /f (the pair goes together: UseWUServer 1 keeps Windows looking for the deleted server) GUI: gpmc.msc (or gpedit.msc), Computer Configuration, Policies, Administrative Templates, Windows Components, Windows Update: Configure Automatic Updates = Enabled (4) PS> winget upgrade (lists apps with newer versions; winget ships with Server 2025) CMD> shutdown /r /t 60 /c "Installing updates" (warn signed-in users first: quser lists them) WHY: Patching closes known holes; automatic updates keep closing them. A reverting setting is GPO-owned: NoAutoUpdate 1 disables automatic updates; UseWUServer 1 sends checks to WUServer, which the brief must name. NOTE: Start updates early; recheck after each restart until Windows Update reports up to date. wuauserv ships as Manual (starts on demand); Disabled is the finding. Save work before any reboot. [B-10] Microsoft Defender on Server AREA: Malware defenses (CIS Control 10) PS> Get-MpComputerStatus | Select-Object AMServiceEnabled,RealTimeProtectionEnabled,AntivirusSignatureLastUpdated PS> Get-MpComputerStatus | Select-Object AMRunningMode PS> Install-WindowsFeature -Name Windows-Defender PS> Set-MpPreference -DisableRealtimeMonitoring $false PS> Update-MpSignature PS> Start-MpScan -ScanType QuickScan PS> Start-MpScan -ScanType CustomScan -ScanPath C:\Users PS> Get-MpThreatDetection | Select-Object InitialDetectionTime,ProcessName,Resources GUI: Win+R, windowsdefender: (opens Windows Security), Virus and threat protection, Manage settings WHY: Windows Server ships with Defender, but someone can remove the feature or disable it by policy. Real-time protection and current signatures both matter, and Get-MpComputerStatus shows each. NOTE: Answer the investigation questions before any scan, because a scan can quarantine the file a question asks about. Record each detection's Resources path before removing the program that dropped it. ALSO: If Get-MpComputerStatus errors, the feature is missing: install it, restart when RestartNeeded says Yes, then configure. AMRunningMode Normal means active; Passive means another antivirus leads. The brief picks the product. [B-11] Remove unapproved software AREA: Secure configuration: software (CIS Controls 2 and 4) PS> Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*, HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*, Registry::HKEY_USERS\*\Software\Microsoft\Windows\CurrentVersion\Uninstall\* -ErrorAction SilentlyContinue | Select-Object DisplayName,DisplayVersion,Publisher,UninstallString | Sort-Object DisplayName GUI: Settings, Apps, Installed apps (or appwiz.cpl) WHY: Hacking tools, games, torrent clients, and remote-access tools are acceptable-use violations and attack surface. NOTE: Software the brief requires stays. Portable tools appear only in a file search (B-12, A-06). After removing a remote-access tool, check for its leftover service (I-04) and firewall rule (I-12). ALSO: The registry listing is instant; Win32_Product is slow and can trigger repairs. HKEY_USERS adds signed-in users' own apps. Remove capture tools' separate Npcap install when the brief omits packet capture. [B-12] Find unapproved media and loose executables AREA: Data protection (CIS Control 3) PS> Get-ChildItem -Path C:\Users,C:\inetpub,C:\Shares -Recurse -Force -File -Include *.mp3,*.mp4,*.wav,*.avi,*.mkv,*.flac,*.mov,*.m4a,*.mpg,*.mpeg,*.ogg,*.flv,*.wma,*.aac -ErrorAction SilentlyContinue | Where-Object FullName -notmatch '\\AppData\\|^C:\\Users\\(All Users|Default User)\\' | Select-Object FullName CMD> dir /s /a /b C:\Users\*.mp3 C:\Users\*.mp4 CMD> del /s /a C:\Users\*.mp3 C:\Users\*.mp4 (after dir /s /a /b lists the same files and the brief bans them; del also reaches AppData, where apps keep their own sounds, so check that list for AppData paths first) CMD> rd /s /q "C:\Users\\Music\" (a folder of banned files, after dir lists it: rd removes the folder and everything in it) PS> Get-ChildItem -Path C:\Users -Recurse -Force -File -Include *.mp3,*.mp4 -ErrorAction SilentlyContinue | Where-Object FullName -notmatch '\\AppData\\' | Remove-Item -Force (after the list above is reviewed and any file a question names is hashed) PS> Get-ChildItem -Path C:\Users,C:\inetpub -Recurse -Force -File -Include *.exe,*.bat,*.cmd,*.ps1,*.vbs,*.hta,*.aspx,*.py,*.jar,*.zip,*.7z,*.rar -ErrorAction SilentlyContinue | Where-Object FullName -notmatch '\\AppData\\Local\\(Microsoft|Packages)\\|^C:\\Users\\(All Users|Default User)\\' | Select-Object FullName,LastWriteTime PS> Get-Item 'C:\Users\\Downloads\' -Stream * | Select-Object Stream,Length PS> Get-Content 'C:\Users\\Downloads\' -Stream Zone.Identifier (ZoneId=3 marks a file downloaded from the internet) PS> Unblock-File -Path 'C:\Users\\Downloads\' (only for an expected file from a trusted source: it removes the downloaded-from-the-internet mark) CMD> tar -tf "C:\Users\\Downloads\.zip" WHY: Media in user profiles and web roots is the usual acceptable-use violation; a stray .aspx or .ps1 under inetpub is a webshell. Confirm each file against the brief before deleting. NOTE: First answer every investigation question naming a file and record its hash (B-14); then delete it and log the path. tar -tf lists a .zip's contents before you delete it. ALSO: Search C:\ too, beyond C:\Users. -Force shows hidden files; the filters skip AppData caches and the All Users and Default User links. Keep Python and other runtimes the brief needs. [B-13] Stop obviously unsafe services AREA: Secure configuration (CIS Control 4) PS> Get-Service -Name ftpsvc,TermService,RemoteRegistry,SNMP -ErrorAction SilentlyContinue | Select-Object Name,Status,StartType PS> Stop-Service -Name RemoteRegistry; Set-Service -Name RemoteRegistry -StartupType Disabled PS> Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server' -Name fDenyTSConnections -Value 1 PS> Get-NetFirewallRule -Group '@FirewallAPI.dll,-28752' -ErrorAction SilentlyContinue | Disable-NetFirewallRule CMD> reg query "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v fDenyTSConnections PS> Get-WindowsFeature Remote-Assistance GUI: services.msc, Startup type Disabled; Settings, System, Remote Desktop PS> Stop-Service -Name Spooler; Set-Service -Name Spooler -StartupType Disabled (unless this is the print server) PS> Get-NetTCPConnection -State Listen -LocalPort 21,3389 -ErrorAction SilentlyContinue WHY: Telnet and FTP leak cleartext credentials, Remote Registry allows remote registry edits, RDP draws brute force, and a domain controller's Print Spooler is PrintNightmare. Confirm: the port check returns empty. NOTE: If the brief requires RDP, FTP, or SSH, harden it instead of killing it (I-11). Remote management tools use Remote Registry on a server: disable it when the brief names local administration only, and record the change. Turning Remote Desktop off takes the setting plus its firewall group (the @FirewallAPI name works in any display language). fDenyTSConnections 0 under the Terminal Services policy key forces Remote Desktop back on, so an error that the value is missing is the good result. When the brief leaves Remote Assistance out, run Uninstall-WindowsFeature Remote-Assistance. The last line returns empty once FTP and Remote Desktop stop listening. [B-14] Hash a file for an investigation question AREA: Investigation (forensics basics) PS> Get-FileHash -LiteralPath 'C:\Users\\Desktop\' -Algorithm SHA256 | Format-List CMD> certutil -hashfile "C:\Users\\Desktop\" SHA256 PS> Format-Hex -Path 'C:\Users\\Desktop\' | Select-Object -First 1 (the first bytes name the real type: 4D 5A is an .exe, 25 50 44 46 is a PDF; PowerShell 7 adds -Count 8) PS> Get-MpThreatDetection | Select-Object InitialDetectionTime,Resources WHY: Answer with the named algorithm's exact hex string, which repeats on every run. Hash before any Defender scan, cleanup, or move: changed or quarantined, the file answers differently or vanishes. NOTE: Check each hash's length: MD5 32 hex characters, SHA1 40, SHA256 64. certutil defaults to SHA1, so name the algorithm. -LiteralPath reads names with [ ] that -Path skips. ALSO: Quotes keep paths with spaces whole. If opening the file reports a virus, Defender already quarantined it: Get-MpThreatDetection and Windows Security, Protection history show the path and time to record. [B-15] Create the users and groups the brief lists AREA: Account management (CIS Control 5) PS> New-ADUser -Name 'kekoa' -SamAccountName 'kekoa' -AccountPassword (Read-Host -AsSecureString 'Password') -Enabled $true PS> New-ADGroup -Name 'Accounting' -GroupScope Global PS> Add-ADGroupMember -Identity 'Accounting' -Members kekoa PS> Get-ADGroupMember -Identity 'Accounting' CMD> net user kekoa * /add (member server) PS> New-LocalUser -Name 'kekoa' -Password (Read-Host -AsSecureString 'Password') (member server) PS> New-LocalGroup -Name Accounting (member server) CMD> net localgroup Accounting /add (member server) CMD> net localgroup Accounting kekoa /add (member server) PS> Add-LocalGroupMember -Group Accounting -Member kekoa (member server) WHY: A listed user or group missing from the machine locks someone out of sign-in and the job's files. Create exactly that set; the brief is the source of truth. NOTE: Read-Host and net user * prompt for the password, keeping it out of command history. Security events 4720 (account created) and 4728 (added to a global group) record each step. [B-16] Find files that store passwords AREA: Data protection (CIS Control 3) PS> Get-ChildItem -Path C:\Users,C:\inetpub,C:\Shares -Recurse -Force -File -Include *.txt,*.csv,*.ini,*.xml,*.log,*.ps1,*.bat -ErrorAction SilentlyContinue | Where-Object FullName -notmatch '\\AppData\\Local\\|^C:\\Users\\(All Users|Default User)\\' | Select-String -Pattern 'passw(or)?d|pwd|credential' -List | Select-Object Path,LineNumber,Line CMD> findstr /s /i /m /c:"password" C:\Users\*.txt C:\Users\*.csv C:\Users\*.ini PS> Get-ChildItem -Path C:\Users\*\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt -Force -ErrorAction SilentlyContinue | Select-String -Pattern 'net user|ConvertTo-SecureString|passw' | Select-Object Path,Line PS> Get-ChildItem -Path C:\Windows\Panther\Unattend.xml,C:\Windows\Panther\Unattend\Unattend.xml,C:\Windows\System32\Sysprep\unattend.xml -Force -ErrorAction SilentlyContinue | Select-String -Pattern '|AdministratorPassword' | Select-Object Path,LineNumber CMD> cmdkey /list WHY: Passwords in notes, scripts, PowerShell history, or Windows Setup answer files expose accounts. Hidden answer-file passwords are only encoded: treat them as plaintext. Content search finds them under any name. NOTE: First answer any investigation question that names the file and record its hash (B-14). Then remove or move it where the brief says, and log the path. ALSO: Review each hit: license and app files match too. cmdkey /list shows only the signed-in user's saved passwords, like TERMSRV/ for Remote Desktop; cmdkey /delete: removes one the brief omits. ------------------------------ WATCHMAN ---------------------------------------- Check the windows. Roles and features, audit and policy through Group Policy, services, shares, tasks, ports, logs, and the required roles (IIS, FTP, DNS, and DHCP) hardened rather than removed. Learn it first: Defense Ladder j1, "Windows Server and Active Directory," and Defense Ladder j2, "Group Policy." https://freeapp4that.store/defense-ladder/#junior/j1 https://freeapp4that.store/defense-ladder/#junior/j2 -------------------------------------------------------------------------------- [I-01] Audit policy: turn the lights on AREA: Audit logging (CIS Control 8) CMD> wevtutil sl Security /ms:201326592 CMD> wevtutil gl Security (maxSize shows the new limit) CMD> auditpol /backup /file:C:\Windows\Temp\audit-before.csv CMD> auditpol /set /category:* /success:enable /failure:enable CMD> auditpol /get /category:* GUI: gpmc.msc, Default Domain Controllers Policy, Computer Configuration, Policies, Windows Settings, Security Settings, Advanced Audit Policy Configuration WHY: Without auditing, Event Viewer has nothing to tell you or an investigator. Logon, account management, and policy change are the key ones. NOTE: On a DC the Default Domain Controllers Policy overrides local auditpol: set it there or it reverts at the next gpupdate. Pick one route, auditpol here or Advanced Audit Policy Configuration in Group Policy, and leave secpol's basic Audit Policy node unset; Microsoft warns that mixing the two gives unexpected results, so trust auditpol /get. wevtutil raises the Security log to 192 MB first so the extra events keep older evidence; auditpol /restore /file:C:\Windows\Temp\audit-before.csv undoes the change. Fine-grained subcategories, and trimming the noisiest ones, are A-08. [I-02] Security Options in secpol.msc AREA: Secure configuration (CIS Control 4) GUI: secpol.msc, Local Policies, Security Options Accounts: Limit local account use of blank passwords to console logon only = Enabled Devices: Prevent users from installing printer drivers = Enabled Interactive logon: Don't display last signed-in = Enabled (older label: Do not display last user name) Interactive logon: Machine inactivity limit = 900 seconds or fewer Interactive logon: Do not require CTRL+ALT+DEL = Disabled Network access: Do not allow anonymous enumeration of SAM accounts and shares = Enabled Network security: LAN Manager authentication level = Send NTLMv2 response only. Refuse LM & NTLM Microsoft network client and server: Digitally sign communications (always) = Enabled Shutdown: Allow system to be shut down without having to log on = Disabled User Account Control: Run all administrators in Admin Approval Mode = Enabled Domain controller: LDAP server signing requirements = Require signing Domain member: Digitally encrypt or sign secure channel data (always) = Enabled WHY: Classic CIS and STIG level-one settings. Each blocks a named attack: blank-password remote logon, username harvesting, LM and NTLMv1 cracking or relay, SMB relay, shutdown before sign-in, and UAC bypass. NOTE: The inactivity limit locks every idle session. A VM sends the required CTRL+ALT+DEL from its window menu or Ctrl+Alt+End (Hyper-V, Remote Desktop). Command line: Hunter A-02 (registry) or A-01 (secedit). ALSO: Releases older than Windows 11 24H2 and Windows Server 2025 still accept NTLMv1: check the LAN Manager authentication level there and in mixed domains. [I-03] UAC to Always notify AREA: Secure configuration (CIS Control 4) GUI: Win+R, UserAccountControlSettings: move the slider to the top, Always notify PS> Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' -Name EnableLUA -Value 1 -Type DWord PS> Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' -Name ConsentPromptBehaviorAdmin -Value 2 -Type DWord PS> Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' -Name PromptOnSecureDesktop -Value 1 -Type DWord PS> Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' -Name FilterAdministratorToken -Value 1 -Type DWord PS> Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' -Name ConsentPromptBehaviorUser -Value 0 -Type DWord GUI: Control Panel, User Accounts, Change User Account Control settings, slider to the top. WHY: ConsentPromptBehaviorAdmin 2 (Always notify) prompts on the secure desktop for every elevation; default 5 prompts only for programs outside Windows. UAC off silently elevates every admin process; malware rides along. NOTE: FilterAdministratorToken 1 puts the built-in Administrator, the account most often used on a server, under UAC too. ConsentPromptBehaviorAdmin 0 elevates silently. EnableLUA needs a reboot. ALSO: ConsentPromptBehaviorUser 0 refuses standard-user elevation; admins elevate from their own sessions. A Security Options policy overrides the slider at the next refresh; gpresult /scope computer /v shows it. [I-04] Service audit: what runs, from where AREA: Secure configuration (CIS Control 4) PS> Get-CimInstance Win32_Service | Select-Object Name,State,StartMode,StartName,PathName | Sort-Object Name PS> Get-Service | Where-Object Status -eq Running | Sort-Object DisplayName PS> Get-Service -Name EventLog,mpssvc,WinDefend | Select-Object Name,Status,StartType PS> Get-Alias sc (in Windows PowerShell 5.1, sc runs Set-Content: type sc.exe for the service tool) CMD> sc.exe query state= all CMD> sc.exe qc CMD> sc.exe qtriggerinfo RemoteRegistry (events that can start a Manual service) CMD> sc.exe stop CMD> sc.exe config start= disabled CMD> sc.exe start (only a service the brief requires) CMD> sc.exe delete (a planted service only, after it is stopped and its file is reviewed; PowerShell 7 adds Remove-Service, and Windows PowerShell 5.1 uses sc.exe delete) CMD> sc.exe \\ qc Spooler (the same check on a remote server) PS> Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\ValidCommunities' -ErrorAction SilentlyContinue PS> Stop-Service -Name ; Set-Service -Name -StartupType Disabled WHY: Planted services: Telnet, FTP, SNMP, SSDP, UPnP, Remote Registry, Xbox, odd names, and PathName under C:\Users or C:\Temp. StartName LocalSystem runs as SYSTEM, the most powerful account on the machine. NOTE: Required services (IIS, DNS, DHCP, OpenSSH, MySQL, Apache) stay running; harden their configs. EventLog and mpssvc (firewall) read Running and Automatic; WinDefend (Defender) too, unless the brief names another antivirus. ALSO: SNMP answers 161/udp to anyone who knows a community name; public or private is a guess away. When the brief leaves SNMP out: Uninstall-WindowsFeature -Name SNMP-Service. [I-05] Roles and features: remove what the brief does not need AREA: Secure configuration (CIS Control 4) PS> Get-WindowsFeature | Where-Object Installed | Select-Object Name,DisplayName PS> Uninstall-WindowsFeature -Name FS-SMB1,Telnet-Client,TFTP-Client,Simple-TCPIP,Print-LPD-Service PS> Uninstall-WindowsFeature -Name Web-Ftp-Server (only when the brief leaves FTP out) PS> Set-SmbServerConfiguration -EnableSMB1Protocol $false -Force PS> Get-NetTCPConnection -State Listen -LocalPort 21,80,443,515 -ErrorAction SilentlyContinue GUI: Server Manager, Manage, Remove Roles and Features WHY: Each extra feature adds exposure. FS-SMB1 is server-side SMBv1 (EternalBlue); Telnet and TFTP clients speak cleartext; Simple TCP/IP services (echo, daytime, chargen) reflect traffic; LPD takes print jobs on 515. NOTE: I-15 and I-16 harden required roles (AD DS, DNS, DHCP, IIS, FTP). -Remove also deletes the feature's component-store files: reinstalls need install media. Use it last, if the brief allows. ALSO: Before removing FS-SMB1 from a server others use, run Set-SmbServerConfiguration -AuditSmb1Access $true -Force; event 3000 in Microsoft-Windows-SMBServer/Audit shows who still uses SMBv1. Read RestartNeeded and batch the restarts. [I-06] Shares AREA: Access control (CIS Control 6) PS> Get-SmbShare CMD> net share PS> Get-SmbShare | Where-Object { $_.Name -notmatch '^(ADMIN|IPC|PRINT|FAX)\$$' -and -not ($_.Name -match '^[A-Z]\$$' -and $_.Path -eq ($_.Name.Substring(0,1) + ':\')) } | Select-Object Name,Path,Description PS> Remove-SmbShare -Name "badshare" -Force PS> Get-SmbShareAccess -Name "Finance" PS> Revoke-SmbShareAccess -Name "Finance" -AccountName Everyone -Force PS> Grant-SmbShareAccess -Name "Finance" -AccountName "CORP\Finance" -AccessRight Change -Force CMD> auditpol /set /subcategory:"File Share" /success:enable /failure:enable WHY: An unexpected share is a data exfiltration path. Check the ACLs on the shares you must keep. Event 5142 names who added a share once File Share auditing is on. NOTE: A trailing $ hides a share from browsing; it still works. Normal: ADMIN$, IPC$, PRINT$, FAX$, a drive letter on its own root, and, on a DC, SYSVOL and NETLOGON. ALSO: Judge any other share; the filter line lists only added shares. The classic finding: Everyone with Full on a data share. Sharing C:\Users or a profile folder exposes user files. [I-07] Scheduled tasks AREA: Malware defenses (CIS Control 10) GUI: taskschd.msc, Task Scheduler Library: open each task's Triggers and Actions tabs; disable or delete a task the brief leaves unexplained PS> Get-ScheduledTask | Where-Object State -ne Disabled | Select-Object TaskPath,TaskName,State,Author,@{n='Run';e={($_.Actions | ForEach-Object { "$($_.Execute) $($_.Arguments)" }) -join '; '}},@{n='RunAs';e={$_.Principal.UserId}} | Format-Table -AutoSize -Wrap PS> (Get-ScheduledTask -TaskName "").Actions | Select-Object Execute,Arguments PS> Export-ScheduledTask -TaskPath '\' -TaskName '' | Out-File -FilePath "$env:USERPROFILE\Desktop\.xml" PS> Disable-ScheduledTask -TaskName "" -TaskPath "\" PS> Unregister-ScheduledTask -TaskName "" -Confirm:$false CMD> schtasks /query /fo LIST /v A task action such as powershell.exe -ExecutionPolicy Bypass -File C:\Users\Public\x.ps1 or powershell -EncodedCommand hides what it runs: read the script or decode the Base64 to text, then remove the task CMD> auditpol /set /subcategory:"Other Object Access Events" /success:enable /failure:enable PS> Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4698} | Format-List TimeCreated,Message PS> [Text.Encoding]::Unicode.GetString([Convert]::FromBase64String('')) (reads an encoded command without running it) WHY: Planted tasks re-add users, reopen ports, or run user-folder scripts every five minutes. Event 4698 logs each new task's XML and creator once Other Object Access Events auditing is on. NOTE: Tasks under \Microsoft\Windows are mostly stock; judge each root-path task by its program, since vendor updaters live there too. Export before removing: the XML keeps action, account, and author. [I-08] Startup items and Run keys AREA: Malware defenses (CIS Control 10) PS> Get-CimInstance Win32_StartupCommand | Select-Object Name,Command,Location,User PS> Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run' PS> Get-ItemProperty 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run' PS> Remove-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run' -Name "" GUI: Win+R, shell:startup (your Startup folder) and shell:common startup (every user's): remove shortcuts the brief leaves unexplained GUI: Task Manager, Startup apps. WHY: Anything that auto-runs survives a reboot. Attackers hide here with innocent names like Windows Update Helper. NOTE: Also check the RunOnce keys and the shell:startup folders. [I-09] Hosts file AREA: Secure configuration (CIS Control 4) PS> Get-Content C:\Windows\System32\drivers\etc\hosts GUI: notepad as admin, open the hosts file, delete every non-comment line except localhost WHY: Malware points update and antivirus domains at 127.0.0.1 or an attacker IP, so Defender and Windows Update silently fail. [I-10] Listening ports to process AREA: Secure configuration (CIS Control 4) CMD> netstat -abno PS> Get-NetTCPConnection -State Listen | Select-Object LocalAddress,LocalPort,OwningProcess,@{n='Path';e={(Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue).Path}} | Sort-Object LocalPort PS> Get-NetUDPEndpoint | Select-Object LocalAddress,LocalPort,OwningProcess | Sort-Object LocalPort PS> Get-Process -Id | Select-Object Name,Path PS> Stop-Process -Id -Force (after you disable what starts it, so it stays stopped) CMD> tasklist /svc CMD> netsh http show servicestate (names the program behind a port that netstat pins on PID 4, System) CMD> tcpvcon -accepteula -a -c (Sysinternals, public: every TCP and UDP endpoint with its owning process, as CSV) WHY: A port you cannot explain is a backdoor; nc.exe listeners are the classic. Map port to PID to binary path to the service or task that starts it. NOTE: Expect DC ports 53, 88, 135, 389, 445, 464, 636, 3268, 3269, and dynamic RPC. System (PID 4) owns 445; netsh http show servicestate names programs behind its HTTP.sys ports. ALSO: Before ending a listener, find what starts it (service, task, or Run key) and disable that, or it returns at the next trigger. [I-11] Remote Desktop hardening when RDP is required AREA: Access control (CIS Control 6) PS> Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name UserAuthentication -Value 1 PS> Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name SecurityLayer -Value 2 PS> $ts='HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services'; if (-not (Test-Path $ts)) { New-Item -Path $ts -Force | Out-Null } PS> foreach ($n in 'fDisableCdm','fDisablePNPRedir','fPromptForPassword','fEncryptRPCTraffic') { Set-ItemProperty -Path $ts -Name $n -Value 1 -Type DWord } PS> Get-CimInstance -Namespace root\cimv2\TerminalServices -ClassName Win32_TSGeneralSetting | Select-Object TerminalName,UserAuthenticationRequired,PolicySourceUserAuthenticationRequired CMD> net localgroup "Remote Desktop Users" PS> Get-LocalGroupMember -SID S-1-5-32-555 GUI: Win+R, SystemPropertiesRemote: Allow connections only from computers running Remote Desktop with Network Level Authentication; clear Allow Remote Assistance connections when that box appears PS> Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Remote Assistance' -Name fAllowToGetHelp -Value 0 PS> Set-NetFirewallRule -DisplayGroup "Remote Desktop" -RemoteAddress CMD> mstsc /v: /restrictedAdmin (Restricted Admin mode, for administrators: your reusable credentials stay off the far server) WHY: Network Level Authentication forces a login before a session exists, which kills pre-auth exploits, and the TLS security layer (SecurityLayer 2) proves the server is the real one before anyone types a password. Blocking drive and device redirection keeps a session from reading or dropping files on the connecting PC, and prompting at every connection defeats a password saved in an .rdp file. Administrators connect whenever RDP is on, so the Remote Desktop Users group is the list of non-admins the brief names; audit it. Remote Assistance should be off. Scope the Remote Desktop firewall rule to the admin subnet that the brief names, so only those addresses reach the port. NOTE: The redirector service (UmRdpService) stays at Manual while RDP is in use; the policy values do the blocking. PolicySource 1 in the read-back means Group Policy decides NLA. SecurityLayer 2 uses a self-signed certificate unless the brief supplies one, so the first connection shows a certificate prompt. -SID S-1-5-32-555 names Remote Desktop Users in any display language. [I-12] Firewall allow-rule review AREA: Secure configuration (CIS Control 4) GUI: wf.msc, Inbound Rules: sort by Group, then disable or delete an Allow rule the brief leaves unexplained PS> Get-NetFirewallRule -PolicyStore ActiveStore | Where-Object {$_.Enabled -eq 'True' -and $_.Direction -eq 'Inbound' -and $_.Action -eq 'Allow'} | Select-Object DisplayName,Profile | Sort-Object DisplayName PS> Get-NetFirewallRule -PolicyStore ActiveStore -Direction Outbound -Action Block -Enabled True | Select-Object DisplayName,Profile PS> Get-NetFirewallRule -DisplayName '' | Get-NetFirewallPortFilter CMD> netsh advfirewall firewall show rule name=all dir=in PS> Remove-NetFirewallRule -DisplayName "" CMD> netsh advfirewall firewall delete rule name="" PS> New-NetFirewallRule -Name 'Allow-HTTP-In' -DisplayName 'Allow HTTP (TCP 80) in' -Direction Inbound -Protocol TCP -LocalPort 80 -Action Allow -RemoteAddress CMD> netsh advfirewall firewall add rule name="HTTP from the brief subnet" dir=in action=allow protocol=TCP localport=80 remoteip= PS> Set-NetFirewallProfile -All -DefaultInboundAction Block -NotifyOnListen True -LogBlocked True WHY: A rule that admits the whole internet to 4444/tcp undoes the firewall; an outbound block on Defender or Windows Update stops protection quietly. Scope required ports to the brief's subnet. NOTE: ActiveStore lists the rules in force, Group Policy rules included. -Name gives a new rule a stable handle for Remove-NetFirewallRule -Name later. [I-13] Group Policy: where server settings really come from AREA: Secure configuration (CIS Control 4) GUI: gpmc.msc (Group Policy Management) on a DC; gpedit.msc on a member server PS> Get-GPO -All | Select-Object DisplayName,GpoStatus,ModificationTime PS> Get-GPOReport -All -ReportType Html -Path C:\Temp\gpo.html CMD> reg query HKLM\SOFTWARE\Policies /s CMD> gpupdate /force CMD> gpresult /r /scope computer CMD> w32tm /query /status (Source and Last Successful Sync Time: Kerberos refuses clocks more than 5 minutes apart) WHY: Domain GPOs override local clicks; password and lockout live in Default Domain Policy. Planted GPOs disabling Defender or the firewall re-apply about every 90 minutes on members, 5 on DCs. NOTE: Flag odd or recently changed GPOs in gpo.html. reg query HKLM\SOFTWARE\Policies /s lists machine policies; absent means Not Configured. DisableAntiSpyware 1 under Windows Defender is "Turn off Microsoft Defender Antivirus." [I-14] Event Viewer for investigations AREA: Investigation (forensics basics) GUI: eventvwr.msc, Windows Logs, Security (and System for event 7045) PS> Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4728,4732,4756} | Format-List TimeCreated,Message 4720 user created, 4726 deleted, 4728 added to global group, 4732 local group, 4756 universal group, 4740 lockout 4624 logon OK, 4625 failed, 4672 admin logon, 4768 Kerberos TGT, 4769 service ticket, 4771 pre-auth failed, 1102 log cleared Logon type 9 (NewCredentials) in event 4624 comes from runas /netonly /user:\ : borrowed credentials used for network access only PS> Get-WinEvent -FilterHashtable @{LogName='System'; Id=7045} | Format-List TimeCreated,Message 7045 new service installed: a System log event, so it takes its own filter; 4697 is its Security-log twin and names the installer once A-08 turns it on WHY: Who was added to Domain Admins and when is a question these IDs answer in one filter. [I-15] IIS and FTP hardening when the brief requires them AREA: Secure configuration (CIS Control 4) PS> Get-Website | Select-Object Name,State,PhysicalPath PS> Get-WebBinding GUI: inetmgr (IIS Manager), site, Authentication: Anonymous Authentication Disabled unless the brief says the site is public PS> Import-Module WebAdministration; Set-WebConfigurationProperty -Filter /system.webServer/directoryBrowse -Name enabled -Value $false -PSPath 'IIS:\Sites\Default Web Site' PS> Get-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' -Filter 'system.webServer/httpLogging' -Name dontLog PS> Get-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' -Location 'Default Web Site' -Filter 'system.webServer/security/access' -Name sslFlags GUI: IIS Manager, FTP site, FTP Authentication: Anonymous Disabled; FTP SSL Settings: Require SSL connections GUI: IIS Manager, server node, Request Filtering, File Name Extensions: deny .exe and .ps1 (blocks web requests for them); FTP Request Filtering, File Name Extensions: deny .exe and .ps1 (blocks uploading and downloading them) WHY: A required web or FTP server stays running. Make it safe: directory listing off, anonymous FTP off, TLS on, and the upload folder free of executables. NOTE: Require SSL (sslFlags Ssl) needs an https binding with a certificate first; it takes an http-only site offline. Check the physical path for planted .aspx webshells (B-12 file search). ALSO: dontLog False means IIS writes request logs, the evidence for webshell and password-guessing questions. Logging runs through W3SVC and the W3C Logging Service (w3logsvc); leave both at their defaults. [I-16] DNS and DHCP hygiene when the server runs them AREA: Secure configuration (CIS Control 4) PS> Get-DnsServerZone | Select-Object ZoneName,ZoneType,DynamicUpdate,SecureSecondaries PS> Get-DnsServerResourceRecord -ZoneName corp.local (look for A and CNAME records missing from the brief) CMD> nslookup -type=mx corp.local PS> Set-DnsServerPrimaryZone -Name corp.local -DynamicUpdate Secure -SecureSecondaries NoTransfer PS> Get-DhcpServerInDC PS> Get-DhcpServerv4Scope | Select-Object ScopeId,Name,State WHY: Open zone transfers hand an attacker the whole network map; insecure dynamic updates let anyone overwrite records. DHCP servers not authorized in AD are rogue. [I-17] WinRM: encrypted, with Basic off AREA: Secure configuration (CIS Control 4) CMD> winrm get winrm/config/service CMD> winrm get winrm/config/client PS> $wr='HKLM:\SOFTWARE\Policies\Microsoft\Windows\WinRM\Service'; if (-not (Test-Path $wr)) { New-Item -Path $wr -Force | Out-Null } PS> Set-ItemProperty -Path $wr -Name AllowBasic -Value 0 -Type DWord; Set-ItemProperty -Path $wr -Name AllowUnencryptedTraffic -Value 0 -Type DWord; Set-ItemProperty -Path $wr -Name DisableRunAs -Value 1 -Type DWord PS> $wc='HKLM:\SOFTWARE\Policies\Microsoft\Windows\WinRM\Client'; if (-not (Test-Path $wc)) { New-Item -Path $wc -Force | Out-Null } PS> Set-ItemProperty -Path $wc -Name AllowBasic -Value 0 -Type DWord; Set-ItemProperty -Path $wc -Name AllowUnencryptedTraffic -Value 0 -Type DWord; Set-ItemProperty -Path $wc -Name AllowDigest -Value 0 -Type DWord GUI: gpedit.msc (or gpmc.msc), Computer Configuration, Administrative Templates, Windows Components, Windows Remote Management (WinRM), WinRM Service and WinRM Client CMD> gpupdate /force WHY: WinRM (5985, 5986) carries remote PowerShell and Server Manager. Basic sends reversible passwords; unencrypted traffic exposes every command. Kerberos and default encryption stay; DisableRunAs keeps plug-ins from storing RunAs passwords. NOTE: Flag AllowUnencrypted = true in winrm get winrm/config; with WinRM stopped, read the registry. Client policy "Disallow Digest authentication" writes AllowDigest 0. Remote management in the brief keeps WinRM running. [I-18] Apache on Windows when the brief requires it AREA: Secure configuration (CIS Control 4) PS> Get-CimInstance Win32_Service -Filter "Name LIKE 'Apache%'" | Select-Object Name,State,StartName,PathName GUI: notepad C:\Apache24\conf\httpd.conf (save a copy first), then set these lines ServerTokens Prod ServerSignature Off TraceEnable Off Options FollowSymLinks (Indexes removed, in each block) CMD> C:\Apache24\bin\httpd.exe -t PS> Restart-Service -Name Apache2.4 CMD> curl.exe -sI http://localhost/ CMD> curl.exe -s -o NUL -w "%{http_code}" -X TRACE http://localhost/ WHY: ServerTokens Prod hides Apache's version in headers; ServerSignature Off, on error pages. TraceEnable Off refuses TRACE; removing Indexes ends directory listings. curl shows Server: Apache alone and 405 for TRACE. NOTE: Restart only after httpd.exe -t prints Syntax OK; typos stop the site. Restart-Service needs the name the first command shows (installer default: Apache2.4). Linux pages harden the same directives (I-12). ALSO: ServerSignature Off is the default; find On or EMail lines in httpd.conf or a virtual host. If the brief omits Apache, stop it and run C:\Apache24\bin\httpd.exe -k uninstall -n "Apache2.4". [I-19] Network checks: address, route, neighbors, names, path, and port AREA: Secure configuration (CIS Control 4) CMD> ipconfig /all CMD> route print -4 CMD> ping CMD> arp -a CMD> nslookup PS> Resolve-DnsName CMD> ipconfig /displaydns CMD> ipconfig /flushdns CMD> tracert -d
PS> Test-NetConnection -Port 445 (a file server answers on 445) WHY: Prove the network path before you blame a setting you just hardened: address, gateway, neighbors, names, path, then the port itself. NOTE: A silent ping proves little: Windows Firewall blocks inbound echo requests unless a rule allows them. Test-NetConnection shows TcpTestSucceeded True once the TCP handshake to that port completes. ALSO: In arp -a, two addresses sharing one physical address, the gateway among them, can point to ARP spoofing. Servers usually keep static addresses: compare ipconfig /all with the brief. ------------------------------ HUNTER ------------------------------------------ Hunt and harden. Security baselines, credential-theft hardening, Active Directory attack surface (roastable and stale accounts), persistence hunting, SMB and LDAP signing, and version notes. Learn it first: Defense Ladder se7, "Windows: credentials and the domain attack surface." https://freeapp4that.store/defense-ladder/#senior/se7 -------------------------------------------------------------------------------- [A-01] Security policy as a file: secedit AREA: Secure configuration (CIS Control 4) CMD> secedit /export /cfg C:\Temp\secpol.cfg [System Access] MinimumPasswordAge = 1, MaximumPasswordAge = 60, MinimumPasswordLength = 12, PasswordComplexity = 1, PasswordHistorySize = 24, LockoutBadCount = 5, ResetLockoutCount = 30, LockoutDuration = 30, AllowAdministratorLockout = 1, ClearTextPassword = 0, EnableGuestAccount = 0 CMD> secedit /configure /db C:\Windows\security\local.sdb /cfg C:\Temp\secpol.cfg /areas SECURITYPOLICY CMD> secedit /analyze /db C:\Windows\security\local.sdb /cfg C:\Temp\secpol.cfg WHY: One file, every account policy, repeatable and auditable, and the only command-line path to complexity and reversible encryption. NOTE: On a DC, domain policy wins (B-06). Before /configure, keep only [Unicode], [Version], and [System Access], so audit and registry settings stay. Typos fail silently: verify with net accounts. [A-02] LSA and anonymous-access registry hardening AREA: Secure configuration (CIS Control 4) PS> $lsa='HKLM:\SYSTEM\CurrentControlSet\Control\Lsa' PS> Set-ItemProperty -Path $lsa -Name LimitBlankPasswordUse -Value 1 -Type DWord PS> Set-ItemProperty -Path $lsa -Name RestrictAnonymous -Value 1 -Type DWord PS> Set-ItemProperty -Path $lsa -Name RestrictAnonymousSAM -Value 1 -Type DWord PS> Set-ItemProperty -Path $lsa -Name NoLMHash -Value 1 -Type DWord PS> Set-ItemProperty -Path $lsa -Name LmCompatibilityLevel -Value 5 -Type DWord PS> Set-ItemProperty -Path $lsa -Name EveryoneIncludesAnonymous -Value 0 -Type DWord PS> Set-ItemProperty -Path $lsa -Name ForceGuest -Value 0 -Type DWord PS> Set-ItemProperty -Path $lsa -Name RestrictRemoteSAM -Value 'O:BAG:BAD:(A;;RC;;;BA)' -Type String (member server) PS> Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0' -Name allownullsessionfallback -Value 0 -Type DWord PS> Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0' -Name NTLMMinClientSec -Value 537395200 -Type DWord PS> Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0' -Name NTLMMinServerSec -Value 537395200 -Type DWord PS> Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' -Name LocalAccountTokenFilterPolicy -ErrorAction SilentlyContinue PS> Remove-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' -Name LocalAccountTokenFilterPolicy WHY: RestrictAnonymous stops null-session enumeration; NoLMHash stops storing LM hashes, which crack in seconds; LmCompatibilityLevel 5 refuses NTLMv1 (Windows 11 24H2 and Windows Server 2025 remove it; check the level on older releases and mixed domains). ForceGuest 0 (Classic) keeps local users signing in over the network as themselves; RestrictRemoteSAM limits remote SAM queries to Administrators. NULL session fallback 0 and NTLM minimum session security 537395200 (NTLMv2 session security plus 128-bit encryption) close the last NTLM downgrades. LocalAccountTokenFilterPolicy 1 hands every local administrator a full token over C$ and ADMIN$ from the network, the pass-the-hash road: remove it so remote local admins stay filtered. NOTE: This is the registry form of the Watchman Security Options. A missing LocalAccountTokenFilterPolicy is the good result. MSV1_0 and the System key exist on every install, so Set-ItemProperty writes into them directly. On a domain controller, leave RestrictRemoteSAM undefined unless the brief asks for it: users and admin tools read Active Directory through remote SAM calls. [A-03] Credential-theft hardening: LLMNR, NetBIOS, WDigest AREA: Secure configuration (CIS Control 4) PS> if (-not (Test-Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\DNSClient')) { New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\DNSClient' -Force | Out-Null } PS> Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\DNSClient' -Name EnableMulticast -Value 0 -Type DWord PS> Get-CimInstance Win32_NetworkAdapterConfiguration -Filter "IPEnabled=TRUE" | Invoke-CimMethod -MethodName SetTcpipNetbios -Arguments @{TcpipNetbiosOptions=2} PS> Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest' -Name UseLogonCredential -Value 0 -Type DWord WHY: LLMNR and NBT-NS are what Responder poisons to collect NTLMv2 hashes for cracking or relay. WDigest set to 1 keeps plaintext passwords in LSASS memory for mimikatz. NOTE: The Test-Path guard creates the key only when it is missing, so DNS client policies already in it stay (A-04 explains why). [A-04] AutoRun and AutoPlay off everywhere AREA: Malware defenses (CIS Control 10) PS> if (-not (Test-Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer')) { New-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Force | Out-Null } CMD> reg export HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer C:\Backup\explorer-policies.reg (back up the key before you change it) PS> Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name NoDriveTypeAutoRun -Value 255 -Type DWord PS> Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name NoAutorun -Value 1 -Type DWord CMD> reg add HKLM\SOFTWARE\Policies\Microsoft\Windows\Explorer /v NoAutoplayfornonVolume /t REG_DWORD /d 1 /f CMD> reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer /v NoDriveTypeAutoRun /f (rollback, only when the brief needs AutoPlay back: reg import C:\Backup\explorer-policies.reg restores the saved values; reg delete removes one the backup lacked) WHY: USB-drop attacks. Conficker-era, still a CIS and STIG requirement. NoAutoplayfornonVolume covers phones and cameras, which the drive-type value leaves out. NOTE: This Explorer key already holds other policies, and New-Item -Force on an existing key deletes every value in it. The Test-Path guard and reg add both keep them. [A-05] User Rights Assignment AREA: Access control (CIS Control 6) GUI: secpol.msc, Local Policies, User Rights Assignment Access this computer from the network = Administrators, Authenticated Users (remove Everyone and Guest) Deny log on through Remote Desktop Services = Guest Deny access to this computer from the network = Guest Debug programs = empty, or Administrators only Act as part of the operating system = empty Back up files and directories, Restore files and directories, Take ownership of files or other objects = Administrators Manage auditing and security log = Administrators Change the system time = Administrators, LOCAL SERVICE Allow log on locally = Administrators on a member server, plus Users when the brief names people who sign in at this console CMD> secedit /export /cfg C:\Windows\Temp\ura.inf /areas USER_RIGHTS PS> Select-String -Path C:\Windows\Temp\ura.inf -Pattern 'SeDebugPrivilege|SeTcbPrivilege|SeNetworkLogonRight|SeBackupPrivilege|SeSecurityPrivilege' CMD> whoami /priv WHY: Rights bypass ACLs: Debug programs dumps LSASS passwords; Back up files reads the SAM hive. Restore and Take ownership rewrite any file; Manage auditing clears the Security log (event 1102). NOTE: Export lists SIDs: *S-1-5-32-544 Administrators, *S-1-5-32-545 Users, *S-1-5-11 Authenticated Users; unknown SIDs are deleted or planted accounts. Remove extra user and group accounts; LOCAL SERVICE, NETWORK SERVICE, and SERVICE stay. ALSO: Set a right by applying SeDebugPrivilege = *S-1-5-32-544 (empty clears it) under [Privilege Rights] as in A-01 with /areas USER_RIGHTS. Changes apply at next sign-in and log 4704 and 4705. [A-06] Deep persistence and backdoor hunt AREA: Malware defenses (CIS Control 10) PS> Get-CimInstance Win32_Process | Select-Object Name,ProcessId,ParentProcessId,CommandLine | Sort-Object Name CMD> quser (who is signed in now, at the console or over Remote Desktop: capture it before you change anything) CMD> wevtutil epl Security E:\case\-Sec.evtx (export the logs before you change anything; repeat for System) PS> Get-ChildItem C:\ -Recurse -Include nc.exe,ncat.exe,netcat*,mimikatz*,psexec*,*.ps1,*.vbs -ErrorAction SilentlyContinue | Select-Object FullName,LastWriteTime PS> Get-CimInstance -Namespace root\subscription -ClassName __EventFilter PS> Get-CimInstance -Namespace root\subscription -ClassName __EventConsumer PS> Get-CimInstance -Namespace root\subscription -ClassName __FilterToConsumerBinding PS> $PROFILE | Select-Object *; Get-Content $PROFILE.AllUsersAllHosts -ErrorAction SilentlyContinue PS> Get-ChildItem -Path C:\Users,C:\ProgramData,C:\Windows\Temp -Recurse -Force -File -Include *.exe,*.dll,*.scr -ErrorAction SilentlyContinue | Where-Object FullName -notmatch '^C:\\Users\\(All Users|Default User)\\' | Get-AuthenticodeSignature | Where-Object Status -ne 'Valid' | Select-Object Path,Status PS> Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree' -Recurse | Where-Object { -not $_.GetValue('SD') -and $_.GetValue('Id') } | Select-Object Name CMD> wevtutil sl Microsoft-Windows-TaskScheduler/Operational /e:true CMD> autorunsc.exe -accepteula -a * -c -nobanner (Sysinternals, public) CMD> sigcheck -accepteula -u -e -s C:\Users\Public (Sysinternals, public: unsigned executable images under a folder; -h adds hashes) CMD> streams -accepteula -s C:\Users\Public (Sysinternals, public: alternate data streams a download or a hidden payload leaves; -d deletes them) WHY: WMI event subscriptions and PowerShell profiles are the persistence spots checklists miss; Autoruns shows every auto-start location at once. A task with SD deleted runs hidden from Get-ScheduledTask and schtasks. NOTE: A renamed tool keeps its missing or broken signature. Unsigned programs in Users, ProgramData, or Temp are leads; legitimate tools ship unsigned too, so check the brief and the publisher. ALSO: Get Sysinternals from learn.microsoft.com/sysinternals only, and only where policy allows third-party tools. The wevtutil line turns on Task Scheduler history, which starts off. [A-07] NTFS permissions AREA: Access control (CIS Control 6) CMD> icacls "C:\CompanyData" /save C:\Windows\Temp\acl.txt /t /c CMD> icacls "C:\CompanyData" CMD> icacls "C:\CompanyData" /inheritance:r /grant:r "Administrators:(OI)(CI)F" "Users:(OI)(CI)RX" /t CMD> icacls "C:\CompanyData" /remove:g Everyone /t PS> Get-Acl "C:\CompanyData" | Format-List CMD> accesschk -accepteula -uwcqv "Authenticated Users" * (Sysinternals, public: services a standard account can reconfigure) CMD> accesschk -accepteula -s -w Users "C:\Program Files" (Sysinternals, public: files and folders a standard account can write) WHY: Everyone with Full control on shares or Program Files lets anyone swap a binary a service runs as SYSTEM. (OI) object inherit, (CI) container inherit, /t recurse, /inheritance:r stop inheriting. NOTE: Save ACLs first: icacls C:\ /restore C:\Windows\Temp\acl.txt puts them back (restore runs from the parent folder). SIDs work in any display language: /remove:g *S-1-1-0 for Everyone, *S-1-5-11 for Authenticated Users. ALSO: A folder made at the root of C: inherits Authenticated Users Modify, so read it before you trust it. [A-08] Fine-grained auditing and PowerShell logging AREA: Audit logging (CIS Control 8) CMD> auditpol /set /subcategory:"Credential Validation" /success:enable /failure:enable CMD> auditpol /set /subcategory:"Logon" /success:enable /failure:enable CMD> auditpol /set /subcategory:"Account Lockout" /failure:enable CMD> auditpol /set /subcategory:"User Account Management" /success:enable /failure:enable CMD> auditpol /set /subcategory:"Security Group Management" /success:enable CMD> auditpol /set /subcategory:"Process Creation" /success:enable CMD> reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\Audit" /v ProcessCreationIncludeCmdLine_Enabled /t REG_DWORD /d 1 /f CMD> auditpol /set /subcategory:"Security System Extension" /success:enable CMD> auditpol /set /subcategory:"Audit Policy Change" /success:enable /failure:enable CMD> auditpol /set /subcategory:"Filtering Platform Connection" /success:disable /failure:disable CMD> reg add HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v SCENoApplyLegacyAuditPolicy /t REG_DWORD /d 1 /f PS> if (-not (Test-Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging')) { New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Force | Out-Null } PS> Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name EnableScriptBlockLogging -Value 1 -Type DWord PS> Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-PowerShell/Operational'; Id=4104} -MaxEvents 3 | Format-List TimeCreated,Message PS> Get-ExecutionPolicy -List (a MachinePolicy or UserPolicy value comes from Group Policy and wins over the scopes below it) PS> Set-ExecutionPolicy -Scope CurrentUser RemoteSigned (only when you must run your own script and -List shows a stricter policy: Windows Server already starts at RemoteSigned, which lets local scripts run while downloaded ones need a trusted signature) CMD> auditpol /get /category:* WHY: Subcategory settings take precedence over the nine legacy categories once Audit: Force audit policy subcategory settings is Enabled (SCENoApplyLegacyAuditPolicy 1). Credential Validation writes 4776 for every local-account password check, so a guessing run shows beside 4625. The command-line value fills the Process Command Line field of every 4688. Security System Extension writes 4697, which names who installed a service. Script Block Logging (event 4104) records what every PowerShell script actually did, including the attacker's. NOTE: Run it after I-01: a category-wide command rewrites every subcategory in its category. Account Lockout has Failure events only (the lockout itself, 4740, comes from User Account Management), and Security Group Management has Success events only. Filtering Platform Connection floods the log after a category-wide run; turn it back on when the brief asks for connection auditing. auditpol names drop the Audit prefix that secpol shows, and each subcategory also takes a GUID that works in any display language, such as {0CCE923F-69AE-11D9-BED3-505054503030} for Credential Validation. On a domain, a GPO that defines advanced auditing re-applies its list at each refresh, so set the values there. PowerShell 7 reads its own key, HKLM:\SOFTWARE\Policies\Microsoft\PowerShellCore\ScriptBlockLogging, and logs to PowerShellCore/Operational. ALSO: Execution policy is a safety setting rather than a security boundary: anyone can bypass it, so script block logging (4104) is what records the script that ran. [A-09] Defender beyond on: exclusions, PUA, cloud, ASR AREA: Malware defenses (CIS Control 10) PS> Get-MpPreference | Select-Object ExclusionPath,ExclusionProcess,ExclusionExtension PS> Remove-MpPreference -ExclusionPath "C:\evil" CMD> reg query "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Exclusions" /s PS> Get-MpPreference | Select-Object ThreatIDDefaultAction_Ids,ThreatIDDefaultAction_Actions PS> Remove-MpPreference -ThreatIDDefaultAction_Ids PS> Set-MpPreference -PUAProtection Enabled -MAPSReporting Advanced -SubmitSamplesConsent SendAllSamples PS> Add-MpPreference -AttackSurfaceReductionRules_Ids 9e6c4e1f-7d60-472f-ba1a-a39ef669e4b2 -AttackSurfaceReductionRules_Actions Enabled PS> Get-MpThreatDetection | Select-Object DomainUser,ProcessName,InitialDetectionTime WHY: Attackers exclude their folder instead of disabling Defender, or set ThreatIDDefaultAction 6 (Allow) so one threat runs; Get-MpPreference shows both. PUA protection catches junkware; the LSASS rule blocks mimikatz-style dumping. NOTE: An exclusion set by policy returns after Remove-MpPreference: set the policy to Not Configured in gpedit.msc (or delete the value under the policy key) first, then remove the local one. [A-10] Active Directory attack surface: roastable and stale accounts AREA: Account management (CIS Control 5) PS> Search-ADAccount -PasswordNeverExpires | Select-Object Name PS> Search-ADAccount -AccountInactive -TimeSpan 90.00:00:00 | Select-Object Name,LastLogonDate PS> Get-ADUser -Filter {PasswordNotRequired -eq $true} | Select-Object Name PS> Get-ADUser -Filter {DoesNotRequirePreAuth -eq $true} | Select-Object Name PS> Set-ADAccountControl -Identity alice -DoesNotRequirePreAuth $false -PasswordNotRequired $false PS> Get-ADUser -Filter {ServicePrincipalName -like "*"} -Properties ServicePrincipalName | Select-Object Name,ServicePrincipalName CMD> klist (each cached ticket's KerbTicket Encryption Type: AES-256 is the goal, RSADSI RC4-HMAC(NT) the finding) PS> Get-ADUser -Filter {AdminCount -eq 1} | Select-Object Name PS> Get-ADUser -Filter {TrustedForDelegation -eq $true} | Select-Object Name PS> Get-ADComputer -Filter {TrustedForDelegation -eq $true} | Select-Object Name (computers with unconstrained delegation: the domain controllers belong here, any other is a finding) WHY: Disabled Kerberos pre-auth invites AS-REP roasting, a user-account SPN invites Kerberoasting, and stale admins or never-expiring passwords hold quiet persistence. One cmdlet finds each flag; one fixes it. NOTE: SPNs belong on long-password service accounts or group managed service accounts. A new password breaks the service until entered in services.msc, Log On tab (SQL Server Configuration Manager for SQL). [A-11] SMB and LDAP signing AREA: Secure configuration (CIS Control 4) PS> Get-SmbServerConfiguration | Select-Object RequireSecuritySignature; Get-SmbClientConfiguration | Select-Object RequireSecuritySignature PS> Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters' | Select-Object LDAPServerIntegrity,LdapEnforceChannelBinding PS> Set-SmbServerConfiguration -RequireSecuritySignature $true -EncryptData $true -Force PS> Set-SmbClientConfiguration -RequireSecuritySignature $true -Force PS> Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters' -Name LDAPServerIntegrity -Value 2 -Type DWord PS> Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters' -Name LdapEnforceChannelBinding -Value 2 -Type DWord WHY: Required SMB signing stops NTLM relay to the file server. Required LDAP signing and channel binding stop relay to the domain controller, where one weak host becomes domain admin. NOTE: Defaults differ by release and domain build (see Version notes), so verify each value. Before requiring LDAP signing or channel binding on a DC, confirm every client supports it. [A-12] Verify, document, re-check CMD> gpresult /r CMD> net accounts PS> Get-MpComputerStatus | Select-Object RealTimeProtectionEnabled,AntivirusSignatureLastUpdated PS> Get-NetFirewallProfile | Select-Object Name,Enabled PS> Get-LocalGroupMember Administrators CMD> netstat -abno WHY: A change log of what, when, and why lets you reverse a breaking change in thirty seconds instead of thirty minutes. Real incident response runs on the same record. [A-13] Version notes: Windows Server 2025 GUI: Win+R, winver: edition, version (24H2), and OS build This page targets Windows Server 2025 (Windows 11 shell: Settings, Windows Update). Several defaults changed: read the current value instead of assuming. SMB: 2025 requires signing on all outbound SMB connections; domain controllers require it inbound as before LDAP: new 2025 Active Directory deployments require LDAP signing by default; an upgraded domain may not, so read LDAPServerIntegrity (A-11) OpenSSH Server is installed by default; Server Manager, Local Server, Remote SSH Access turns sshd on or off. Unless the brief requires SSH, keep sshd stopped and Disabled Delegated managed service accounts (dMSA) are new: they migrate a legacy service account (A-10) to managed, randomized keys Removed: Windows PowerShell 2.0, NTLMv1, WordPad, SMTP Server, IIS 6 Management Console; WMIC is an optional feature on demand (use Get-CimInstance) WHY: Every other item holds across releases; release changes live here. Check this list before you flag a default as a finding or count a changed default as a fix. [A-14] Windows Installer: AlwaysInstallElevated off AREA: Access control (CIS Control 6) CMD> reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer CMD> reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer CMD> reg add HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated /t REG_DWORD /d 0 /f CMD> reg add HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated /t REG_DWORD /d 0 /f CMD> reg add HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v EnableUserControl /t REG_DWORD /d 0 /f GUI: gpedit.msc, Computer Configuration and User Configuration, Administrative Templates, Windows Components, Windows Installer: Always install with elevated privileges = Disabled WHY: AlwaysInstallElevated at 1 in both HKLM and HKCU runs any user's .msi as SYSTEM: a one-step privilege escalation Microsoft strongly discourages. EnableUserControl 0 keeps install options with administrators. NOTE: HKCU covers only the signed-in user. Check each profile the brief keeps: sign in as that user, or read HKEY_USERS\\SOFTWARE\Policies\Microsoft\Windows\Installer; reg add creates missing keys and keeps existing values. [A-15] Encryption, boot integrity, and recovery: BitLocker, TPM, Secure Boot, and an image backup AREA: Data protection (CIS Control 3) GUI: msinfo32, System Summary: BIOS Mode UEFI and Secure Boot State On; tpm.msc: Specification Version 2.0 PS> Confirm-SecureBootUEFI PS> Get-Tpm PS> Install-WindowsFeature BitLocker -IncludeAllSubFeature -IncludeManagementTools (then restart) PS> Get-BitLockerVolume CMD> manage-bde -status PS> Resume-BitLocker -MountPoint C: (turns suspended protection back on) PS> Add-BitLockerKeyProtector -MountPoint C: -RecoveryPasswordProtector (before you encrypt: the 48-digit recovery password) PS> Enable-BitLocker -MountPoint C: -TpmProtector (then encrypt a FullyDecrypted drive) PS> Backup-BitLockerKeyProtector -MountPoint C: -KeyProtectorId (domain-joined: copies the recovery password to Active Directory) PS> Install-WindowsFeature Windows-Server-Backup CMD> wbadmin start backup -backupTarget:E: -include:C: -allCritical -quiet WHY: A stolen disk reads in full on another computer unless BitLocker encrypts it, and a TPM with Secure Boot keeps the unlock tied to an untampered boot. NOTE: Save the recovery password away from the machine before you encrypt. Suspend-BitLocker pauses protection for firmware updates; Resume-BitLocker turns it back on. ALSO: Windows Server adds BitLocker and Windows Server Backup as features: install each first, and restart after BitLocker. wbadmin backs up C: and everything a bare-metal restore needs to drive E:. ------------------------------ FIX OR BREAK? (practice cards) ------------------ Brief: Authorized administrators: alice. Authorized users: bob, carol. Action: Remove bob from the Administrators group. Call: FIX. Bob is a standard user per the brief. Demoting that account is least privilege. Brief: Investigation 1: what is the MD5 hash of C:\Users\Public\secret.mp3? Action: Delete every media file on the machine first, then start the investigation questions. Call: CHECK FIRST. Answer the investigation question before you destroy the evidence. Evidence first, fixes second. Brief: You log in as alice. Alice is an authorized administrator. Action: Change the password of every user including alice to a strong one. Call: CHECK FIRST. Changing the sign-in account's password is usually fine but can lock you out if it is recorded wrong; the brief decides. Record every password you set. Brief: Nothing in the brief mentions the backup agent installed under C:\Program Files\BackupAgent. Action: Delete C:\Program Files\BackupAgent because it looks like unknown software. Call: CHECK FIRST. Unrecognized is distinct from unauthorized. Check the publisher, the service that runs it, and its scheduled tasks, then ask the owner before removing a backup or monitoring agent. Brief: This is the domain controller for corp.local. Authorized Domain Admins: alice, dsmith. Action: Remove svc_print from Domain Admins. Call: FIX. Unauthorized Domain Admin membership is the single most valuable fix on a domain controller. Brief: The DC runs DNS for the whole company. Action: Uninstall-WindowsFeature DNS to reduce attack surface. Call: BREAKS IT. Required role. Harden the zones (no transfers, secure updates) instead. Brief: net accounts on the DC shows minimum password length 0. Action: Run net accounts /minpwlen:12 and move on to the next item. Call: CHECK FIRST. On a DC the Default Domain Policy overrides it. Verify with Get-ADDefaultDomainPasswordPolicy and change the domain policy. Brief: The Finance share is for the Finance group only. Action: Revoke-SmbShareAccess for Everyone on the Finance share and grant CORP\Finance Change. Call: FIX. Least privilege on a required share: keep it, scope it. Brief: IIS hosts the public company website; anonymous visitors must be able to read it. Action: Disable Anonymous Authentication on the Default Web Site. Call: BREAKS IT. That takes the public site offline. Keep anonymous read, turn off directory browsing, and check the web root for webshells instead. Brief: The DC is not a print server. Action: Stop and disable the Print Spooler service. Call: FIX. PrintNightmare class. Spooler off on any DC that does not print. Brief: Investigation 3: which account was added to Domain Admins on 3 October? Action: Clear the Security log to reduce noise before investigating. Call: BREAKS IT. That destroys the evidence (and logs event 1102 against you). Filter for 4728 and 4756 instead. Brief: svc_sql runs the SQL service and must keep working. Action: Set-ADAccountControl -Identity svc_sql -DoesNotRequirePreAuth $false, give svc_sql a new 25-character random password, and update the SQL service's logon password to match. Call: FIX. Removes the AS-REP roast, and updating the service's stored logon password keeps SQL running. Brief: The intranet site on this server must stay reachable, and Get-WebBinding shows only an http binding on port 80. Action: Set Require SSL (sslFlags Ssl) on the site now. Call: BREAKS IT. With only an http binding, Require SSL refuses every request and the site goes offline. Add an https binding with a certificate first, then require SSL. Brief: The FTP site must let anonymous visitors download files; icacls on the FTP root shows Everyone:(OI)(CI)(M). Action: Save the ACL with icacls /save, then replace Everyone Modify with Everyone read and execute on the FTP root. Call: FIX. Anonymous downloads need read and execute only; Modify lets any visitor upload or replace files. The saved ACL makes the change reversible. Brief: Staff map shares on this file server, and the brief requires the firewall on every profile. A staff PC's ping to the server times out while its mapped drive works. Action: Turn off Windows Firewall on this server so ping answers. Call: BREAKS IT. The brief requires the firewall, and a silent ping proves little: Windows Firewall blocks inbound echo requests unless a rule allows them. Test-NetConnection -Port 445 from the PC tests the share itself. Brief: The brief requires BitLocker on this server's C: drive. Get-BitLockerVolume shows C: FullyDecrypted with an empty KeyProtector list. Action: Run Add-BitLockerKeyProtector -MountPoint C: -RecoveryPasswordProtector, save the recovery password off the server, then run Enable-BitLocker -MountPoint C: -TpmProtector. Call: FIX. That is the safe order: the recovery password exists, and sits away from the server, before encryption starts, so a TPM change after a firmware update still leaves a way back in. ------------------------------ SPOT THE FINDING (output snippets) -------------- Output of net accounts. Brief: minimum length 12, maximum age 60, history 24, lockout after 5. Tap the line that is the finding. Minimum password length: 12 Maximum password age (days): 60 >> Lockout threshold: Never Length of password history maintained: 24 WHY: Lockout threshold Never means unlimited password guesses. Set it to 5 with net accounts /lockoutthreshold:5. Get-NetFirewallProfile output. Tap the finding. Domain True Private True >> Public False DefaultInboundAction Block WHY: The Public profile is off. A common misconfiguration leaves exactly one profile disabled. netstat -abno output. Tap the finding. TCP 0.0.0.0:135 LISTENING [svchost.exe] TCP 0.0.0.0:445 LISTENING System >> TCP 0.0.0.0:4444 LISTENING [nc.exe] TCP 127.0.0.1:5040 LISTENING [svchost.exe] WHY: A netcat listener on 4444 is a backdoor. Find its PID, its path, and whatever task or Run key starts it. Get-MpPreference output. Tap the finding. PUAProtection : 1 >> ExclusionPath : {C:\Users\Public\Libraries} DisableRealtimeMonitoring : False MAPSReporting : 2 WHY: An exclusion on a Public folder is how malware hides from a running Defender. Remove it with Remove-MpPreference. Registry values under HKLM:\SYSTEM\CurrentControlSet\Control\Lsa. Tap the finding. RestrictAnonymous : 1 NoLMHash : 1 >> LmCompatibilityLevel : 0 LimitBlankPasswordUse : 1 WHY: LmCompatibilityLevel 0 sends LM and NTLMv1 responses, which crack in minutes. Set it to 5. Check the level on older releases and mixed domains; Windows 11 24H2 and Windows Server 2025 remove NTLMv1. Get-ADGroupMember "Domain Admins". Brief: authorized Domain Admins are alice, dsmith, and the built-in Administrator. Tap the finding. alice dsmith >> svc_print Administrator WHY: A service account in Domain Admins is the highest-value finding on a domain controller. Remove it and investigate what it runs. Get-ADUser output. Tap the finding. alice Enabled True PasswordNotRequired False >> bob Enabled True PasswordNotRequired True carol Enabled True PasswordNotRequired False krbtgt Enabled False PasswordNotRequired False WHY: PasswordNotRequired True allows a blank password regardless of policy. Set-ADAccountControl -PasswordNotRequired $false, then reset the password. Get-WindowsFeature output filtered to Installed. The brief requires only AD DS and DNS. Tap the finding. AD-Domain-Services Installed DNS Installed >> FS-SMB1 Installed RSAT-AD-Tools Installed WHY: SMBv1 on a domain controller. Uninstall-WindowsFeature FS-SMB1, and keep -Remove for a final pass the brief allows. Get-DnsServerZone output. Tap the finding. >> corp.local Primary DynamicUpdate Secure SecureSecondaries TransferAnyServer _msdcs.corp.local Primary DynamicUpdate Secure SecureSecondaries NoTransfer 0.in-addr.arpa Primary DynamicUpdate None SecureSecondaries NoTransfer . Forwarder WHY: TransferAnyServer lets anyone dump the zone. Set-DnsServerPrimaryZone -SecureSecondaries NoTransfer. Get-ADUser -Filter {DoesNotRequirePreAuth -eq $true}. Tap the finding. Name: svc_sql Enabled: True >> DoesNotRequirePreAuth: True SamAccountName: svc_sql WHY: An account without pre-auth can be AS-REP roasted offline. Set-ADAccountControl -DoesNotRequirePreAuth $false. Get-CimInstance Win32_Service output: Name, StartName, PathName. Tap the finding. DNS LocalSystem C:\Windows\system32\dns.exe EventLog NT AUTHORITY\LocalService C:\Windows\System32\svchost.exe -k LocalServiceNetworkRestricted -p >> HealthMon LocalSystem C:\Users\Public\svc\health.exe W3SVC LocalSystem C:\Windows\system32\svchost.exe -k iissvcs WHY: A SYSTEM service runs from a folder every user can write to, so the path marks it as planted, whatever its name. Record its path and hash, then stop, disable, and remove it. reg query of the Windows Update policy keys. The brief says this server updates straight from Microsoft. Tap the finding. NoAutoUpdate REG_DWORD 0x0 AUOptions REG_DWORD 0x4 >> UseWUServer REG_DWORD 0x1 ScheduledInstallDay REG_DWORD 0x0 WHY: UseWUServer 1 sends every update check to the WUServer address instead of Microsoft, while the brief says updates come straight from Microsoft, so updates stop while the service runs. Delete UseWUServer and WUServer from the policy keys, then check for updates. net share output. Tap the finding. C$ C:\ Default share IPC$ Remote IPC ADMIN$ C:\Windows Remote Admin >> tools$ C:\Users\Public\tools WHY: A $ hides a share from browsing and keeps it reachable. tools$ is an added share on a folder every user can write to: record it, then Remove-SmbShare -Name tools$ -Force when the brief leaves it out. The other three are the defaults. Get-MpPreference output. Tap the finding. PUAProtection : 1 ThreatIDDefaultAction_Ids : {2147519003} >> ThreatIDDefaultAction_Actions : {6} DisableRealtimeMonitoring : False WHY: Action 6 is Allow: Defender lets that threat ID run untouched. Remove-MpPreference -ThreatIDDefaultAction_Ids 2147519003, check the policy key for the same override, then scan. winrm get winrm/config/service, a few lines. Tap the finding. AllowRemoteAccess = true >> AllowUnencrypted = true Auth: Basic = false Auth: Kerberos = true WHY: AllowUnencrypted true lets WinRM take commands and passwords in the clear over HTTP. Set the WinRM Service policy Allow unencrypted traffic to Disabled (AllowUnencryptedTraffic 0) and read it back with winrm get winrm/config/service. UAC registry values. The brief requires a prompt on the secure desktop. Tap the finding. EnableLUA : 1 >> ConsentPromptBehaviorAdmin : 0 PromptOnSecureDesktop : 1 FilterAdministratorToken : 1 WHY: ConsentPromptBehaviorAdmin 0 lets admins elevate silently. Set 2 (Always notify) or 5, the default; with PromptOnSecureDesktop 1, both prompt on the secure desktop. Get-BitLockerVolume -MountPoint C: | Format-List, a few lines. Tap the finding. VolumeStatus : FullyEncrypted EncryptionPercentage : 100 KeyProtector : {RecoveryPassword, Tpm} >> ProtectionStatus : Off WHY: ProtectionStatus Off on a FullyEncrypted drive means protection is suspended: the key sits unprotected on the disk. Run Resume-BitLocker -MountPoint C:, then read Get-BitLockerVolume again. ------------------------------ OFFICIAL SOURCES -------------------------------- Microsoft security baselines https://learn.microsoft.com/en-us/windows/security/operating-system-security/device-management/windows-security-configuration-framework/windows-security-baselines What's new in Windows Server 2025 https://learn.microsoft.com/en-us/windows-server/get-started/whats-new-windows-server-2025 Best practices for securing Active Directory https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/plan/security-best-practices/best-practices-for-securing-active-directory Set-ADDefaultDomainPasswordPolicy https://learn.microsoft.com/en-us/powershell/module/activedirectory/set-addefaultdomainpasswordpolicy?view=windowsserver2025-ps auditpol command reference https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/auditpol secedit command reference https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/secedit Microsoft Defender Antivirus PowerShell cmdlets https://learn.microsoft.com/en-us/defender-endpoint/use-powershell-cmdlets-microsoft-defender-antivirus Get started with OpenSSH Server for Windows https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse CIS Critical Security Controls v8.1 https://www.cisecurity.org/controls/v8 CIS Benchmarks https://www.cisecurity.org/cis-benchmarks ================================================================================