> 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/lab-setup.md).

# Active Directory 实验室

面向 Active Directory 实验室的 Active Directory 安全笔记，涵盖枚举、Kerberos、凭据、ACL 滥用、横向移动、利用流程和验证步骤。

## 域控制器（DC）的安装和配置

#### 1. Windows Server 安装

* 下载 **Windows Server 2022** ISO

{% embed url="<https://www.microsoft.com/en-us/evalcenter/download-windows-server-2022>" %}

* 选择 **Windows Server 2022 Standard（评估版）**

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-33465f5173c9c20c604aca74f5e13db947ed561c%2F%7B7E996479-527F-40BE-94D6-4840E71F0050%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

* 在虚拟机上安装系统
* 安装程序 **VMware Tools**

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a9089e73fcd5200afa25278f64c8bc42d22cf5e0%2F%7B229AFF00-22A7-4EDB-BD03-AF43AA4A71CF%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 2. 初始设置

* 编辑 **机器名称**

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f0d8353aecf152fb7d1eea3445095ad4b2f9f3e6%2F%7B062678A8-1C4A-46F0-8CAC-8AC7BFE4C47F%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

* 配置一个 **静态 IP 地址**

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-40478a18c351a8dc484359bd062762a7689ed3d0%2F%7B79E50A8D-5B11-4298-BD09-45BDD0E028B7%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 3. 安装角色

* 安装该角色：
  * **Active Directory 域服务（AD DS）**

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

#### 4. 提升为域控制器

* 创建一个 **新林**
* 域名： `whoami.local`

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-09dcfa5821f78d3de1c540160dfc51381ddf6527%2F%7B0AC81069-5284-46B3-8312-27975D0D4FC8%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

* 配置完成后重启虚拟机

## 将 Windows 10 机器加入域

{% embed url="<https://software.download.prss.microsoft.com/dbazure/Win10_22H2_Spanish_x64v1.iso?t=8faab265-3c5c-460a-ae83-230703b31fd6&P1=1777739675&P2=601&P3=2&P4=ESZ9seUg91b93n2FgqYLYn08u1otAQpm6KUoqKs%2bPfI%2fRGyaR5gC6Z%2bpXtNfLTnRjZwTh0kYwqPjfq0n6jCpj9JH8gba3jIb3OHetCttHy4inx40XJRc7nvkHlJpxfz9q75MgH%2fJNsc3h9ONnCrJ16sUH9PmqmYXPYzSxRQ%2bVltoOyn%2bgWrRLvWlemNQ3BPk6GRx%2bMaFPHPxZcur%2bobP%2fa2%2bCe%2fnm4Ymh2fbIK4KS1e9mXZMCT4hNto6aLXUoAHE6mkoLtIJVAG0wXB%2bo3koJs%2f3Maq8OTxThJdmIAHaASjxSOdRRuqQzOzDiyjQBpmLtvodrW6VrbRBxNGZ9839Bg%3d%3d>" %}

#### 1. 创建机器

* 创建两台机器：
  * **WS01**
  * **WS02**

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-fc070e3e176740f8719351c6a62557ef55b8e48f%2F%7B58592090-60B3-4E88-84F0-D7F9E05D7193%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 2. 机器配置

* 更改计算机名称：
  * WS01
  * WS02

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-291adb37a82ecb97970b80b5f0856dbd6f07d56d%2F%7BBEC0C63F-B6D3-4DB5-8579-27188741188E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

配置 IP 地址，DNS 指向域控制器：

* DNS： `172.16.0.100`

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

#### 3. 创建用户

在 **Active Directory 管理中心**:

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-cb0dac46761ef0daea2c758e98c91dbbf02d3eb8%2F%7B1BC3E755-F8B6-4F5C-B3C0-E907C950CE5E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

创建两个用户：

* user1
* user2

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-73dcd0c7b32b45209ba003238e7544b0163518ab%2F%7B60749964-2526-4990-98CC-3DB3265C3CF2%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-36007368b2874de0623f6e0146c92d70b10878c4%2F%7B691A4287-1B46-455E-8C48-FEF93032F378%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 4. 域集成

* 转到： **专业或教育访问**

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

* 选择： **连接到域**
* 输入域名： `whoami.local`
* 使用域账户进行身份验证

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-eef6debbc8731e5fb69da7d832329a539a064163%2F%7BFAFBED6E-EDD1-450C-8CC8-505C27DE8A3A%7D.png?alt=media" alt="" width="535"><figcaption></figcaption></figure>

## Active Directory 功能：用户、组和 OU

在 **Active Directory 用户和计算机**，你可以管理和修改林及对象的配置。

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

#### 用户和 OU 管理

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5a3a54afea6d4437a79a5b4c47fa9675774216da%2Fimage%20(3177).png?alt=media" alt="" width="418"><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-4b38621fef7d6018436d6adee9e7ea21f4cfe66d%2Fimage%20(3178).png?alt=media" alt=""><figcaption></figcaption></figure>

创建一个 **组织单位（OU）**，例如：

* *图卢兹*
* 将现有用户移动到此 OU 中以组织结构。

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-64ae8f8fbc6f40dd289cdf94bd48685829c02501%2F%7B2CF10B62-6D8E-4945-9B34-438449D46821%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 组管理

* 创建组，例如：

  * **IT**

  将用户添加到该组中。

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

一个组可以 **是另一个组的成员**.

* 示例：
  * 该 *IT* 组可以是 *Administrators* 组的成员

然后用户会继承 **权限** 来自父组。

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

#### GPO 管理（组策略对象）

**GPO** 允许你管理配置策略。

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-746b05995b7c1aed4e6acb94e044e9dd380bcf51%2F%7B05C91C61-EC64-40CB-A870-8453181CA0CF%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 创建 GPO

* 转到： **组策略管理**

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-59f8dc03e2867ab269ec7355b6409c0c58cdd022%2F%7B501F9469-78FB-4BF6-867F-5597B5C99ACE%7D.png?alt=media" alt="" width="475"><figcaption></figcaption></figure>

* 点击该 OU，例如 **图卢兹**
* 创建一个新的 **GPO**

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

#### 策略类型

GPO 可根据以下内容应用：

* **用户**
* **计算机**

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6aa63a88a36b53094cbc9c470fa6814849dc11a0%2F%7BD1E2524F-382F-46EF-844F-3C6A4AB87EBC%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 示例：在会话开始时运行脚本

* 转到：/ **用户配置 → Windows 设置 → 脚本（登录）**
* 创建一个 `script.bat` 包含以下内容的文件

{% code overflow="wrap" %}

```bash
calc.exe
```

{% endcode %}

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2a0eebb970b0ee660716e14cb9e778262cafc71e%2Fimage%20(3185).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-d3848cc94e526b4836bb08942ea7358980909ddf%2F%7B1A27CE21-BAB8-44C7-8EFD-773AFDF3D83A%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 共享资源（SMB）

创建共享

* 转到：/ **服务器管理器 → 文件和存储服务 → 共享**

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

* 创建一个新的 SMB 共享，例如：
  * 本地文件夹： `C:\Shares\it`
  * 网络路径： `//DC01/it`

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

#### 通过 GPO 自动挂载

要自动连接该共享：

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

* 使用脚本：

{% code overflow="wrap" %}

```bash
net use t: //172.16.0.100/it
```

{% endcode %}

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

#### 注意事项（安全）

请注意这些文件夹：

* **NETLOGON**
* **SYSVOL**

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