Associated Vulnerability
Title:Windows Print Spooler Remote Code Execution Vulnerability (CVE-2021-34527)Description:<p>A remote code execution vulnerability exists when the Windows Print Spooler service improperly performs privileged file operations. An attacker who successfully exploited this vulnerability could run arbitrary code with SYSTEM privileges. An attacker could then install programs; view, change, or delete data; or create new accounts with full user rights.</p> <p>UPDATE July 7, 2021: The security update for Windows Server 2012, Windows Server 2016 and Windows 10, Version 1607 have been released. Please see the Security Updates table for the applicable update for your system. We recommend that you install these updates immediately. If you are unable to install these updates, see the FAQ and Workaround sections in this CVE for information on how to help protect your system from this vulnerability.</p> <p>In addition to installing the updates, in order to secure your system, you must confirm that the following registry settings are set to 0 (zero) or are not defined (<strong>Note</strong>: These registry keys do not exist by default, and therefore are already at the secure setting.), also that your Group Policy setting are correct (see FAQ):</p> <ul> <li>HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint</li> <li>NoWarningNoElevationOnInstall = 0 (DWORD) or not defined (default setting)</li> <li>UpdatePromptSettings = 0 (DWORD) or not defined (default setting)</li> </ul> <p><strong>Having NoWarningNoElevationOnInstall set to 1 makes your system vulnerable by design.</strong></p> <p>UPDATE July 6, 2021: Microsoft has completed the investigation and has released security updates to address this vulnerability. Please see the Security Updates table for the applicable update for your system. We recommend that you install these updates immediately. If you are unable to install these updates, see the FAQ and Workaround sections in this CVE for information on how to help protect your system from this vulnerability. See also <a href="https://support.microsoft.com/topic/31b91c02-05bc-4ada-a7ea-183b129578a7">KB5005010: Restricting installation of new printer drivers after applying the July 6, 2021 updates</a>.</p> <p>Note that the security updates released on and after July 6, 2021 contain protections for CVE-2021-1675 and the additional remote code execution exploit in the Windows Print Spooler service known as “PrintNightmare”, documented in CVE-2021-34527.</p>
Description
A PrintNightmare (CVE-2021-34527) Python Scanner. Scan entire subnets for hosts vulnerable to the PrintNightmare RCE
Readme
# It Was All A Dream
A [CVE-2021-34527](https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-34527) (a.k.a [PrintNightmare](https://github.com/afwu/PrintNightmare)) Python Scanner. Allows you to scan entire subnets for the PrintNightmare RCE (**not the LPE**) and generates a CSV report with the results. Tests exploitability over [MS-PAR](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-par/695e3f9a-f83f-479a-82d9-ba260497c2d0) and [MS-RPRN](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rprn/d42db7d5-f141-4466-8f47-0a4be14e2fc1).
This tool has "de-fanged" versions of the [Python exploits](https://github.com/cube0x0/CVE-2021-1675), it does *not* actually exploit the hosts however it does use the same vulnerable RPC calls used during exploitation to determine if hosts are vulnerable.
**Update July 7th 2021: This also checks if host(s) are vulnerable using the [UNC bypass](https://twitter.com/gentilkiwi/status/1412771368534528001) discovered by [@gentilkiwi](https://twitter.com/gentilkiwi)**
# Why?
POV, trying to determine if something is vulnerable to PrintNightmare:

At the time of writing, the amount of variables [that determine if a machine is vulnerable](https://twitter.com/StanHacked/status/1410922404252168196?s=20) is crazy and confusing.
# Alternatives
- [Pingcastle](https://www.pingcastle.com/) (C#)
# Installation
~~This tool currently needs [cube0x0](https://github.com/cube0x0)'s Impacket fork containing the MS-PAR implementation necessary for one of the checks. This change has been submitted to Impacket in [this pull request](https://github.com/SecureAuthCorp/impacket/pull/1114).~~
You need to install [Impacket](https://github.com/SecureAuthCorp/impacket) from git as it has the MS-PAR implementation necessary for one of the checks. (Both of the installation methods below do this automatically for you)
Docker:
```
git clone https://github.com/byt3bl33d3r/ItWasAllADream
cd ItWasAllADream && docker build -t itwasalladream .
docker run -it itwasalladream -u user -p password -d domain 192.168.1.0/24
```
Dev install requires [Poetry](https://python-poetry.org/):
```
git clone https://github.com/byt3bl33d3r/ItWasAllADream
cd ItWasAllADream && poetry install && poetry shell
itwasalladream -u user -p password -d domain 192.168.1.0/24
```
# Usage
```
usage: itwasalladream [-h] -u USERNAME [-p PASSWORD] -d DOMAIN [--timeout TIMEOUT] [--threads THREADS] [-v] [--csv-column CSV_COLUMN] target
PrintNightmare (CVE-2021-34527) scanner
positional arguments:
target Target subnet in CIDR notation, CSV file or newline-delimited text file
optional arguments:
-h, --help show this help message and exit
-u USERNAME, --username USERNAME
username to authenticate as (default: None)
-p PASSWORD, --password PASSWORD
password to authenticate as. If not specified will prompt. (default: None)
-d DOMAIN, --domain DOMAIN
domain to authenticate as (default: None)
--timeout TIMEOUT Connection timeout in secods (default: 30)
--threads THREADS Max concurrent threads (default: 100)
-v, --verbose Enable verbose output (default: False)
--csv-column CSV_COLUMN
If target argument is a CSV file, this argument specifies which column to parse (default: DNSHostName)
I used to read Word Up magazine!
```
As the exploit requires you to be authenticated to Active Directory, you need to supply credentials. If the password isn't supplied it will prompt you to enter it.
By default it will use 100 threads, you can increase/decrease these using the `-t` argument.
After its done you'll see a `report_<timestamp>.csv` file in your current directory with the results.
# Credits
- [cube0x0](https://github.com/cube0x0) for implementing the MS-PAR & MS-RPRN protocols in [Impacket](https://github.com/SecureAuthCorp/impacket) and creating the PrintNightmare [Python Exploits](https://github.com/cube0x0/CVE-2021-1675)
- [Zhiniang Peng](https://twitter.com/edwardzpeng) & [Xuefeng Li](https://twitter.com/lxf02942370) for the discovery of the PrintNightmare exploit.
File Snapshot
[4.0K] /data/pocs/185f5625ff1bb0787c94ae9c2312cedc50655db7
├── [ 301] Dockerfile
├── [4.0K] itwasalladream
│ ├── [ 0] __init__.py
│ ├── [ 12K] __main__.py
│ ├── [3.0K] par_vector.py
│ ├── [3.0K] rprn_vector.py
│ └── [1.1K] structs.py
├── [ 564] Makefile
├── [ 62K] poetry.lock
├── [ 835] pyproject.toml
├── [4.2K] README.md
├── [ 23K] requirements-dev.txt
├── [ 15K] requirements.txt
└── [4.0K] tests
├── [ 274] conftest.py
└── [ 0] __init__.py
2 directories, 14 files
Remarks
1. It is advised to access via the original source first.
2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →