fix: harden Windows Server 2022 against Sweet32 (CVE-2016-2183) - #9077
Conversation
…2183) Base WS2022 (ltsc2022, build 20348) still enables TLS_RSA_WITH_3DES_EDE_CBC_SHA by default per Microsoft docs, making it vulnerable to the Sweet32 birthday attack. Extend the BasePrep Enable-SecureTls call to run on ltsc2022 in addition to 1809. WS2022 23H2+ and WS2025+ already exclude 3DES by default and are left untouched. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reorder to positive-match branch first (enable on 1809/ltsc2022) with skip as the else, removing the -ne/-and negation for readability. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add ValidateWindowsSecureTLSEnabled to confirm TLS 1.2 is enabled, TLS 1.0/1.1 are disabled, RC4 is disabled, and the cipher suite order excludes 3DES/RC2/DES (Sweet32/CVE-2016-2183). Wire it into the Windows 2022 gen1/gen2 Azure Network scenarios, which exercise the Enable-SecureTls path added for ltsc2022. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Windows Unit Test Results 3 files 12 suites 44s ⏱️ Results for commit 311ade4. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Pull request overview
Hardens Windows Server 2022 nodes against Sweet32 (CVE-2016-2183) by enabling the existing Enable-SecureTls hardening on ltsc2022 during Windows CSE BasePrep, and adds e2e validation to ensure the intended TLS/SChannel registry configuration is actually applied.
Changes:
- Run
Enable-SecureTlsduringBasePrepon Windowsltsc2022(in addition to1809). - Add an e2e validator to verify TLS hardening state (protocol enablement/disablement, cipher suite order).
- Wire the new validator into the Windows Server 2022 gen1/gen2 Azure Network e2e scenarios.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| parts/windows/kuberneteswindowssetup.ps1 | Expands secure TLS hardening execution to include ltsc2022 during BasePrep. |
| e2e/validators.go | Adds ValidateWindowsSecureTLSEnabled to check TLS/SChannel hardening settings on the VM. |
| e2e/scenario_win_test.go | Hooks the new TLS validator into Windows Server 2022 scenarios. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
parts/windows/kuberneteswindowssetup.ps1:452
Enable-SecureTlsis now executed onltsc2022, but the bundledwindowssecuretls.ps1doesn’t reliably disable RC4:DisableRC4only creates/sets the RC4 cipher subkeys whenSCHANNEL\Ciphershas zero subkeys. If theCipherskey is non-empty on Windows Server 2022, RC4 may remain enabled (and the new e2e validator may also fail by missing the RC4 keys). Consider fixingDisableRC4to always create/set the fourRC4 */128subkeys toEnabled=0regardless of other cipher entries, so the hardening guarantee holds on WS2022.
if ($windowsVersion -eq "1809" -or $windowsVersion -eq "ltsc2022") {
Logs-To-Event -TaskName "AKS.WindowsCSE.EnableSecureTLS" -TaskMessage "Start to enable secure TLS protocols"
try {
. C:\k\windowssecuretls.ps1
Enable-SecureTls
e2e/validators.go:1497
- The RC4 registry reads use
$ErrorActionPreference = 'Stop'andGet-ItemProperty -Name Enabledwithout-ErrorAction SilentlyContinue. If any of these RC4 keys/values are absent, the PowerShell script exits non-zero before emitting JSON, and the validator fails with an exit-code mismatch instead of a targeted assertion failure. Defaulting missing values to a failing sentinel (e.g., 1) makes the test failure clearer and avoids brittle dependency on key presence.
"$rc4_128 = (Get-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\SecurityProviders\\SCHANNEL\\Ciphers\\RC4 128/128' -Name Enabled).Enabled",
"$rc4_64 = (Get-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\SecurityProviders\\SCHANNEL\\Ciphers\\RC4 64/128' -Name Enabled).Enabled",
"$rc4_56 = (Get-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\SecurityProviders\\SCHANNEL\\Ciphers\\RC4 56/128' -Name Enabled).Enabled",
"$rc4_40 = (Get-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\SecurityProviders\\SCHANNEL\\Ciphers\\RC4 40/128' -Name Enabled).Enabled",
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🔒 - Generated by Copilot Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
♻️ - Generated by Copilot Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
parts/windows/kuberneteswindowssetup.ps1:459
- Enable-SecureTls is invoked in BasePrep, but BasePrep is skipped when
C:\AzureData\base_prep.completeis present (PIS / VHD-cached nodes). That means Windows Server 2022 nodes created from existing cached VHDs in the 6‑month support window will not receive this Sweet32 hardening at provision time, even if they pick up the updated CSE script. Consider also applying the hardening during NodePrep when BasePrep is skipped, or explicitly confirm that all affected WS2022 VHDs will be republished so the hardening is baked in.
$windowsVersion = Get-WindowsVersion
if ($windowsVersion -eq "1809" -or $windowsVersion -eq "ltsc2022") {
Logs-To-Event -TaskName "AKS.WindowsCSE.EnableSecureTLS" -TaskMessage "Start to enable secure TLS protocols"
try {
. C:\k\windowssecuretls.ps1
Enable-SecureTls
}
catch {
Set-ExitCode -ExitCode $global:WINDOWS_CSE_ERROR_ENABLE_SECURE_TLS -ErrorMessage $_
}
} else {
Logs-To-Event -TaskName "AKS.WindowsCSE.EnableSecureTLS" -TaskMessage "Skip secure TLS protocols for Windows version: $windowsVersion"
}
Summary
Windows Server 2022 (
ltsc2022, build 20348) enablesTLS_RSA_WITH_3DES_EDE_CBC_SHAby default, making it vulnerable to the Sweet32 birthday attack (CVE-2016-2183 / CVE-2016-6329). WS2022 23H2+ and WS2025+ already exclude 3DES by default and are unaffected.Changes
parts/windows/kuberneteswindowssetup.ps1:BasePrepnow runsEnable-SecureTls(windowssecuretls.ps1) onltsc2022in addition to1809. This locks the cipher suite order to AES-only ciphers, disables RC4, and disables SSLv2/SSLv3/TLS1.0/1.1 in favor of TLS 1.2. Runs inbasePrepsince this hardening is static/non-secret and valid for every node.e2e/validators.go: addedValidateWindowsSecureTLSEnabledto confirm TLS 1.2 is enabled, TLS 1.0/1.1 are disabled, RC4 is disabled, and the cipher suite order excludes 3DES/RC2/DES.e2e/scenario_win_test.go: wired the new validator intoTest_Windows2022_AzureNetwork(gen1) andTest_Windows2022Gen2AzureNetwork(gen2).Testing
go build ./...andgo vet ./...pass in thee2emodule.make generateproduced no snapshot diffs for this change.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com