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.
Photo by Tadas Sar on Unsplash
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
- Check if the target exposes the print spooler protocols using rpcdump.
- Create a malicious DLL that acts as a reverse shell.
- Host the DLL on an SMB share.
- Run the exploit script pointing to the SMB share to trigger remote code execution.
- For local privilege escalation, host a PowerShell script and load it into memory on the victim.
- 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.