Skip to main content
Mallory
HighExploited in the wildCISA KEVPublic exploitVulnerability

CVE-2021-34527: PrintNightmare

Published Jul 2, 2021 · Updated 14 days ago
Trending this weekNot trendingOutside this week’s top 100
Mention activity · 30 days2 mentions · peak 2 in a dayToday
CVSS8.8High · v3.1
EPSS99.8%100th percentile
CISA KEVYesAdded Nov 3, 2021
In the wildActivePer CISA KEV
Vendor
Microsoft Corporation
IdentifiersCVE-2021-34527CWE-269

PrintNightmare (CVE-2021-34527) is a remote code execution vulnerability in the Windows Print Spooler service caused by improper handling of privileged file operations during printer driver installation. An authenticated attacker can abuse the driver installation functionality to load attacker-controlled code with SYSTEM privileges. Windows clients, member servers, and domain controllers are affected when the vulnerable Print Spooler service is enabled. The vulnerability is distinct from CVE-2021-1675 and was not resolved by the June 2021 update addressing that separate flaw. Microsoft released security updates on July 6 and 7, 2021; insecure Point and Print configurations can leave updated systems exposed.

Do you run this?See affected versions in your environment and whether adversaries are exploiting this vulnerability against assets like yours.
Check your exposure
Analyst brief

Impact, mitigation & remediation

What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.

Impact

What an attacker gets, and what they’ve been doing with it.

Successful exploitation compromises the confidentiality, integrity, and availability of the affected host through arbitrary code execution as SYSTEM. An attacker can install software, access or modify sensitive information, delete data, and create privileged accounts. Exploitation can facilitate credential theft, lateral movement, and ransomware deployment. Compromise of an affected domain controller can have domain-wide consequences. PrintNightmare exploitation has been associated with ransomware operations including Conti, Vice Society, and Black Basta.

Mitigation

If you can’t patch tonight, do this now.

Stop and disable the Print Spooler service on systems that do not require printing, particularly domain controllers; this prevents exploitation through the service but disables printing functionality. Where printing must remain available, disabling inbound remote printing through Group Policy reduces remote exposure but does not eliminate local exploitation risk. Restrict unnecessary RPC and SMB access, including TCP ports 135, 139, and 445, using host and network firewalls. These network restrictions are defense-in-depth measures rather than substitutes for patching and secure driver installation policies.

Remediation

Patch, then assume compromise.

Install current applicable Windows security updates incorporating the CVE-2021-34527 fixes first released on July 6 and 7, 2021. The July 13, 2021 cumulative updates and subsequent applicable cumulative updates include these protections. Verify that the Point and Print policy values NoWarningNoElevationOnInstall and UpdatePromptSettings are both 0 or undefined. Configure Point and Print Restrictions to show warnings and elevation prompts for both new driver installations and existing driver updates. Set RestrictDriverInstallationToAdministrators to 1 to enforce administrator-only printer driver installation; this became the default with updates released on or after August 10, 2021.

Public exploits

Exploits

16 exploits validated by Mallory's analysis. Hidden: 20 rejected by Mallory's analysis as not a working exploit; 1 not yet analyzed, such as Exploit-DB entries.

View more in app →
cve_2021_1675_printnightmare.rbThis repository contains a single Metasploit module implementing the PrintNightmare exploit (CVE-2021-1675 and CVE-2021-34527) targeting Microsoft Windows systems. The exploit abuses the Print Spooler service via DCERPC and SMB to upload and execute a malicious DLL, resulting in remote code execution as SYSTEM. The module requires valid SMB credentials and the Print Spooler service to be running on the target. The code is written in Ruby and leverages Metasploit's libraries for SMB and DCERPC communication. The main file, 'modules/exploits/windows/dcerpc/cve_2021_1675_printnightmare.rb', contains all exploit logic, including checks for service availability, driver enumeration, and the actual payload delivery. The exploit is weaponized, allowing for customizable payloads and is suitable for post-authentication attacks on vulnerable Windows systems.Disclosed Jun 8, 2021 · Framework: metasploit · ruby · networkWeaponizedcve-2021-34527This repository contains a weaponized local privilege escalation (LPE) exploit for CVE-2021-34527, also known as PrintNightmare. The exploit is implemented in C++ as a Visual Studio project and targets unpatched Microsoft Windows systems (Desktop 7, 8, 8.1, 10, 11 and Server 2008, 2012, 2016, 2019). The main exploit logic is in 'CVE-2021-34527.cpp', which leverages the AddPrinterDriverEx() Win32 API to load an attacker-supplied DLL into the Print Spooler service (spoolsv.exe), resulting in SYSTEM-level code execution. The exploit requires the user to provide a path to a thread-safe DLL payload, which is then copied to the printer driver directory and executed as SYSTEM. The code also attempts to clean up by removing the malicious printer driver after exploitation. The repository includes project files for building x86 and x64 binaries, resource files, and a README describing the exploit's purpose and affected systems. No network endpoints are hardcoded; the attack vector is local, requiring code execution on the target system.hackerhouse-opensource · Disclosed Sep 5, 2022 · c++ · localWeaponizedCVE-2021-1675-LPE-EXPThis repository contains a local privilege escalation (LPE) exploit for CVE-2021-1675 (PrintNightmare) targeting Microsoft Windows systems. The main code file, CVE-2021-1675-LPE.cpp, is a C++ program that leverages the AddPrinterDriverEx API to load an attacker-supplied DLL as a printer driver, resulting in code execution as SYSTEM. The exploit dynamically discovers the appropriate printer driver path using EnumPrinterDriversW, reducing the need for hardcoded paths except on Windows Server 2008, where manual adjustment may be required. The README provides usage instructions and notes on compatibility, listing successful tests on Windows 10, Windows Server 2012 R2, and Windows Server 2008 R2. The exploit requires local access and a malicious DLL payload, which can perform arbitrary actions as SYSTEM (the example DLL creates a file as proof). The repository includes Visual Studio project files for building the exploit. No network endpoints are involved; the attack vector is local privilege escalation via the Windows Print Spooler service.evilashz · Disclosed Jul 1, 2021 · c++ · localOperationalCVE-2021-1675-LPEThis repository provides a local privilege escalation (LPE) exploit for CVE-2021-1675 and CVE-2021-34527 (PrintNightmare) on Windows systems. The exploit is implemented in C/C++ and includes both a standard executable and a Reflective DLL version for use with Cobalt Strike. The main exploit logic is in 'src/main.cpp' and 'src/CVE-2021-1675-LPE-RDLL/main.cpp'. The exploit works by abusing the AddPrinterDriverExW API to install a malicious DLL as a printer driver, which is then executed with SYSTEM privileges. The attacker must supply a path to their payload DLL. The repository also includes a Cobalt Strike Aggressor script ('lpe_cve_2021_1675.cna') for integration with Cobalt Strike. The exploit is operational and has been tested on Windows Server 2019 Standard. The README provides usage instructions, mitigation advice, and references. No network endpoints are hardcoded; the attack is local and targets the Windows Print Spooler service and related file paths.hlldz · Disclosed Jul 1, 2021 · c · cpp · localOperationalCVE-2021-1675This repository provides an operational exploit for CVE-2021-1675 (PrintNightmare), specifically targeting local privilege escalation on Windows systems. The main exploit is a PowerShell script (not included in the provided files) that leverages a custom DLL payload, which is built from the C++ source code in 'nightmare-dll/nightmare/dllmain.cpp'. The DLL, when loaded by the Print Spooler service, creates a new local user ('adm1n' with password 'P@ssw0rd') and adds it to the Administrators group, effectively granting SYSTEM-level privileges. The DLL can be replaced with a user-supplied payload for arbitrary code execution. The repository includes Visual Studio project files for building the DLL, and the exploit is intended for use on Windows Server 2016 and 2019. The attack vector is local, requiring the attacker to execute code on the target system. The only fingerprintable endpoint is the file path for a custom DLL payload. The structure is typical for a C++ DLL project, with source, header, and project configuration files.calebstewart · Disclosed Jul 1, 2021 · cpp · localOperationalCVE-2021-34527This repository provides an operational exploit for CVE-2021-34527 (PrintNightmare), a critical Windows Print Spooler vulnerability. The exploit is implemented as a PowerShell script (not included in the provided files) that leverages a custom DLL payload, whose source code is provided in C++ under 'nightmare-dll/nightmare/dllmain.cpp'. The DLL, when loaded by the Print Spooler service, creates a new local user (default: adm1n/P@ssw0rd) and adds it to the Administrators group, achieving local privilege escalation. The DLL can be customized to perform arbitrary actions, allowing for further exploitation. The repository includes Visual Studio project files for building the DLL. The exploit targets unpatched Windows Server 2016 and 2019 systems with the Print Spooler service enabled. No network endpoints are hardcoded; the attack is local and leverages Windows API calls to manipulate user accounts and groups.JohnHammond · Disclosed Jul 2, 2021 · cpp · localOperationalPrintNightmare-LPEThis repository is a functional local privilege escalation exploit for CVE-2021-1675 (PrintNightmare) targeting Windows 10 and Windows Server 2012. The exploit is implemented in C++ and consists of three main components: 1. **PrintNightmareLPE**: The main exploit binary (PrintNightmareLPE.cpp) orchestrates the attack. It creates a directory (`C:\temp\testcase`), copies a malicious DLL (`vlib.dll`) and a client executable (`xconsole.exe`) to this directory, and then abuses the Windows Print Spooler service via the `AddPrinterDriverEx` API to load the malicious DLL with SYSTEM privileges. 2. **vlib.dll**: This DLL, when loaded by the Print Spooler, spawns a bind shell on TCP port 31337 (localhost only) as NT SYSTEM. The shell is implemented in `BindShell.cpp` and is triggered via the DLL's `DllMain` entry point. 3. **xconsole.exe**: This is a client program that connects to the bind shell on 127.0.0.1:31337, providing the attacker with an interactive NT SYSTEM shell. The exploit requires local access to the target system and the ability to copy files and execute binaries. The attack vector is local privilege escalation via the vulnerable Print Spooler service. The repository is well-structured, with separate Visual Studio projects for each component. The exploit is operational and provides a working SYSTEM shell if the target is vulnerable and properly configured.sailay1996 · Disclosed Jul 5, 2021 · c++ · localOperationalmicrosoft-cve-2021-1675Small standalone Visual Studio C# exploit project for CVE-2021-1675 targeting Microsoft Windows Print Spooler. Repository structure is minimal: solution/project files, App.config, assembly metadata, a single main source file (Program.cs), and a README. The exploit logic is entirely in Program.cs. It P/Invokes AddPrinterDriverEx from winspool.drv, builds a DRIVER_INFO_2 structure, and sets pDataFile and pConfigFile to an attacker-supplied DLL while using a supplied legitimate driver path for pDriverPath. It first calls AddPrinterDriverEx once, then loops through 10 possible spooler backup subdirectories under C:\Windows\System32\spool\drivers\x64\3\Old\<n>\ to retry loading the copied DLL by filename. This indicates the exploit’s purpose is to abuse printer driver installation semantics to get the spooler service to load a malicious DLL, yielding local privilege escalation/arbitrary code execution on vulnerable systems. No network communication or C2 is present; this is a local exploit requiring operator-supplied paths and a prepared DLL payload.thalpius · Disclosed Jul 16, 2021 · csharp · xml · localOperationalCVE-2021-1675_RDL_LPEThis repository provides a Cobalt Strike Aggressor Script (.cna) plugin for exploiting the PrintNightmare vulnerability (CVE-2021-1675) to achieve local privilege escalation (LPE) on Windows systems. The main file, PrintNightMareLpe.cna, registers an exploit module ('PrintNightMare-1675') that uploads a custom DLL (either LPE_Reflect_Elevate.x64.dll or CVE-2021-1675.x64.dll) to a randomized filename in C:\Windows\Temp, then executes it to escalate privileges to SYSTEM. The exploit is designed for use within Cobalt Strike's Beacon, and only supports 64-bit Windows targets. The README provides usage instructions and notes that the exploit attempts to bypass Defender/EDR by obfuscating the DLL name. The repository contains three files: the main exploit script, a README, and a .gitattributes file. No network endpoints are hardcoded; the only fingerprintable endpoint is the temporary DLL path on the target system.mstxq17 · Disclosed Sep 1, 2021 · Framework: Cobalt Strike · aggressor script · localOperationalPrintNightmareThis repository contains a Python implementation of the PrintNightmare exploit (targeting CVE-2021-1675 and CVE-2021-34527) using the Impacket library. The main file, printnightmare.py, is a standalone exploit script that allows an attacker to check for vulnerability, list printer drivers, delete drivers, and most importantly, exploit the Print Spooler service on vulnerable Windows systems by uploading and loading a malicious DLL. The exploit can use both local and remote (UNC/SMB) paths for the DLL payload, enabling remote code execution with SYSTEM privileges. The README.md provides detailed usage instructions, example commands, and guidance on setting up an SMB share to host the malicious DLL. The repository is operational and ready for use, requiring only a valid DLL payload and credentials for the target system. The attack vector is network-based, exploiting the MS-RPRN (Remote Procedure Call) interface of the Windows Print Spooler service. Multiple fingerprintable file paths and UNC paths are present, both as targets for the DLL payload and as part of the exploitation process.ly4k · Disclosed Sep 26, 2021 · python · networkOperationalSharpPNThis repository contains a C# implementation of an exploit for the PrintNightmare vulnerability (CVE-2021-1675) affecting the Windows Print Spooler service. The main file, Program.cs, is a console application that takes a DLL path as an argument and attempts to load it as a printer driver using the AddPrinterDriverEx API. The exploit works by abusing the printer driver installation process to load an arbitrary DLL, which is executed with SYSTEM privileges. The attacker must supply a malicious DLL, which is then specified via the -DLL command-line argument. The exploit targets Windows systems (Windows x64) and requires the Print Spooler service to be running and vulnerable. The repository includes build instructions and references to related research. No network endpoints or remote attack vectors are present; the exploit is intended for local privilege escalation. The codebase is small, with the main logic contained in Program.cs, and is operational, requiring the attacker to provide their own payload DLL.Wra7h · Disclosed Sep 26, 2021 · csharp · localOperationalCVE-2021-34527This repository contains a Python exploit for the PrintNightmare vulnerability (CVE-2021-34527) affecting Microsoft Windows systems. The main file, CVE-2021-34527.py, is a fully operational exploit that leverages the Windows Print Spooler service to achieve remote code execution as SYSTEM by uploading and executing a malicious DLL. The exploit supports targeting multiple hosts, includes a built-in SMB server for payload delivery (removing the need for external file shares), and allows the attacker to specify authentication credentials or NTLM hashes. It supports both the MS-RPRN and MS-PAR protocols and implements a UNC path bypass technique. The README provides detailed usage instructions, remediation advice, and references to the original research. The code is written in Python and relies on the impacket library for network and protocol operations. The repository is structured with a single exploit script, a README, and a .gitignore file. No detection scripts or fake code are present; this is a real, operational exploit.m8sec · Disclosed Aug 23, 2022 · python · networkOperationalCVE-2021-1675-PrintNightmare-AnalysisSmall standalone Python PoC repository for PrintNightmare exploitation. The repo contains one executable exploit script under poc/CVE-2021-1675.py plus a README write-up. The script uses Impacket DCERPC bindings to connect to the remote Windows Print Spooler over the named pipe \\pipe\\spoolss, authenticate with supplied credentials, bind to the MS-RPRN interface, open a printer handle, and call hRpcAddPrinterDriverEx with a crafted DRIVER_INFO_2 structure. The key capability is forcing spoolsv.exe to load an attacker-controlled DLL from a UNC path on an SMB share, yielding remote code execution in SYSTEM context. The README expands this into an operational workflow: verify MS-RPRN/MS-PAR exposure, generate a malicious DLL (example uses msfvenom Meterpreter reverse_tcp), host it over SMB, and trigger the exploit. This is a real exploit PoC rather than a detector; it requires valid credentials, reachable SMB hosting, and a vulnerable/insufficiently patched Windows Print Spooler target.VelesSecurity · Disclosed Aug 18, 2026 · python · markdown · network · webOperationalCVE-2021-1675-Local-Privilege-Escalation-CVSS-7.8-This is a small Visual Studio 2019 C++ DLL project, rather than a complete PrintNightmare exploit. The repository contains a README, a solution/project configuration supporting Win32 and x64 Debug/Release DLL builds, precompiled-header scaffolding, and the primary payload source at `nightmare-dll/nightmare/dllmain.cpp`. The DLL links against NetAPI32 and performs its actions from DllMain: it initializes a USER_INFO_1 structure, attempts to create the hard-coded `adm1n` account with password `P@ssw0rd`, then attempts to add that account to the local `Administrators` group. API return values are ignored, so the payload supplies no success validation or error handling. The README claims a PowerShell `cve-2021-1675.ps1`/`Invoke-Nightmare` workflow and custom-DLL support, but no PowerShell script, spooler/RPC calls, driver enumeration, compressed payload, or CVE trigger is present in the supplied files. Consequently, the repository is best characterized as a basic post-exploitation DLL payload intended for loading by a separate PrintNightmare exploitation chain, not a standalone implementation of CVE-2021-1675. The code also reaches the end of BOOL DllMain without explicitly returning a value, which can make DLL load behavior unreliable.pentagon404uzb · Disclosed Sep 25, 2026 · cpp · localOperationalCVE-2021-1675This repository provides multiple implementations (Python and C#) of the PrintNightmare exploit (CVE-2021-1675 / CVE-2021-34527), targeting a critical vulnerability in the Windows Print Spooler service. The exploit enables remote code execution (RCE) or local privilege escalation (LPE) by uploading and executing a malicious DLL on a vulnerable Windows system. The main Python exploit (CVE-2021-1675.py) uses Impacket to interact with the MS-RPRN protocol, while the C# implementation (SharpPrintNightmare) provides similar functionality for both local and remote exploitation. The exploit requires valid credentials and a network-accessible SMB share hosting the attacker's DLL payload. The repository includes detailed usage instructions, example commands, and information on required system configuration and registry settings. The code is operational and can be used to achieve SYSTEM-level code execution on unpatched or misconfigured Windows systems.cube0x0 · Disclosed Jun 29, 2021 · python · csharp · network · localPoCPrintNightmare-CVE-2021-34527This repository contains multiple operational exploits for the PrintNightmare vulnerability (CVE-2021-34527, CVE-2021-1675) affecting the Windows Print Spooler service. The exploit allows authenticated users to achieve remote code execution as SYSTEM by abusing the RpcAddPrinterDriverEx API to install a printer driver with a malicious DLL from a remote SMB share. The repository includes three main exploit implementations: a Python script (CVE-2021-34527.py) using Impacket, a C++ proof-of-concept (EXP/POC/POC.cpp), and a C# implementation (SharpPrintNightmare/SharpPrintNightmare/Program.cs). Each exploit automates the process of connecting to the target's Print Spooler service over RPC, providing a path to a malicious DLL, and triggering the service to load and execute the DLL with SYSTEM privileges. The exploits require valid credentials and network access to the target. The repository also provides detailed setup instructions for hosting the payload DLL via SMB and for configuring the environment for successful exploitation. The code is mature and operational, capable of providing full SYSTEM-level code execution on vulnerable Windows systems.nemo-wq · Disclosed Jul 3, 2021 · python · c · networkPoC
Exposure surface

Affected products & vendors

Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.

VendorProductType
Microsoft CorporationWindows 10 1507operating_system
Microsoft CorporationWindows 10 1607operating_system
Microsoft CorporationWindows 10 1809operating_system
Microsoft CorporationWindows 10 1909operating_system
Microsoft CorporationWindows 10 2004operating_system
Microsoft CorporationWindows 10 20h2operating_system
Microsoft CorporationWindows 10 21h1operating_system
Microsoft CorporationWindows 10 21h2operating_system
Microsoft CorporationWindows 10 22h2operating_system
Microsoft CorporationWindows 11 21h2operating_system
Microsoft CorporationWindows 11 22h2operating_system
Microsoft CorporationWindows 7operating_system
Microsoft CorporationWindows 8.1operating_system
Microsoft CorporationWindows Rt 8.1operating_system
Microsoft CorporationWindows Server 2004operating_system
Microsoft CorporationWindows Server 2008operating_system
Microsoft CorporationWindows Server 2008 R2operating_system
Microsoft CorporationWindows Server 2008 Sp2operating_system
Microsoft CorporationWindows Server 2012operating_system
Microsoft CorporationWindows Server 2012 R2operating_system
Microsoft CorporationWindows Server 2016operating_system
Microsoft CorporationWindows Server 2019operating_system
Microsoft CorporationWindows Server 2022operating_system
Microsoft CorporationWindows Server 20h2operating_system
FAQ

Frequently asked questions

Is CVE-2021-34527 exploited in the wild?
Yes. As of Nov 3, 2026, Mallory has reports of exploitation in the wild, and CISA added it to KEV on Nov 3, 2021.
Is there a public exploit for CVE-2021-34527?
Yes. Mallory tracks 16 public exploits or proofs of concept for CVE-2021-34527, the earliest disclosed Jun 8, 2021.
Is there a patch for CVE-2021-34527?
Install current applicable Windows security updates incorporating the CVE-2021-34527 fixes first released on July 6 and 7, 2021. The July 13, 2021 cumulative updates and subsequent applicable cumulative updates include these protections.
What products are affected by CVE-2021-34527?
Microsoft Corporation Windows 10 1507, Microsoft Corporation Windows 10 1607, Microsoft Corporation Windows 10 1809, Microsoft Corporation Windows 10 1909, Microsoft Corporation Windows 10 2004, and at least 19 more.
How severe is CVE-2021-34527?
CVE-2021-34527 has a CVSS v3.1 score of 8.8 (High) and an EPSS score of 99.8% (100th percentile) as of Nov 3, 2026.
Activity feed

Recent activity

93 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.

View more in app →
+71 more in the timeline. Sign up to see them
Do you run this?See affected versions in your environment and whether adversaries are exploiting this vulnerability against assets like yours.
Check your exposure
Mallory platform

The version that knows your environment.

This page is what’s public. Mallory adds the parts that aren’t: which of your assets are affected, which adversaries are exploiting it right now, and which detections to deploy tonight.
Exposure mappingQuery your assets running an affected version, and investigate the blast radius.
Threat actor evidence26Every report linking this CVE to a named adversary.
Associated malware57Malware families linked to this CVE, with evidence and IOCs.
Detection signatures16YARA, Sigma, Snort, and vendor rules, auto-deployed to your SIEM.
Vendor-by-vendor mappingCross-references every affected SKU, including bundled OEM variants.
Social activity4Community discussion across Reddit, Mastodon, and other social sources.