Skip to content
RCE Write-up Intermediate

Printnightmare Gain Rce Privesc On Windows Machines

The Print Spooler service on Windows allowed a domain user to load a malicious DLL, leading to remote code execution and local privilege escalation to SYSTEM. An attacker with valid domain credentials could run code remotely or gain administrator privileges on the target machine.

Mr Jokar Follow

Published on systemweakness.com

Photo by Tadas Sar on Unsplash

Mr Jokar, on systemweakness.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the Print Spooler service failed to properly validate or restrict who could load printer drivers, allowing a low-privileged user to load a malicious DLL.

Impact

An attacker with domain user credentials could execute code remotely and escalate to SYSTEM or administrator, but the text notes the DLL might be detected by antivirus on modern systems.

What the attacker needed

Valid domain user credentials; target runs vulnerable Print Spooler; network access to target

How it was found

  1. Check if the target exposes the print spooler protocols using rpcdump.
  2. Create a malicious DLL that acts as a reverse shell.
  3. Host the DLL on an SMB share.
  4. Run the exploit script pointing to the SMB share to trigger remote code execution.
  5. For local privilege escalation, host a PowerShell script and load it into memory on the victim.
  6. Run the Invoke-Nightmare function to add a backdoor administrator user.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

PrintNightmare is a flaw in how Windows handles printer drivers. It let someone with a normal domain account trick the system into running their own code, either from afar or after already being on the machine, and that code ran with the highest permissions.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by Mr Jokar

View all

4 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.