Windows Server guidance to protect against speculative execution side-channel vulnerabilities

Applies to: Windows Server 2016 Version 1709Windows Server 2012 R2 StandardWindows Server 2012 Standard More

Summary


Microsoft is aware of a new publicly disclosed class of vulnerabilities that are called “speculative execution side-channel attacks” and that affect many modern processors including Intel, AMD, and ARM.

Note This issue also affects other operating systems, such as Android, Chrome, iOS, and macOS. Therefore, we advise customers to seek guidance from those vendors.

Microsoft has released several updates to help mitigate these vulnerabilities. We have also taken action to secure our cloud services. See the following sections for more details.

Microsoft has not yet received any information to indicate that these vulnerabilities have been used to attack customers. Microsoft is working closely with industry partners including chip makers, hardware OEMs, and app vendors to protect customers. To get all available protections, firmware (microcode) and software updates are required. This includes microcode from device OEMs and, in some cases, updates to antivirus software.

This article addresses the following vulnerabilities:

To learn more about this class of vulnerabilities, see ADV180002 and ADV180012.

Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.

Recommended actions


Customers should take the following actions to help protect against these vulnerabilities:

  1. Apply all available Windows operating system updates, including the monthly Windows security updates. For details about how to enable these updates, see Microsoft Knowledge Base article 4072699.
  2. Apply applicable firmware (microcode) updates from the device manufacturer (OEM).
  3. Evaluate the risk to your environment based on the information that's in Microsoft Security Advisories ADV180002 and ADV180012 and in this Knowledge Base article.
  4. Take action as required by using the advisories and registry key information that is provided in this Knowledge Base article.

Enabling protections on Windows Server


The mitigations for CVE-2017-5753 are enabled by default on Windows Server, and there's no administrator option available to disable them. Mitigations for the other three vulnerabilities that are described in this article are disabled by default. Customers who want to obtain all available protections against these vulnerabilities must make registry key changes to enable these mitigations.

Enabling these mitigations may affect performance. The scale of the performance effects depends on multiple factors, such as the specific chipset in your physical host and the workloads that are running. We recommend that customers assess the performance effects for their environment and make any necessary adjustments.

Your server is at increased risk if it's in one of the following categories:

  • Hyper-V hosts – Requires protection for VM-to-VM and VM-to-host attacks.
  • Remote Desktop Services Hosts (RDSH) – Requires protection from one session to another session or from session-to-host attacks.
  • Physical hosts or virtual machines that are running untrusted code, such as containers or untrusted extensions for database, untrusted web content, or workloads that run code that's from external sources. These require protection from untrusted process-to-another-process or untrusted-process-to-kernel attacks.

Use the following registry key settings to enable the mitigations on the server, and restart the system for the changes to take effect.

Enable mitigations for CVE-2017-5715 (Spectre Variant 2) and CVE-2017-5754 (Meltdown)


Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:

322756 How to back up and restore the registry in Windows

To enable mitigations for CVE-2017-5715 (Spectre Variant 2) and CVE-2017-5754 (Meltdown)

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverride /t REG_DWORD /d 0 /f

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverrideMask /t REG_DWORD /d 3 /f

reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization" /v MinVmVersionForCpuBasedMitigations /t REG_SZ /d "1.0" /f

If this is a Hyper-V host and the firmware updates have been applied: Fully shut down all Virtual Machines. This enables the firmware-related mitigation to be applied on the host before the VMs are started. Therefore, the VMs are also updated when they're restarted.

Restart the server for changes to take effect.

To disable mitigations for CVE-2017-5715 (Spectre Variant 2) and CVE-2017-5754 (Meltdown)

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverride /t REG_DWORD /d 3 /f

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverrideMask /t REG_DWORD /d 3 /f

Restart the server for the changes to take effect.

(You do not have to change MinVmVersionForCpuBasedMitigations.)


Notes

Disable mitigation for CVE-2017-5715 (Spectre Variant 2)


While Intel tests, updates, and deploys new microcode, we are offering a new option for advanced users on affected devices to manually disable and enable the mitigation against Spectre Variant 2 (CVE-2017-5715 – "Branch Target Injection") independently through registry setting changes.

If you installed the microcode but you want to disable the CVE-2017-5715 mitigation because of unexpected restarts or system stability issues, use the following instructions.

To disable Variant 2: (CVE-2017-5715 – "Branch Target Injection") mitigation:

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverride /t REG_DWORD /d 1 /f

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverrideMask /t REG_DWORD /d 3 /f

To enable Variant 2: (CVE-2017-5715 – "Branch Target Injection") mitigation:

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverride /t REG_DWORD /d 0 /f

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverrideMask /t REG_DWORD /d 3 /f

reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization" /v MinVmVersionForCpuBasedMitigations /t REG_SZ /d "1.0" /f


Note
 Disabling and enabling the Variant 2 mitigation through registry setting changes requires administrative rights and a restart.

Enable Indirect Branch Prediction Barrier (IBPB) for Spectre Variant 2 on AMD processors (CPUs)


Some AMD processors (CPUs) offer an indirect branch control feature to mitigate indirect branch target injections through an Indirect Branch Prediction Barrier (IBPB) mechanism. (For more information, see FAQ #15 in ADV180002 and AMD Architecture Guidelines around Indirect Branch Control and AMD Security Updates.)

Follow these instructions to control IBPB when switching from user context to kernel context:

To enable using Indirect Branch Prediction Barrier (IBPB) when you switch from user context to kernel context:

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverride /t REG_DWORD /d 64 /f

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverrideMask /t REG_DWORD /d 3 /f


Note
 Enabling by using Indirect Branch Prediction Barrier (IBPB) through registry setting changes requires administrative rights and a restart.

Enable mitigations for CVE-2018-3639 (Speculative Store Bypass), CVE-2017-5715 (Spectre Variant 2), and CVE-2017-5754 (Meltdown)



To enable mitigations for CVE-2018-3639 (Speculative Store Bypass), CVE-2017-5715 (Spectre Variant 2), and CVE-2017-5754 (Meltdown):

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverride /t REG_DWORD /d 8 /f

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverrideMask /t REG_DWORD /d 3 /f

reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization" /v MinVmVersionForCpuBasedMitigations /t REG_SZ /d "1.0" /f

To disable mitigations for CVE-2018-3639 (Speculative Store Bypass) AND mitigations for CVE-2017-5715 (Spectre Variant 2)  and CVE-2017-5754 (Meltdown)

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverride /t REG_DWORD /d 3 /f

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverrideMask /t REG_DWORD /d 3 /f


Note
These registry changes require administrative rights and a restart.

Verifying that protections are enabled


To help customers verify that the appropriate protections have been enabled, Microsoft has published a PowerShell script that customers can run on their systems. Install and run the script by running the following commands.

PowerShell verification by using the PowerShell Gallery (Windows Server 2016 or WMF 5.0/5.1)

Install the PowerShell Module:

PS> Install-Module SpeculationControl

Run the PowerShell module to verify that protections are enabled:

PS> # Save the current execution policy so it can be reset

PS> $SaveExecutionPolicy = Get-ExecutionPolicy

PS> Set-ExecutionPolicy RemoteSigned -Scope Currentuser

PS> Import-Module SpeculationControl

PS> Get-SpeculationControlSettings

PS> # Reset the execution policy to the original state

PS> Set-ExecutionPolicy $SaveExecutionPolicy -Scope Currentuser

PowerShell verification by using a download from Technet (Earlier OS versions/Earlier WMF versions)

Install the PowerShell module from Technet ScriptCenter:

  1. Go to https://aka.ms/SpeculationControlPS.
  2. Download SpeculationControl.zip to a local folder.
  3. Extract the contents to a local folder. For example: C:\ADV180002

Run the PowerShell module to verify that protections are enabled:

Start PowerShell, and then use the previous example to copy and run the following commands:

PS> # Save the current execution policy so it can be reset

PS> $SaveExecutionPolicy = Get-ExecutionPolicy

PS> Set-ExecutionPolicy RemoteSigned -Scope Currentuser

PS> CD C:\ADV180002\SpeculationControl

PS> Import-Module .\SpeculationControl.psd1

PS> Get-SpeculationControlSettings

PS> # Reset the execution policy to the original state

PS> Set-ExecutionPolicy $SaveExecutionPolicy -Scope Currentuser


For a detailed explanation of the output of the PowerShell script, see
Knowledge Base article 4074629

Frequently asked questions


References