Menu

PrintNightmare

CVE-2021-34527High · 8.8 (Microsoft: critical)

PrintNightmare let anyone with a valid domain account make the Windows Print Spooler load their code as a printer driver and run it as SYSTEM, on another machine too. On a domain controller that means the whole domain.

Affected
Windows with the Print Spooler running
Fixed in
July 2021 security updates
Published
2021-07-02
Known exploited since
2021-11-03

What PrintNightmare is

The Print Spooler runs on almost every Windows machine, domain controllers included, and it let users install printer drivers unsafely. A driver is code, so installing one meant running code as SYSTEM.

Spot it in the logs

Which machine took the attacker's driver?

Windows PrintService events 316 (a driver was added) and 808 (the spooler failed to load a DLL), new DLLs in the spool drivers folder, and spoolsv.exe starting rundll32.exe and then a shell. The driver often comes from a share on the attacker's machine.

How the attack works

  1. 1Someone with any domain account, or a hijacked laptop
  2. 2Asks a machine's Print Spooler to install a printer driver
  3. 3The spooler loads their DLL and runs it as SYSTEM
  4. 4On a domain controller, that is the whole domain

Why PrintNightmare was so severe

Microsoft and NVD both give CVE-2021-34527 a CVSS 3.1 base score of 8.8. The vector explains the number: the attack works over the network, needs no user to click anything, and gives full control of the machine. The one thing it needs is a low-privilege account, which keeps the score below the top of the scale. In a Windows domain that bar is low, because any ordinary user account, or any hijacked laptop, is enough. CERT/CC added that a local user without admin rights could use it on their own machine as well.

The Print Spooler (spoolsv.exe) is the Windows service that manages print jobs, and it runs as SYSTEM, the most powerful account on a Windows machine. Microsoft says all versions of Windows were affected, and Rapid7 noted that the spooler is enabled by default on most Windows Server editions. Domain controllers, the servers that hold every account and password in the domain, were affected whenever their spooler was running. CISA called the result a quick path to compromising an organisation's identity infrastructure. Rapid7 confirmed on 1 July 2021 that public exploits worked against a fully patched Windows Server 2019.

The fix was also hard to get right. The June 2021 update did not stop it, the July update needed the right Point and Print settings to work, and related spooler bugs were fixed in August and September. Microsoft said a machine with the NoWarningNoElevationOnInstall setting turned on stays "vulnerable by design" even when patched. So "is it patched?" was never a simple yes or no.

Check your systems

  • Is the Print Spooler running?Get-Service -Name Spooler
  • Are driver installs limited to administrators?Get-ItemProperty 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint' -Name RestrictDriverInstallationToAdministrators

How to detect PrintNightmare

Turn on the print service logs first, then watch the spool drivers folder, the spooler's child processes and the spooler's network traffic.

  • Read the PrintService event logsEvent 316 records that a printer driver was added or updated, for both successful and failed attempts, and event 808 records that the spooler failed to load a plug-in module, with the DLL path in the details. Sources differ on where 808 lands: Rapid7 reads it from the PrintService Admin log, while Trend Micro names both the Admin and the Operational log. The Microsoft-Windows-PrintService/Operational log is often off by default, so turn it on before you need it.
  • Watch the spool drivers folderIn the published attacks, the malicious DLL was written to C:\Windows\System32\spool\drivers\x64\3\New\ and then moved one folder up. Alert on new DLLs in these folders that do not belong to a known printer driver, and on spoolsv.exe loading a DLL it has never loaded before. Rapid7 published Velociraptor artifacts to hunt for these files.
  • Flag odd children of spoolsv.exeThe spooler almost never needs to start a command shell. Trend Micro documented spoolsv.exe starting rundll32.exe, which then started cmd.exe and opened an outbound connection. An alert on spoolsv.exe starting rundll32.exe, cmd.exe or powershell.exe is a strong signal.
  • Look at spooler network trafficThe attack is a call to the spooler's driver install functions, RpcAddPrinterDriverEx or RpcAsyncAddPrinterDriver, sent over RPC or SMB on TCP ports 135, 139 or 445. Watch for these calls from machines that are not print administrators, and for a server fetching a driver file from a share on a workstation. Talos released Snort rules 57876 and 57877, and Trend Micro released IPS rules 1011016 and 1011018.
  • Audit spooler and Point and Print settingsRun `Get-Service -Name Spooler` on domain controllers and servers that do not print; Microsoft Defender for Identity reports domain controllers with the spooler running as a security finding. Under HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint, NoWarningNoElevationOnInstall and UpdatePromptSettings should be 0 or absent, and RestrictDriverInstallationToAdministrators should be 1 or absent.
  • Use published hunting queriesMicrosoft said it published Microsoft 365 Defender hunting queries for this activity on GitHub. Rapid7 published PowerShell queries for the two PrintService events. Run them over all the logs you keep, because attackers used the flaw within days of the public proof of concept.

Check a log line

Search the logs yourself

Find the printer driver that reached the domain controller.

printsrv: /var/log/events.log

Fix it, in this order

  1. 1Stop the spooler where nobody printsStop and disable it on domain controllers. Disable it, or it comes back on the next restart.
  2. 2Cut off the sourceIsolate the machine sending the drivers.
  3. 3Patch, and restrict driversApply the July 2021 updates and let only administrators install drivers.
  • CVE-2021-1675The spooler bug Microsoft fixed in June 2021, first as a local privilege escalation, then reclassified as remote code execution. It is the one most often confused with PrintNightmare; Microsoft says the July 2021 updates protect against both.
  • CVE-2021-34481A spooler flaw reported by researcher Jacob Baines on 18 June 2021 and published by Microsoft on 15 July. Its fix on 10 August 2021 changed Windows so that only administrators can install printer drivers by default. Microsoft scores it 8.8 and NVD 9.8.
  • CVE-2021-36958Another publicly disclosed spooler remote code execution flaw, announced on 11 August 2021 with only a workaround. Microsoft fixed it in the September 2021 updates on 14 September.
  • CVE-2022-38028A spooler elevation of privilege flaw fixed on 11 October 2022. Microsoft found that Forest Blizzard (APT28) exploited it with a tool called GooseEgg, and CISA added it to its exploited list on 23 April 2024.

Timeline

  1. 2021-07-02The CVE is published
  2. 2021-07-06Microsoft ships out-of-band updates
  3. 2021-11-03CISA lists it as exploited

PrintNightmare attacks in the wild

Exploitation started within days. When CISA issued Emergency Directive 21-04 on 13 July 2021, it said multiple threat actors were actively exploiting the flaw. The same day, CrowdStrike blocked attempts by the Magniber ransomware group, which mostly targets South Korea: the attackers wrote a DLL into the spool\DRIVERS\x64\3\New folder and loaded it into spoolsv.exe, and CrowdStrike stopped the attack before any files were encrypted. On 12 August 2021 Cisco Talos reported that the Vice Society ransomware group had used PrintNightmare to spread across a victim's network before deploying ransomware.

State-sponsored actors used it too. In advisory AA22-074A, CISA described Russian state-sponsored actors who, from as early as May 2021, broke into a non-governmental organisation by guessing the password of a dormant account and enrolling their own device in its multi-factor login. They then used PrintNightmare to become administrators, redirected the multi-factor service on the domain controller so it failed open, and stole data from cloud storage and email.

The spooler stayed a target after 2021. In April 2024 Microsoft reported that Forest Blizzard, the group also called APT28 and linked to Russia's GRU military intelligence, had used a tool named GooseEgg against a later spooler flaw, CVE-2022-38028, since at least June 2020. Microsoft noted in the same report that Russian actors had exploited PrintNightmare as well.

Who found PrintNightmare

On 8 June 2021 Microsoft fixed a spooler bug, CVE-2021-1675, as a local elevation of privilege, credited to researchers at Tencent Security Xuanwu Lab, AFINE and NSFOCUS. On 21 June it changed the impact to remote code execution and the severity to Critical. Researchers at Sangfor, Zhiniang Peng and Xuefeng Li, had found a spooler bug on their own and planned to present it at Black Hat USA 2021 under the name PrintNightmare. After another company, QiAnXin, posted an exploit video, they published their write-up and a working proof of concept on GitHub at the end of June. They removed it within hours, but copies had already been made, and the June update did not stop it.

CERT/CC published a note (VU#383432) on 30 June saying the June update did not protect against the public exploit. Microsoft published CVE-2021-34527 on 1 July and called it "similar but distinct" from CVE-2021-1675. Out-of-band updates followed on 6 July and, for Windows 10 version 1607, Server 2016 and Server 2012, on 7 July. When researchers reported they could still get around the fix, Microsoft answered on 8 July that the update worked as designed, as long as the Point and Print registry settings had not been changed to an insecure setup.

Lessons from PrintNightmare

The first lesson was to switch off services nobody uses. A domain controller rarely prints, yet its spooler was running and reachable by every user. Microsoft Defender for Identity now flags domain controllers with the spooler on, with one trade-off to plan for: on a domain controller the spooler also cleans up stale printer entries in Active Directory. The second was least privilege for drivers. Since August 2021 only administrators can install printer drivers by default, and Microsoft calls a machine with NoWarningNoElevationOnInstall turned on "vulnerable by design". A patch is only as good as the settings around it, so check the configuration, not only the update status.

PrintNightmare also showed what happens when a proof of concept goes public before the fix: a bug that looked patched became a zero-day overnight. In the longer term Microsoft is moving away from third-party printer code. Windows protected print mode blocks third-party printer drivers, and Microsoft says it mitigates over half of past reported Windows print security issues. Under its end of servicing plan, from 15 January 2026 no new printer drivers are published to Windows Update for Windows 11 and Windows Server 2025, apart from case-by-case approvals.

The case

PrintNightmare: The Spooler

  1. Find what the advisory affects
  2. Where is it coming from?
  3. Protect the domain controller
Investigate it hands-on

Questions

Should I turn off the Print Spooler everywhere?

On domain controllers and servers that do not print, yes. Print servers need it; patch them and restrict driver installs to administrators.

Why do Microsoft and NVD rate it differently?

Microsoft rates it Critical and NVD scores it 8.8 (high). Both describe the same flaw.

Is PrintNightmare still a threat?

Machines with the July 2021 or later updates are protected, unless Point and Print has been set to the insecure NoWarningNoElevationOnInstall option. Unpatched machines are still at risk, and the spooler keeps attracting attackers: Microsoft reported in 2024 that Russia's Forest Blizzard was exploiting a later spooler flaw.

Has PrintNightmare been patched?

Yes. Microsoft released out-of-band updates on 6 and 7 July 2021, and the fix is in every cumulative update since 13 July 2021. The 10 August 2021 updates added a stricter default, so that only administrators can install printer drivers.

How do I check if I am vulnerable to PrintNightmare?

Check that the machine has a Windows update from July 2021 or later, and run `Get-Service -Name Spooler` to see whether the spooler is running. Then check the PointAndPrint registry values: NoWarningNoElevationOnInstall and UpdatePromptSettings should be 0 or absent.

What is the Windows Print Spooler?

It is the Windows service, spoolsv.exe, that accepts print jobs, queues them and sends them to printers. It runs as SYSTEM, so any code it loads, such as a printer driver, runs with full control of the machine.

What is the difference between CVE-2021-1675 and CVE-2021-34527?

CVE-2021-1675 was fixed in June 2021, and Microsoft calls CVE-2021-34527 "similar but distinct", with a different attack route. The name PrintNightmare belongs to CVE-2021-34527, the one the June update did not stop. The July 2021 updates cover both.

Why is it called PrintNightmare?

PrintNightmare was the codename the Sangfor researchers gave the bug for their planned Black Hat talk. The name spread when their proof of concept leaked in late June 2021, before Microsoft had assigned it a CVE.