Print Spooler-related attacks

Understanding Print Spooler Attack Surface

What Makes Print Spooler Exploitable?

The Windows Print Spooler service (spoolsv.exe) runs as SYSTEM by default and has been a consistent source of privilege escalation vulnerabilities. The service's design creates several attack opportunities:

Core Issues:

  • Runs as SYSTEM - High-privilege target for escalation

  • Named pipe communication - Allows impersonation attacks

  • Driver loading functionality - Can load arbitrary DLLs

  • Network authentication - Can be forced to authenticate to attackers

  • Enabled by default - Present on almost all Windows systems

Attack Categories:

  1. Local Privilege Escalation - PrintSpoofer, PrintNightmare local

  2. Remote Code Execution - PrintNightmare remote variants

  3. Domain Escalation - SpoolSample + NTLM relay attacks

  4. Persistence - Malicious print driver installation

PrintSpoofer Attack

Understanding PrintSpoofer

PrintSpoofer exploits the Print Spooler's named pipe communication to perform token impersonation. When the Print Spooler connects to an attacker-controlled named pipe, the attacker can impersonate the SYSTEM token.

Why PrintSpoofer Works:

  • Print Spooler creates named pipes for communication

  • Attackers can create pipes with predictable names

  • When Print Spooler connects, attacker gains SYSTEM token

  • Works from service accounts (NetworkService, LocalService)

PrintSpoofer Exploitation

Download and Setup:

Basic Usage:

Advanced Usage:

From PowerShell:

PrintNightmare (CVE-2021-34527)

Understanding PrintNightmare

PrintNightmare exploits the Print Spooler's ability to install printer drivers. The vulnerability allows loading of arbitrary DLLs with SYSTEM privileges through the AddPrinterDriverEx API.

Attack Variants:

  • Local Exploitation - Load malicious driver DLL locally

  • Remote Exploitation - Force remote driver installation

  • LPE (Local Privilege Escalation) - Standard local attack

  • RCE (Remote Code Execution) - Network-based attack

PrintNightmare Local Exploitation

Using CVE-2021-1675.py:

Using PrintNightmare.ps1:

Creating Malicious Driver DLL:

PrintNightmare Remote Exploitation

Remote Attack Setup:

Execute Remote Attack:

Metasploit Module:

SpoolSample Attack

Understanding SpoolSample

SpoolSample forces a domain controller to authenticate to an attacker-controlled machine using the computer account. This authentication can be relayed to other services for domain escalation.

Attack Flow:

  1. Use SpoolSample to force DC authentication

  2. Capture/relay NTLM authentication

  3. Use relayed auth for privilege escalation

  4. Gain domain admin or equivalent access

SpoolSample Execution

Basic SpoolSample Usage:

SpoolSample with Responder:

SpoolSample with ntlmrelayx:

Advanced SpoolSample Techniques

LDAP Relay for DCSync:

HTTP Relay Attack:

Multiple Target Relay:

Malicious Print Driver Installation

Understanding Driver-Based Persistence

Print drivers run with SYSTEM privileges and load at system startup. Installing malicious print drivers provides persistent SYSTEM access.

Driver Installation Techniques

Using PrintNightmare for Persistence:

Manual Driver Installation:

PowerShell Driver Management:

Service Status Check

Basic Enumeration:

PowerShell Enumeration:

Remote Enumeration:

Patch Status Verification

Check PrintNightmare Patches:

PowerShell Patch Check:

Tool Integration and Automation

Metasploit Integration

PrintNightmare Module:

PrintSpoofer Integration:

Attack Scenarios and Chaining

Scenario 1: Service Account to SYSTEM

Initial Access: Service account (NetworkService, LocalService) Target: Local SYSTEM privileges

Scenario 2: Domain Controller Compromise

Initial Access: Domain user account Target: Domain Admin privileges

Scenario 3: Remote Code Execution

Initial Access: Network access to target Target: Code execution as SYSTEM

Scenario 4: Lateral Movement

Use SpoolSample for lateral movement across domain:

Operational Notes

PrintSpoofer Requirements:

  • Service account context (NetworkService, LocalService, or similar)

  • Print Spooler service running (default)

  • Named pipe creation permissions

PrintNightmare Requirements:

  • Valid domain credentials (any domain user)

  • Network access to target system

  • Print Spooler service running

  • Ability to host malicious DLL

SpoolSample Requirements:

  • Domain user credentials

  • Network access to domain controller

  • MS-RPRN RPC interface accessible

  • Target must have Print Spooler enabled

Success Indicators:

  • PrintSpoofer: Command prompt shows "nt authority\system"

  • PrintNightmare: Payload DLL executes with SYSTEM privileges

  • SpoolSample: Authentication captured in relay tool

  • Driver Installation: Driver appears in system driver list

Print Spooler attacks remain one of the most reliable privilege escalation vectors in modern Windows environments, with multiple techniques applicable across different scenarios from local escalation to domain compromise.

Last updated

Was this helpful?