Print Spooler Remote Code Execution (PrintNightmare)
The Windows Print Spooler lets an authenticated user install a printer driver that runs as SYSTEM, giving remote code execution on unpatched or weakly configured hosts.
| Severity | High |
| CVSS 3.1 | 8.8 CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H Open in the calculator |
| CVSS 4.0 | 8.7 CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-863: Incorrect Authorization |
| OWASP Top 10 | A01:2025 Broken Access Control |
| MITRE ATT&CK | T1210 Exploitation of Remote Services, T1068 Exploitation for Privilege Escalation |
| CVE | CVE-2021-34527, CVE-2021-1675 |
| Category | Outdated Components |
Description
PrintNightmare (CVE-2021-34527, closely related to CVE-2021-1675) is a flaw in the driver installation functions of the Windows Print Spooler service, RpcAddPrinterDriverEx in MS-RPRN and RpcAsyncAddPrinterDriver in MS-PAR. An authenticated user, which means any domain user, can call them remotely and make the spooler load a DLL of their choosing, which runs as SYSTEM. The service runs by default on Windows clients and servers, including domain controllers.
On a domain controller this gives immediate control of the domain, including every password hash; on other servers and workstations it gives full control of the host and access to the credentials of users signed in to it. Where the spooler cannot be reached over the network, the flaw still lets any local user become SYSTEM. Public exploits are reliable, and the flaw has been widely exploited, including in ransomware attacks.
Microsoft's updates from July 2021 onwards fix the flaw, and since August 2021 they restrict printer driver installation to administrators by default (RestrictDriverInstallationToAdministrators). An updated host can still be exploitable where that value has been set to 0 and Point and Print policy suppresses the warning and elevation prompts (NoWarningNoElevationOnInstall or UpdatePromptSettings set to 1 under HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint).
The weakness is identified by checking whether a host exposes the MS-RPRN and MS-PAR interfaces (for example with Impacket's rpcdump.py), its update level and the registry values above. It can be confirmed by loading a harmless DLL with a public exploit, which should be done only where agreed, because a failed attempt can stop the spooler.
Remediation
- Install the latest cumulative security update on every Windows host, starting with domain controllers and servers.
- Stop and disable the Print Spooler service on domain controllers and on every server and workstation that does not need to print (see the example below, or set the service to Disabled through Group Policy).
- Ensure that
RestrictDriverInstallationToAdministratorsis 1 or not set, and thatNoWarningNoElevationOnInstallandUpdatePromptSettingsare 0 or not set, underHKLM\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint. Where users must install printer drivers, use the Point and Print Restrictions policy limited to approved print servers rather than suppressing the prompts. - On hosts that must keep the spooler running but do not share printers, disable inbound remote printing with the policy Allow Print Spooler to accept client connections (Computer Configuration > Administrative Templates > Printers).
To disable the service with PowerShell:
Confirm the fix by checking the update level, service state and registry values, and by repeating the exploit attempt, which should be refused.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.