PrintNightmare (CVE-2021-34527) is a zero-day critical Windows bug that allows Remote Code Execution. It affects all supported Windows machines, including both endpoints and servers. For more information on the bug, please read the article on Sophos Naked Security.
On July 7, 2021 Microsoft initiated the rollout of patches for this vulnerability for OS builds 19041.1083, 19042.1083, and 19043.1083, and issued important security guidance for anyone deploying the fixes. Affected organizations should apply the patches at the first opportunity.
Starting on July 2, 2021, SophosLabs released IPS signatures for Sophos endpoint and firewall products that target remote add printer driver calls as observed in the available Proof of Concepts:
- Sophos XG Firewall and Sophos SG UTM: 57876 and 57877 (released 2021-07-02 and 2021-07-03]
- Sophos Intercept X and Sophos Endpoint Protection: 2305776 (released 2021-07-06]
- cpp version : Exp/20211675-A
- c# version : Exp/20211675-B
- powershell version: Exp/20211675-C
- python version: Exp/20211675-D
What to do
Affected organizations should apply the available Microsoft patches at the first opportunity. If you are unable to do this we advise:
Option 1. Turn off Print Spooler wherever you can, and limit access to Print Spooler services as strictly as you can on Windows machines where it genuinely can’t be turned off
Option 2. Disable inbound remote printing through Group Policy
For more information on these workarounds see the Microsoft Security Update Guide.
Investigate exposure with Sophos EDR and Sophos XDR
Customers can use Live Discover to identify if they are impacted by this vulnerability and identify whether the patch has been applied.
1. Identify devices running Print Spooler
SELECT display_name, status, start_type, user_account, CASE WHEN status = 'RUNNING' THEN ' Exposed to unpatched vulnerabilities inc. PrintNightmare' WHEN status = 'STOPPED' THEN ' NOT exposed to unpatched vulnerabilities inc. PrintNightmare' END AS SpoolerCheck, CASE WHEN start_type = 'AUTO_START' THEN 'Set Spooler to DISABLED or DEMAND_START' END AS ServiceCheck FROM services WHERE path = 'C:\Windows\System32\spoolsv.exe';
2. Hunt for failures to load modules
Use Live Discover to run the below query to find failures to load modules. Results will need to be manually verified by the administrator.
SELECT datetime, eventid, 'PrintService' AS Source, JSON_EXTRACT(data, '$.UserData.Context') AS context, JSON_EXTRACT(data, '$.UserData.ErrorCode') AS ErrorCode, JSON_EXTRACT(data, '$.UserData.LoadPluginFailed') AS LoadPluginFailed, JSON_EXTRACT(data, '$.UserData.PluginDllName') AS PluginDllName FROM sophos_windows_events WHERE source = 'Microsoft-Windows-PrintService/Admin' AND eventid = 808 AND (LOWER(ErrorCode) = '0x45a' OR LOWER(ErrorCode) = '0x7e');
3. Identify whether the patch has been deployed
For the latest query, see the Sophos support threat hunting community post.
Organizations using Sophos protection managed through Sophos Central can activate Sophos EDR for free, for 30 days using the Free Trials feature within their Sophos Central console.
Identify devices running Print Spooler using Windows SC (Service Control) command
To see if the Spooler service is running on your computer, you can use the Windows
SC (Service Control) command from a command prompt Window, e.g.
C:\Users\duck>sc query spooler SERVICE_NAME: spooler TYPE : 110 WIN32_OWN_PROCESS (interactive) STATE : 4 RUNNING (STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN) WIN32_EXIT_CODE : 0 (0x0) SERVICE_EXIT_CODE : 0 (0x0) CHECKPOINT : 0x0 WAIT_HINT : 0x0
You can prevent the spooler starting by itself, even after a reboot, with:
C:\Users\duck>sc config spooler start= disabled
Note that there must be no space between the word
start and the
= character, but you do need a space between the
= sign and the word
disabled. You need to start your command prompt (CMD.EXE) as Administrator to reconfigure services.
Reboot and you should see this:
C:\Users\duck>>sc query spooler SERVICE_NAME: spooler TYPE : 110 WIN32_OWN_PROCESS (interactive) STATE : 1 STOPPED WIN32_EXIT_CODE : 1077 (0x435) SERVICE_EXIT_CODE : 0 (0x0) CHECKPOINT : 0x0 WAIT_HINT : 0x0
We will update this article with further information once available.