diff --git a/CHANGELOG.md b/CHANGELOG.md index 07fc1a9..530a795 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ Releases are tagged `vX.Y.Z` and published with a zip and a SHA256 checksum. ## [Unreleased] +### Added + +- 🖧 **SMB server guest logons and security events are collected.** The server side of insecure guest-logon auditing is now on too (event 3023), with the two server logs it can land in: SMBServer/Security (Microsoft's docs; also session authentication failures 551, access denied 1006/1007/1009, weak session keys 1906) and SMBServer/Operational (where current Windows 11 builds write 3023). Both logs are raised from 8 MB to 128 MB. Mapped on the Settings catalog and Group Policy pages and carried in the GPO pack. Windows 11 24H2 / Server 2025 and later. + ## [2.2.0] - 2026-09-24 Tighter checks on what the kit already claims, from a review of Yamato WELA's open issues: advanced audit policy can't be silently overridden, Test flags CrashOnAuditFail and empty AppLocker logs, SMB guest logons are audited, "do not overwrite" logs are repaired, and failed log changes are no longer reported as success. diff --git a/Enable-LoggingBaseline.ps1 b/Enable-LoggingBaseline.ps1 index 0141561..969ec10 100644 --- a/Enable-LoggingBaseline.ps1 +++ b/Enable-LoggingBaseline.ps1 @@ -139,7 +139,7 @@ function Remove-RegValue { function Set-SmbAuditSetting { param([hashtable]$Item) - $setParams = @{ $Item.Id = $Item.Value; Force = $true } + $setParams = @{ (Get-SmbSettingName $Item) = $Item.Value; Force = $true } if ($Item.Side -eq 'Server') { Set-SmbServerConfiguration @setParams } else { Set-SmbClientConfiguration @setParams } } @@ -255,7 +255,7 @@ try { try { if (-not $smbNow.ContainsKey($sb.Id)) { continue } if ($PSCmdlet.ShouldProcess("SMB audit: $($sb.Id)", "Restore to $($sb.Value)")) { - Set-SmbAuditSetting -Item @{ Id = $sb.Id; Side = $sb.Side; Value = [bool]$sb.Value } + Set-SmbAuditSetting -Item @{ Id = $sb.Id; Setting = (Get-SmbSettingName $sb); Side = $sb.Side; Value = [bool]$sb.Value } Add-Result 'SmbAudit' $sb.Id 'Changed' "Restored to $($sb.Value)" } } catch { Add-Result 'SmbAudit' $sb.Id 'Error' $_.Exception.Message; $exitCode = 1 } @@ -318,7 +318,7 @@ try { $smbNow = Get-SmbAuditState foreach ($sa in $script:BaselineSmbAuditSettings) { if ($smbNow.ContainsKey($sa.Id)) { - $smbState += @{ Id = $sa.Id; Side = $sa.Side; Value = $smbNow[$sa.Id] } + $smbState += @{ Id = $sa.Id; Setting = (Get-SmbSettingName $sa); Side = $sa.Side; Value = $smbNow[$sa.Id] } } } diff --git a/New-LoggingBaseline.ps1 b/New-LoggingBaseline.ps1 index 9ce58cd..298df33 100644 --- a/New-LoggingBaseline.ps1 +++ b/New-LoggingBaseline.ps1 @@ -161,7 +161,7 @@ foreach ($sa in $script:BaselineSmbAuditSettings) { Section = 'SMB audit settings (Windows 11 24H2 / Server 2025+)' ItemType = 'SmbAudit' Id = $sa.Id - Name = "$($sa.Side): $($sa.Id) = $($sa.Value)" + Name = "$($sa.Side): $(Get-SmbSettingName $sa) = $($sa.Value)" Tier = $sa.Tier Scope = $sa.Scope Purpose = $sa.Purpose diff --git a/WinLogKit.Common.ps1 b/WinLogKit.Common.ps1 index e919c83..34884f6 100644 --- a/WinLogKit.Common.ps1 +++ b/WinLogKit.Common.ps1 @@ -127,6 +127,17 @@ function Format-AuditSetting { # Current state of the SMB audit settings (Windows 11 24H2 / Server 2025+). # Returns a hashtable Id -> current bool; items missing from the hashtable are # unsupported on this OS (the properties only exist on Server 2025 / Win11 24H2+). +# The Set-/Get-Smb*Configuration property an SMB audit item maps to: its +# Setting when it has one (the same setting exists on client and server, +# and Ids must be unique), otherwise its Id. Works for settings-table +# hashtables and for items read back from a rollback baseline. +function Get-SmbSettingName { + param($Item) + if ($Item -is [hashtable]) { if ($Item.ContainsKey('Setting') -and $Item.Setting) { return $Item.Setting } } + elseif ($Item.PSObject.Properties.Name -contains 'Setting' -and $Item.Setting) { return $Item.Setting } + return $Item.Id +} + function Get-SmbAuditState { $state = @{} $srv = $null; $cli = $null @@ -135,8 +146,9 @@ function Get-SmbAuditState { foreach ($item in $script:BaselineSmbAuditSettings) { $cfg = $srv if ($item.Side -eq 'Client') { $cfg = $cli } - if ($null -ne $cfg -and ($cfg.PSObject.Properties.Name -contains $item.Id)) { - $state[$item.Id] = [bool]$cfg.($item.Id) + $name = Get-SmbSettingName $item + if ($null -ne $cfg -and ($cfg.PSObject.Properties.Name -contains $name)) { + $state[$item.Id] = [bool]$cfg.($name) } } return $state diff --git a/WinLogKit.Settings.ps1 b/WinLogKit.Settings.ps1 index 63c0568..e4d7ad3 100644 --- a/WinLogKit.Settings.ps1 +++ b/WinLogKit.Settings.ps1 @@ -209,6 +209,17 @@ $script:BaselineChannels = @( Categories = @('Remote access','Network flow and sessions') Purpose = 'SMB client audit events, including signing/encryption capability auditing (31998/31999) and insecure guest logons (31997) on Windows 11 24H2 / Server 2025 and later, and NTLM-blocking diagnostics.' } + # SMB server security and operational events (#72 follow-up). Microsoft's + # insecure-guest-logon page puts event 3023 in SMBServer/Security; the + # provider definition on Windows 11 build 26200 puts it in + # SMBServer/Operational. Both are collected, so it's kept either way. + @{ Name = 'Microsoft-Windows-SMBServer/Security'; TargetBytes = $mb128; MustEnable = $true; Tier = 'Core'; DefaultSize = '8 MB'; MayBeAbsent = $true + Categories = @('Remote access','Authentication') + Purpose = 'SMB server security events: session authentication failures (551), share and anonymous access denied (1006/1007/1009), weak session keys (1906), and insecure guest logons (3023, per Microsoft''s docs).' } + + @{ Name = 'Microsoft-Windows-SMBServer/Operational'; TargetBytes = $mb128; MustEnable = $true; Tier = 'Core'; DefaultSize = '8 MB'; MayBeAbsent = $true + Categories = @('Remote access','Authentication') + Purpose = 'SMB server operational events, including insecure guest logons (3023) where the provider writes them here (as current Windows 11 builds do) when the server-side guest-logon audit is on.' } @{ Name = 'Microsoft-Windows-Crypto-DPAPI/Debug'; TargetBytes = $mb128; MustEnable = $true; Tier = 'HighVolume'; DefaultSize = '1 MB'; MayBeAbsent = $true; Situational = $true Categories = @('Certificates and keys') Purpose = 'DPAPI key operations. Added by WELA v2.1 configure. A debug-class channel, so opt-in: enable only if DPAPI theft (e.g. Mimikatz backup key export) is a monitored scenario.' @@ -528,11 +539,15 @@ $script:BaselineSmbAuditSettings = @( Categories = @('Remote access','Network flow and sessions') Purpose = 'SMB client logs servers that cannot do SMB signing (event 31998 in SmbClient/Audit). Windows 11 24H2 / Server 2025 and later.' } - # Client side only: the server-side switch writes its event (3023) to - # SMBServer/Operational, a log the kit doesn't collect. @{ Id = 'AuditInsecureGuestLogon'; Side = 'Client'; Value = $true; Tier = 'Core'; Scope = 'All' Categories = @('Remote access','Authentication') Purpose = 'SMB client logs when a share logs it on as the Guest account, an unauthenticated insecure guest logon (event 31997 in SmbClient/Audit). Windows 11 24H2 / Server 2025 and later.' } + + # Same cmdlet setting on the server side, so it needs its own Id; Setting + # names the Set-SmbServerConfiguration parameter (defaults to Id). + @{ Id = 'ServerAuditInsecureGuestLogon'; Setting = 'AuditInsecureGuestLogon'; Side = 'Server'; Value = $true; Tier = 'Core'; Scope = 'All' + Categories = @('Remote access','Authentication') + Purpose = 'SMB server logs when a client is logged on as the Guest account, an unauthenticated insecure guest logon (event 3023, in SMBServer/Security or SMBServer/Operational depending on the build). Windows 11 24H2 / Server 2025 and later.' } ) # ----------------------------------------------------------------------------- diff --git a/docs/gpo-paths.md b/docs/gpo-paths.md index f83fd10..c829a6f 100644 --- a/docs/gpo-paths.md +++ b/docs/gpo-paths.md @@ -90,6 +90,7 @@ Things to know before you start: | AuditServerDoesNotSupportEncryption | SMB audit | Core | Administrative Templates > Network > Lanman Workstation > Audit server does not support encryption | Enabled | | AuditServerDoesNotSupportSigning | SMB audit | Core | Administrative Templates > Network > Lanman Workstation > Audit server does not support signing | Enabled | | AuditInsecureGuestLogon | SMB audit | Core | Administrative Templates > Network > Lanman Workstation > Audit insecure guest logon | Enabled | +| ServerAuditInsecureGuestLogon | SMB audit | Core | Administrative Templates > Network > Lanman Server > Audit insecure guest logon | Enabled | | Security | Log size | Core | Administrative Templates > Windows Components > Event Log Service > Security > Specify the maximum log file size (KB) | Enabled, 1048576 KB | | System | Log size | Core | Administrative Templates > Windows Components > Event Log Service > System > Specify the maximum log file size (KB) | Enabled, 131072 KB | | Application | Log size | Core | Administrative Templates > Windows Components > Event Log Service > Application > Specify the maximum log file size (KB) | Enabled, 131072 KB | @@ -127,5 +128,7 @@ Things to know before you start: | Microsoft-Windows-TaskScheduler/Operational | Log | No Group Policy template for this log's size or enablement. | | Microsoft-Windows-SMBServer/Audit | Log | No Group Policy template for this log's size. | | Microsoft-Windows-SmbClient/Audit | Log | No Group Policy template for this log's size. | +| Microsoft-Windows-SMBServer/Security | Log | No Group Policy template for this log's size or enablement. | +| Microsoft-Windows-SMBServer/Operational | Log | No Group Policy template for this log's size or enablement. | | Microsoft-Windows-Crypto-DPAPI/Debug | Log | No Group Policy template for this log's size or enablement. | | AdcsAuditFilter | Registry | No Group Policy template, and it needs a CertSvc restart: set it on the CA in a change window (`Enable-LoggingBaseline.ps1` there). | diff --git a/docs/intune-csp.md b/docs/intune-csp.md index 66add21..06162d6 100644 --- a/docs/intune-csp.md +++ b/docs/intune-csp.md @@ -86,6 +86,7 @@ Things to know before you start: | AuditServerDoesNotSupportEncryption | SMB audit | Core | `LanmanWorkstation/AuditServerDoesNotSupportEncryption` | 1 (Enabled) | [LanmanWorkstation](https://learn.microsoft.com/windows/client-management/mdm/policy-csp-lanmanworkstation) | | AuditServerDoesNotSupportSigning | SMB audit | Core | `LanmanWorkstation/AuditServerDoesNotSupportSigning` | 1 (Enabled) | [LanmanWorkstation](https://learn.microsoft.com/windows/client-management/mdm/policy-csp-lanmanworkstation) | | AuditInsecureGuestLogon | SMB audit | Core | `LanmanWorkstation/AuditInsecureGuestLogon` | 1 (Enabled) | [LanmanWorkstation](https://learn.microsoft.com/windows/client-management/mdm/policy-csp-lanmanworkstation) | +| ServerAuditInsecureGuestLogon | SMB audit | Core | `LanmanServer/AuditInsecureGuestLogon` | 1 (Enabled) | [LanmanServer](https://learn.microsoft.com/windows/client-management/mdm/policy-csp-lanmanserver) | | Security | Log size | Core | `EventLogService/SpecifyMaximumFileSizeSecurityLog` | Enabled, 1048576 KB | [EventLogService](https://learn.microsoft.com/windows/client-management/mdm/policy-csp-eventlogservice) | | System | Log size | Core | `EventLogService/SpecifyMaximumFileSizeSystemLog` | Enabled, 131072 KB | [EventLogService](https://learn.microsoft.com/windows/client-management/mdm/policy-csp-eventlogservice) | | Application | Log size | Core | `EventLogService/SpecifyMaximumFileSizeApplicationLog` | Enabled, 131072 KB | [EventLogService](https://learn.microsoft.com/windows/client-management/mdm/policy-csp-eventlogservice) | @@ -131,5 +132,7 @@ domain-joined hosts, see [Group Policy paths](gpo-paths.md)). | Microsoft-Windows-TaskScheduler/Operational | Log | No CSP for this log's size or enablement. | | Microsoft-Windows-SMBServer/Audit | Log | No CSP for this log's size. | | Microsoft-Windows-SmbClient/Audit | Log | No CSP for this log's size. | +| Microsoft-Windows-SMBServer/Security | Log | No CSP for this log's size or enablement. | +| Microsoft-Windows-SMBServer/Operational | Log | No CSP for this log's size or enablement. | | Microsoft-Windows-Crypto-DPAPI/Debug | Log | No CSP for this log's size or enablement. | | AdcsAuditFilter | Registry | No CSP, and it needs a CertSvc restart: set it on the CA in a change window (`Enable-LoggingBaseline.ps1` there). | diff --git a/docs/reference.md b/docs/reference.md index ec1666e..0142d83 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -57,6 +57,8 @@ Reading the columns: | Microsoft-Windows-TaskScheduler/Operational | Channel | - | 1 MB -> 128 MB | Low | Y | :material-check: | :material-check: | :material-check: | | Microsoft-Windows-SMBServer/Audit | Channel | 3021, 3022 | 8 MB -> 128 MB | Low | - | :material-check: | :material-check: | :material-check: | | Microsoft-Windows-SmbClient/Audit | Channel | 31998, 31999, 31997 | 8 MB -> 128 MB | Low | - | :material-check: | :material-check: | :material-check: | +| Microsoft-Windows-SMBServer/Security | Channel | 551, 1006, 1007, 1009, 1906, 3023 | 8 MB -> 128 MB | Low | - | :material-check: | :material-check: | :material-check: | +| Microsoft-Windows-SMBServer/Operational | Channel | 3023 | 8 MB -> 128 MB | Low | - | :material-check: | :material-check: | :material-check: | | Microsoft-Windows-Crypto-DPAPI/Debug | Channel | - | 1 MB -> 128 MB | Watch | - | - | - | - | | Credential Validation | Audit subcategory | 4776 | - | Low | C S Y | :material-check: | :material-check: | :material-check: | | Kerberos Authentication Service (DC) | Audit subcategory | 4768, 4771 | - | Low | Y | - | - | :material-check: | @@ -112,3 +114,4 @@ Reading the columns: | Client: AuditServerDoesNotSupportEncryption | SMB audit (24H2+) | 31999 | - | Low | - | :material-check: | :material-check: | :material-check: | | Client: AuditServerDoesNotSupportSigning | SMB audit (24H2+) | 31998 | - | Low | - | :material-check: | :material-check: | :material-check: | | Client: AuditInsecureGuestLogon | SMB audit (24H2+) | 31997 | - | Low | - | :material-check: | :material-check: | :material-check: | +| Server: AuditInsecureGuestLogon | SMB audit (24H2+) | 3023 | - | Low | - | :material-check: | :material-check: | :material-check: | diff --git a/docs/safety.md b/docs/safety.md index 45bc939..1e59fcc 100644 --- a/docs/safety.md +++ b/docs/safety.md @@ -154,7 +154,8 @@ categories PASS) and rollback. Both can audit which SMB peers cannot do signing or encryption (events 3021 signing / 3022 encryption server-side, 31998 signing / 31999 -encryption client-side) and when the SMB client logs on as Guest (31997); +encryption client-side) and insecure guest logons (31997 on the client, +3023 on the server); availability per Microsoft's [SMB feature descriptions](https://learn.microsoft.com/windows-server/storage/file-server/smb-feature-descriptions)). diff --git a/fleet/New-GpoPack.ps1 b/fleet/New-GpoPack.ps1 index b0b9731..a376a74 100644 --- a/fleet/New-GpoPack.ps1 +++ b/fleet/New-GpoPack.ps1 @@ -124,7 +124,7 @@ foreach ($rs in $script:BaselineRegistrySettings) { foreach ($sa in $script:BaselineSmbAuditSettings) { if (-not (Test-ItemSelected $sel 'SmbAudit' $sa.Id $sa.Tier)) { continue } $service = 'LanmanWorkstation'; if ($sa.Side -eq 'Server') { $service = 'LanmanServer' } - $regEntries.Add("Computer`r`nSOFTWARE\Policies\Microsoft\Windows\$service`r`n$($sa.Id)`r`nDWORD:$([int][bool]$sa.Value)") + $regEntries.Add("Computer`r`nSOFTWARE\Policies\Microsoft\Windows\$service`r`n$(Get-SmbSettingName $sa)`r`nDWORD:$([int][bool]$sa.Value)") $regCount++ } [System.IO.File]::WriteAllText((Join-Path $outDirFull 'registry.txt'), (($regEntries -join "`r`n`r`n") + "`r`n"), $utf8NoBom) diff --git a/presets/ASD.csv b/presets/ASD.csv index f08e351..9525bba 100644 --- a/presets/ASD.csv +++ b/presets/ASD.csv @@ -26,6 +26,8 @@ "Channel","Microsoft-Windows-TaskScheduler/Operational","Microsoft-Windows-TaskScheduler/Operational","Core","All","Y","N","","Task registration, updates and execution. DISABLED by default so must be enabled. Tasks are a top persistence mechanism.","Scheduled and automated tasks; Persistence" "Channel","Microsoft-Windows-SMBServer/Audit","Microsoft-Windows-SMBServer/Audit","Core","All","Y","N","","SMB server audit events, including signing/encryption capability auditing on Windows 11 24H2 / Server 2025 and later (3021/3022) - identifies clients that cannot do SMB signing or encryption before you enforce it.","Remote access; Network flow and sessions" "Channel","Microsoft-Windows-SmbClient/Audit","Microsoft-Windows-SmbClient/Audit","Core","All","Y","N","","SMB client audit events, including signing/encryption capability auditing (31998/31999) and insecure guest logons (31997) on Windows 11 24H2 / Server 2025 and later, and NTLM-blocking diagnostics.","Remote access; Network flow and sessions" +"Channel","Microsoft-Windows-SMBServer/Security","Microsoft-Windows-SMBServer/Security","Core","All","Y","N","","SMB server security events: session authentication failures (551), share and anonymous access denied (1006/1007/1009), weak session keys (1906), and insecure guest logons (3023, per Microsoft's docs).","Remote access; Authentication" +"Channel","Microsoft-Windows-SMBServer/Operational","Microsoft-Windows-SMBServer/Operational","Core","All","Y","N","","SMB server operational events, including insecure guest logons (3023) where the provider writes them here (as current Windows 11 builds do) when the server-side guest-logon audit is on.","Remote access; Authentication" "Channel","Microsoft-Windows-Crypto-DPAPI/Debug","Microsoft-Windows-Crypto-DPAPI/Debug","HighVolume","All","N","N","Debug-class channels carry a small constant tracing overhead and are not designed for always-on production use. Enable deliberately, not by default.","DPAPI key operations. Added by WELA v2.1 configure. A debug-class channel, so opt-in: enable only if DPAPI theft (e.g. Mimikatz backup key export) is a monitored scenario.","Certificates and keys" "AuditPolicy","0CCE923F-69AE-11D9-BED3-505054503030","Credential Validation","Core","All","Y","N","","NTLM authentication results (4776). Catches password spraying and username guessing over NTLM.","Authentication" "AuditPolicy","0CCE9242-69AE-11D9-BED3-505054503030","Kerberos Authentication Service","Core","DomainController","Y","N","","Kerberos TGT requests (4768) and pre-auth failures (4771). Only generated on domain controllers.","Authentication; Directory and identity store" @@ -80,4 +82,5 @@ "SmbAudit","AuditServerDoesNotSupportEncryption","Client: AuditServerDoesNotSupportEncryption = True","Core","All","Y","N","No effect before Windows 11 24H2 / Windows Server 2025 (reported NOT APPLICABLE there). Audit-only; nothing is blocked.","SMB client logs servers that cannot do SMB encryption (event 31999 in SmbClient/Audit). Windows 11 24H2 / Server 2025 and later.","Remote access; Network flow and sessions" "SmbAudit","AuditServerDoesNotSupportSigning","Client: AuditServerDoesNotSupportSigning = True","Core","All","Y","N","No effect before Windows 11 24H2 / Windows Server 2025 (reported NOT APPLICABLE there). Audit-only; nothing is blocked.","SMB client logs servers that cannot do SMB signing (event 31998 in SmbClient/Audit). Windows 11 24H2 / Server 2025 and later.","Remote access; Network flow and sessions" "SmbAudit","AuditInsecureGuestLogon","Client: AuditInsecureGuestLogon = True","Core","All","Y","N","No effect before Windows 11 24H2 / Windows Server 2025 (reported NOT APPLICABLE there). Audit-only; nothing is blocked.","SMB client logs when a share logs it on as the Guest account, an unauthenticated insecure guest logon (event 31997 in SmbClient/Audit). Windows 11 24H2 / Server 2025 and later.","Remote access; Authentication" +"SmbAudit","ServerAuditInsecureGuestLogon","Server: AuditInsecureGuestLogon = True","Core","All","Y","N","No effect before Windows 11 24H2 / Windows Server 2025 (reported NOT APPLICABLE there). Audit-only; nothing is blocked.","SMB server logs when a client is logged on as the Guest account, an unauthenticated insecure guest logon (event 3023, in SMBServer/Security or SMBServer/Operational depending on the build). Windows 11 24H2 / Server 2025 and later.","Remote access; Authentication" "Registry","AdcsAuditFilter","AD CS AuditFilter = 127 (only applies when Certificate Services is installed; needs CertSvc restart)","Core","All","Y","N","Takes effect only after a CertSvc service restart, which the kit never performs itself - plan a change window.","Turns on all seven AD CS audit event groups (127 = full bitmask) so certificate issuance, template changes and CA configuration changes are logged (4886-4899). REQUIRES a CertSvc service restart to take effect.","Certificates and keys" diff --git a/presets/DomainController.csv b/presets/DomainController.csv index 1d3535b..76b6efd 100644 --- a/presets/DomainController.csv +++ b/presets/DomainController.csv @@ -26,6 +26,8 @@ "Channel","Microsoft-Windows-TaskScheduler/Operational","Microsoft-Windows-TaskScheduler/Operational","Core","All","Y","Y","","Task registration, updates and execution. DISABLED by default so must be enabled. Tasks are a top persistence mechanism.","Scheduled and automated tasks; Persistence" "Channel","Microsoft-Windows-SMBServer/Audit","Microsoft-Windows-SMBServer/Audit","Core","All","Y","Y","","SMB server audit events, including signing/encryption capability auditing on Windows 11 24H2 / Server 2025 and later (3021/3022) - identifies clients that cannot do SMB signing or encryption before you enforce it.","Remote access; Network flow and sessions" "Channel","Microsoft-Windows-SmbClient/Audit","Microsoft-Windows-SmbClient/Audit","Core","All","Y","Y","","SMB client audit events, including signing/encryption capability auditing (31998/31999) and insecure guest logons (31997) on Windows 11 24H2 / Server 2025 and later, and NTLM-blocking diagnostics.","Remote access; Network flow and sessions" +"Channel","Microsoft-Windows-SMBServer/Security","Microsoft-Windows-SMBServer/Security","Core","All","Y","Y","","SMB server security events: session authentication failures (551), share and anonymous access denied (1006/1007/1009), weak session keys (1906), and insecure guest logons (3023, per Microsoft's docs).","Remote access; Authentication" +"Channel","Microsoft-Windows-SMBServer/Operational","Microsoft-Windows-SMBServer/Operational","Core","All","Y","Y","","SMB server operational events, including insecure guest logons (3023) where the provider writes them here (as current Windows 11 builds do) when the server-side guest-logon audit is on.","Remote access; Authentication" "Channel","Microsoft-Windows-Crypto-DPAPI/Debug","Microsoft-Windows-Crypto-DPAPI/Debug","HighVolume","All","N","N","Debug-class channels carry a small constant tracing overhead and are not designed for always-on production use. Enable deliberately, not by default.","DPAPI key operations. Added by WELA v2.1 configure. A debug-class channel, so opt-in: enable only if DPAPI theft (e.g. Mimikatz backup key export) is a monitored scenario.","Certificates and keys" "AuditPolicy","0CCE923F-69AE-11D9-BED3-505054503030","Credential Validation","Core","All","Y","Y","","NTLM authentication results (4776). Catches password spraying and username guessing over NTLM.","Authentication" "AuditPolicy","0CCE9242-69AE-11D9-BED3-505054503030","Kerberos Authentication Service","Core","DomainController","Y","Y","","Kerberos TGT requests (4768) and pre-auth failures (4771). Only generated on domain controllers.","Authentication; Directory and identity store" @@ -80,4 +82,5 @@ "SmbAudit","AuditServerDoesNotSupportEncryption","Client: AuditServerDoesNotSupportEncryption = True","Core","All","Y","Y","No effect before Windows 11 24H2 / Windows Server 2025 (reported NOT APPLICABLE there). Audit-only; nothing is blocked.","SMB client logs servers that cannot do SMB encryption (event 31999 in SmbClient/Audit). Windows 11 24H2 / Server 2025 and later.","Remote access; Network flow and sessions" "SmbAudit","AuditServerDoesNotSupportSigning","Client: AuditServerDoesNotSupportSigning = True","Core","All","Y","Y","No effect before Windows 11 24H2 / Windows Server 2025 (reported NOT APPLICABLE there). Audit-only; nothing is blocked.","SMB client logs servers that cannot do SMB signing (event 31998 in SmbClient/Audit). Windows 11 24H2 / Server 2025 and later.","Remote access; Network flow and sessions" "SmbAudit","AuditInsecureGuestLogon","Client: AuditInsecureGuestLogon = True","Core","All","Y","Y","No effect before Windows 11 24H2 / Windows Server 2025 (reported NOT APPLICABLE there). Audit-only; nothing is blocked.","SMB client logs when a share logs it on as the Guest account, an unauthenticated insecure guest logon (event 31997 in SmbClient/Audit). Windows 11 24H2 / Server 2025 and later.","Remote access; Authentication" +"SmbAudit","ServerAuditInsecureGuestLogon","Server: AuditInsecureGuestLogon = True","Core","All","Y","Y","No effect before Windows 11 24H2 / Windows Server 2025 (reported NOT APPLICABLE there). Audit-only; nothing is blocked.","SMB server logs when a client is logged on as the Guest account, an unauthenticated insecure guest logon (event 3023, in SMBServer/Security or SMBServer/Operational depending on the build). Windows 11 24H2 / Server 2025 and later.","Remote access; Authentication" "Registry","AdcsAuditFilter","AD CS AuditFilter = 127 (only applies when Certificate Services is installed; needs CertSvc restart)","Core","All","Y","Y","Takes effect only after a CertSvc service restart, which the kit never performs itself - plan a change window.","Turns on all seven AD CS audit event groups (127 = full bitmask) so certificate issuance, template changes and CA configuration changes are logged (4886-4899). REQUIRES a CertSvc service restart to take effect.","Certificates and keys" diff --git a/presets/MemberServer.csv b/presets/MemberServer.csv index 75e5a0e..ee89c16 100644 --- a/presets/MemberServer.csv +++ b/presets/MemberServer.csv @@ -26,6 +26,8 @@ "Channel","Microsoft-Windows-TaskScheduler/Operational","Microsoft-Windows-TaskScheduler/Operational","Core","All","Y","Y","","Task registration, updates and execution. DISABLED by default so must be enabled. Tasks are a top persistence mechanism.","Scheduled and automated tasks; Persistence" "Channel","Microsoft-Windows-SMBServer/Audit","Microsoft-Windows-SMBServer/Audit","Core","All","Y","Y","","SMB server audit events, including signing/encryption capability auditing on Windows 11 24H2 / Server 2025 and later (3021/3022) - identifies clients that cannot do SMB signing or encryption before you enforce it.","Remote access; Network flow and sessions" "Channel","Microsoft-Windows-SmbClient/Audit","Microsoft-Windows-SmbClient/Audit","Core","All","Y","Y","","SMB client audit events, including signing/encryption capability auditing (31998/31999) and insecure guest logons (31997) on Windows 11 24H2 / Server 2025 and later, and NTLM-blocking diagnostics.","Remote access; Network flow and sessions" +"Channel","Microsoft-Windows-SMBServer/Security","Microsoft-Windows-SMBServer/Security","Core","All","Y","Y","","SMB server security events: session authentication failures (551), share and anonymous access denied (1006/1007/1009), weak session keys (1906), and insecure guest logons (3023, per Microsoft's docs).","Remote access; Authentication" +"Channel","Microsoft-Windows-SMBServer/Operational","Microsoft-Windows-SMBServer/Operational","Core","All","Y","Y","","SMB server operational events, including insecure guest logons (3023) where the provider writes them here (as current Windows 11 builds do) when the server-side guest-logon audit is on.","Remote access; Authentication" "Channel","Microsoft-Windows-Crypto-DPAPI/Debug","Microsoft-Windows-Crypto-DPAPI/Debug","HighVolume","All","N","N","Debug-class channels carry a small constant tracing overhead and are not designed for always-on production use. Enable deliberately, not by default.","DPAPI key operations. Added by WELA v2.1 configure. A debug-class channel, so opt-in: enable only if DPAPI theft (e.g. Mimikatz backup key export) is a monitored scenario.","Certificates and keys" "AuditPolicy","0CCE923F-69AE-11D9-BED3-505054503030","Credential Validation","Core","All","Y","Y","","NTLM authentication results (4776). Catches password spraying and username guessing over NTLM.","Authentication" "AuditPolicy","0CCE9242-69AE-11D9-BED3-505054503030","Kerberos Authentication Service","Core","DomainController","Y","N","","Kerberos TGT requests (4768) and pre-auth failures (4771). Only generated on domain controllers.","Authentication; Directory and identity store" @@ -80,4 +82,5 @@ "SmbAudit","AuditServerDoesNotSupportEncryption","Client: AuditServerDoesNotSupportEncryption = True","Core","All","Y","Y","No effect before Windows 11 24H2 / Windows Server 2025 (reported NOT APPLICABLE there). Audit-only; nothing is blocked.","SMB client logs servers that cannot do SMB encryption (event 31999 in SmbClient/Audit). Windows 11 24H2 / Server 2025 and later.","Remote access; Network flow and sessions" "SmbAudit","AuditServerDoesNotSupportSigning","Client: AuditServerDoesNotSupportSigning = True","Core","All","Y","Y","No effect before Windows 11 24H2 / Windows Server 2025 (reported NOT APPLICABLE there). Audit-only; nothing is blocked.","SMB client logs servers that cannot do SMB signing (event 31998 in SmbClient/Audit). Windows 11 24H2 / Server 2025 and later.","Remote access; Network flow and sessions" "SmbAudit","AuditInsecureGuestLogon","Client: AuditInsecureGuestLogon = True","Core","All","Y","Y","No effect before Windows 11 24H2 / Windows Server 2025 (reported NOT APPLICABLE there). Audit-only; nothing is blocked.","SMB client logs when a share logs it on as the Guest account, an unauthenticated insecure guest logon (event 31997 in SmbClient/Audit). Windows 11 24H2 / Server 2025 and later.","Remote access; Authentication" +"SmbAudit","ServerAuditInsecureGuestLogon","Server: AuditInsecureGuestLogon = True","Core","All","Y","Y","No effect before Windows 11 24H2 / Windows Server 2025 (reported NOT APPLICABLE there). Audit-only; nothing is blocked.","SMB server logs when a client is logged on as the Guest account, an unauthenticated insecure guest logon (event 3023, in SMBServer/Security or SMBServer/Operational depending on the build). Windows 11 24H2 / Server 2025 and later.","Remote access; Authentication" "Registry","AdcsAuditFilter","AD CS AuditFilter = 127 (only applies when Certificate Services is installed; needs CertSvc restart)","Core","All","Y","Y","Takes effect only after a CertSvc service restart, which the kit never performs itself - plan a change window.","Turns on all seven AD CS audit event groups (127 = full bitmask) so certificate issuance, template changes and CA configuration changes are logged (4886-4899). REQUIRES a CertSvc service restart to take effect.","Certificates and keys" diff --git a/presets/Workstation.csv b/presets/Workstation.csv index b7767aa..efa122f 100644 --- a/presets/Workstation.csv +++ b/presets/Workstation.csv @@ -26,6 +26,8 @@ "Channel","Microsoft-Windows-TaskScheduler/Operational","Microsoft-Windows-TaskScheduler/Operational","Core","All","Y","Y","","Task registration, updates and execution. DISABLED by default so must be enabled. Tasks are a top persistence mechanism.","Scheduled and automated tasks; Persistence" "Channel","Microsoft-Windows-SMBServer/Audit","Microsoft-Windows-SMBServer/Audit","Core","All","Y","Y","","SMB server audit events, including signing/encryption capability auditing on Windows 11 24H2 / Server 2025 and later (3021/3022) - identifies clients that cannot do SMB signing or encryption before you enforce it.","Remote access; Network flow and sessions" "Channel","Microsoft-Windows-SmbClient/Audit","Microsoft-Windows-SmbClient/Audit","Core","All","Y","Y","","SMB client audit events, including signing/encryption capability auditing (31998/31999) and insecure guest logons (31997) on Windows 11 24H2 / Server 2025 and later, and NTLM-blocking diagnostics.","Remote access; Network flow and sessions" +"Channel","Microsoft-Windows-SMBServer/Security","Microsoft-Windows-SMBServer/Security","Core","All","Y","Y","","SMB server security events: session authentication failures (551), share and anonymous access denied (1006/1007/1009), weak session keys (1906), and insecure guest logons (3023, per Microsoft's docs).","Remote access; Authentication" +"Channel","Microsoft-Windows-SMBServer/Operational","Microsoft-Windows-SMBServer/Operational","Core","All","Y","Y","","SMB server operational events, including insecure guest logons (3023) where the provider writes them here (as current Windows 11 builds do) when the server-side guest-logon audit is on.","Remote access; Authentication" "Channel","Microsoft-Windows-Crypto-DPAPI/Debug","Microsoft-Windows-Crypto-DPAPI/Debug","HighVolume","All","N","N","Debug-class channels carry a small constant tracing overhead and are not designed for always-on production use. Enable deliberately, not by default.","DPAPI key operations. Added by WELA v2.1 configure. A debug-class channel, so opt-in: enable only if DPAPI theft (e.g. Mimikatz backup key export) is a monitored scenario.","Certificates and keys" "AuditPolicy","0CCE923F-69AE-11D9-BED3-505054503030","Credential Validation","Core","All","Y","Y","","NTLM authentication results (4776). Catches password spraying and username guessing over NTLM.","Authentication" "AuditPolicy","0CCE9242-69AE-11D9-BED3-505054503030","Kerberos Authentication Service","Core","DomainController","Y","N","","Kerberos TGT requests (4768) and pre-auth failures (4771). Only generated on domain controllers.","Authentication; Directory and identity store" @@ -80,4 +82,5 @@ "SmbAudit","AuditServerDoesNotSupportEncryption","Client: AuditServerDoesNotSupportEncryption = True","Core","All","Y","Y","No effect before Windows 11 24H2 / Windows Server 2025 (reported NOT APPLICABLE there). Audit-only; nothing is blocked.","SMB client logs servers that cannot do SMB encryption (event 31999 in SmbClient/Audit). Windows 11 24H2 / Server 2025 and later.","Remote access; Network flow and sessions" "SmbAudit","AuditServerDoesNotSupportSigning","Client: AuditServerDoesNotSupportSigning = True","Core","All","Y","Y","No effect before Windows 11 24H2 / Windows Server 2025 (reported NOT APPLICABLE there). Audit-only; nothing is blocked.","SMB client logs servers that cannot do SMB signing (event 31998 in SmbClient/Audit). Windows 11 24H2 / Server 2025 and later.","Remote access; Network flow and sessions" "SmbAudit","AuditInsecureGuestLogon","Client: AuditInsecureGuestLogon = True","Core","All","Y","Y","No effect before Windows 11 24H2 / Windows Server 2025 (reported NOT APPLICABLE there). Audit-only; nothing is blocked.","SMB client logs when a share logs it on as the Guest account, an unauthenticated insecure guest logon (event 31997 in SmbClient/Audit). Windows 11 24H2 / Server 2025 and later.","Remote access; Authentication" +"SmbAudit","ServerAuditInsecureGuestLogon","Server: AuditInsecureGuestLogon = True","Core","All","Y","Y","No effect before Windows 11 24H2 / Windows Server 2025 (reported NOT APPLICABLE there). Audit-only; nothing is blocked.","SMB server logs when a client is logged on as the Guest account, an unauthenticated insecure guest logon (event 3023, in SMBServer/Security or SMBServer/Operational depending on the build). Windows 11 24H2 / Server 2025 and later.","Remote access; Authentication" "Registry","AdcsAuditFilter","AD CS AuditFilter = 127 (only applies when Certificate Services is installed; needs CertSvc restart)","Core","All","Y","Y","Takes effect only after a CertSvc service restart, which the kit never performs itself - plan a change window.","Turns on all seven AD CS audit event groups (127 = full bitmask) so certificate issuance, template changes and CA configuration changes are logged (4886-4899). REQUIRES a CertSvc service restart to take effect.","Certificates and keys" diff --git a/tests/Kit.Tests.ps1 b/tests/Kit.Tests.ps1 index 6c7bca0..0d26c7e 100644 --- a/tests/Kit.Tests.ps1 +++ b/tests/Kit.Tests.ps1 @@ -406,6 +406,23 @@ Describe 'AppLocker readiness note' { $src | Should -Match "Get-Command Get-AppLockerPolicy -ErrorAction SilentlyContinue" } } +# The same SMB setting exists on client and server: Ids stay unique and +# Setting names the cmdlet property. +Describe 'SMB audit items' { + It 'has unique Ids and one item per side and setting' { + $ids = @($BaselineSmbAuditSettings | ForEach-Object { $_.Id }) + @($ids | Sort-Object -Unique).Count | Should -Be $ids.Count + $pairs = @($BaselineSmbAuditSettings | ForEach-Object { "$($_.Side)|$(Get-SmbSettingName $_)" }) + @($pairs | Sort-Object -Unique).Count | Should -Be $pairs.Count + } + + It 'maps an item to its Setting, else its Id, for table entries and rollback records alike' { + Get-SmbSettingName @{ Id = 'ServerAuditInsecureGuestLogon'; Setting = 'AuditInsecureGuestLogon' } | Should -Be 'AuditInsecureGuestLogon' + Get-SmbSettingName @{ Id = 'AuditServerDoesNotSupportSigning' } | Should -Be 'AuditServerDoesNotSupportSigning' + Get-SmbSettingName ([pscustomobject]@{ Id = 'X'; Setting = 'Y' }) | Should -Be 'Y' + Get-SmbSettingName ([pscustomobject]@{ Id = 'X' }) | Should -Be 'X' + } +} Describe 'Rollback baseline' { BeforeAll { $enableAst = [System.Management.Automation.Language.Parser]::ParseFile((Join-Path $KitRoot 'Enable-LoggingBaseline.ps1'), [ref]$null, [ref]$null) diff --git a/tools/Export-ReferenceTable.ps1 b/tools/Export-ReferenceTable.ps1 index cb4623d..3464411 100644 --- a/tools/Export-ReferenceTable.ps1 +++ b/tools/Export-ReferenceTable.ps1 @@ -72,7 +72,7 @@ function Get-PurposeEventText { } # Kit-added items that Yamato's own scripts do not contain: the SMB -# auditing (all SmbAudit rows plus its two channels), the NTLM audit +# auditing (all SmbAudit rows plus its four channels), the NTLM audit # registry values, the PowerShell 7 policy fallbacks (#44) and the forced # subcategory audit setting (#71). They must not # carry the Y letter. Situational items (the old Optional tier: IPsec Driver, @@ -80,7 +80,7 @@ function Get-PurposeEventText { # whatever their tier. $yExcludedIds = @('NtlmOutboundAudit', 'NtlmInboundAudit', 'NtlmDomainAudit', 'PS7ScriptBlock64', 'PS7ScriptBlock32', 'PS7ModuleLogging64', 'PS7ModuleLogging32', 'ForceSubcategoryAudit') -$yExcludedChannels = @('Microsoft-Windows-SMBServer/Audit', 'Microsoft-Windows-SmbClient/Audit') +$yExcludedChannels = @('Microsoft-Windows-SMBServer/Audit', 'Microsoft-Windows-SmbClient/Audit', 'Microsoft-Windows-SMBServer/Security', 'Microsoft-Windows-SMBServer/Operational') function Test-Situational { param([hashtable]$Item) return ($Item.ContainsKey('Situational') -and $Item.Situational) @@ -164,7 +164,7 @@ foreach ($rs in $script:BaselineRegistrySettings) { $af = $script:BaselineAdcsAuditFilter $rows.Add("| AD CS AuditFilter (needs CertSvc restart) | Registry | $((Get-PurposeEventText $af.Purpose) -join ', ') | - | $(Format-Volume $af) | $(Format-RefText 'Registry' $af.Id $af.Tier) | $(Format-RoleColumn 'Registry' $af.Id) |") foreach ($sa in $script:BaselineSmbAuditSettings) { - $rows.Add("| $($sa.Side): $($sa.Id) | SMB audit (24H2+) | $((Get-PurposeEventText $sa.Purpose) -join ', ') | - | Low | $(Format-RefText 'SmbAudit' $sa.Id $sa.Tier) | $(Format-RoleColumn 'SmbAudit' $sa.Id) |") + $rows.Add("| $($sa.Side): $(Get-SmbSettingName $sa) | SMB audit (24H2+) | $((Get-PurposeEventText $sa.Purpose) -join ', ') | - | Low | $(Format-RefText 'SmbAudit' $sa.Id $sa.Tier) | $(Format-RoleColumn 'SmbAudit' $sa.Id) |") } # ---- write the page --------------------------------------------------------- diff --git a/tools/policy-map.psd1 b/tools/policy-map.psd1 index 344a214..7cf4a7c 100644 --- a/tools/policy-map.psd1 +++ b/tools/policy-map.psd1 @@ -105,6 +105,7 @@ AuditClientDoesNotSupportSigning = @{ Csp = 'LanmanServer/AuditClientDoesNotSupportSigning'; Doc = 'policy-csp-lanmanserver'; Gp = 'Administrative Templates > Network > Lanman Server > Audit client does not support signing' } AuditServerDoesNotSupportEncryption = @{ Csp = 'LanmanWorkstation/AuditServerDoesNotSupportEncryption'; Doc = 'policy-csp-lanmanworkstation'; Gp = 'Administrative Templates > Network > Lanman Workstation > Audit server does not support encryption' } AuditInsecureGuestLogon = @{ Csp = 'LanmanWorkstation/AuditInsecureGuestLogon'; Doc = 'policy-csp-lanmanworkstation'; Gp = 'Administrative Templates > Network > Lanman Workstation > Audit insecure guest logon' } + ServerAuditInsecureGuestLogon = @{ Csp = 'LanmanServer/AuditInsecureGuestLogon'; Doc = 'policy-csp-lanmanserver'; Gp = 'Administrative Templates > Network > Lanman Server > Audit insecure guest logon' } AuditServerDoesNotSupportSigning = @{ Csp = 'LanmanWorkstation/AuditServerDoesNotSupportSigning'; Doc = 'policy-csp-lanmanworkstation'; Gp = 'Administrative Templates > Network > Lanman Workstation > Audit server does not support signing' } }