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

# Active Directory Lab

Active Directory security notes for Active Directory Lab, covering enumeration, Kerberos, credentials, ACL abuse, lateral movement, exploitation workflow, and validation steps.

## Installation and configuration of the domain controller (DC)

#### 1. Windows Server Installation

* Download **Windows Server 2022** ISO

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

* Select **Windows Server 2022 Standard (Evaluation)**

<figure><img src="https://131707722-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>

* Install the system on a virtual machine
* Installer **VMware Tools**

<figure><img src="https://131707722-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. Initial setup

* Edit **machine name**

<figure><img src="https://131707722-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>

* Configure a **static IP address**

<figure><img src="https://131707722-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. Installing roles

* Install the role:
  * **Active Directory Domain Services (AD DS)**

<figure><img src="https://131707722-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. Promotion to domain controller

* Create a **new forest**
* Domain name: `whoami.local`

<figure><img src="https://131707722-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>

* Restart the virtual machine after configuration

## Installing Windows 10 machines in the domain

{% 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. Creation of machines

* Create two machines:
  * **WS01**
  * **WS02**

<figure><img src="https://131707722-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. Machine configuration

* Change the computer names:
  * WS01
  * WS02

<figure><img src="https://131707722-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>

Configure the IP address with DNS pointing to the domain controller:

* DNS : `172.16.0.100`

<figure><img src="https://131707722-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>

* Change **advanced sharing** settings (network and discovery)

<figure><img src="https://131707722-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. Creation of users

In the **Active Directory Administration Center**:

<figure><img src="https://131707722-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>

Create two users:

* user1
* user2

<figure><img src="https://131707722-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://131707722-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. Domain Integration

* Go to: **Professional or educational access**

<figure><img src="https://131707722-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>

* Choose: **Connect to a domain**
* Enter domain name: `whoami.local`
* Authenticate with a domain account

<figure><img src="https://131707722-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 Features: Users, Groups and OUs

In **Active Directory Users and Computers**, you can manage and modify the configuration of the forest and objects.

<figure><img src="https://131707722-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>

#### User and OU management

<figure><img src="https://131707722-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>

#### Example: creation of a department

<figure><img src="https://131707722-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>

Create an **organizational unit (OU)**, for example:

* *Toulouse*
* Move existing users into this OU to organize the structure.

<figure><img src="https://131707722-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>

#### Group management

* Create groups, for example:

  * **IT**

  Add users to the group.

<figure><img src="https://131707722-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>

A group can be **a member of another group**.

* Example:
  * The *IT* group can be a member of the *Administrators* group

The users then inherit the **permissions** of the parent group.

<figure><img src="https://131707722-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 Management (Group Policy Objects)

**GPO** allows you to manage configuration policies.

<figure><img src="https://131707722-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>

#### Creating a GPO

* Go to: **Group Policy Management**

<figure><img src="https://131707722-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>

* Click the OU, for example **Toulouse**
* Create a new **GPO**

<figure><img src="https://131707722-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>

* Edit the policy

<figure><img src="https://131707722-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>

#### Types of policies

GPOs can be applied according to:

* **User**
* **Ordinateur**

<figure><img src="https://131707722-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>

#### Example: run a script at session start

* Go to:/ **User Configuration → Windows Settings → Scripts (Logon)**
* Create a `script.bat` file with the contents

{% code overflow="wrap" %}

```bash
calc.exe
```

{% endcode %}

<figure><img src="https://131707722-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>

Result: the calculator opens when the user logs in.

<figure><img src="https://131707722-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>

#### Shared Resources (SMB)

Creating a share

* Go to:/ **Server Manager → File and Storage Services → Shares**

<figure><img src="https://131707722-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>

* Create a new SMB share, for example:
  * Local folder: `C:\Shares\it`
  * Network path: `//DC01/it`

<figure><img src="https://131707722-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>

#### Automatic mounting via GPO

To automatically connect the share:

<figure><img src="https://131707722-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>

* Use a script:

{% code overflow="wrap" %}

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

{% endcode %}

<figure><img src="https://131707722-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>

Result: the network drive automatically appears on the workstations.

<figure><img src="https://131707722-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>

#### Point of vigilance (security)

Pay attention to these folders:

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

<figure><img src="https://131707722-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/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.
