Skip to content
Tutorials Center
My learning

Topics

Lesson 29 of 53 ยท Network, Wireless and Cloud Security

Active Directory Lab and Concepts

Learn the core Active Directory concepts (domain, domain controller, users, groups, OUs, GPO, Kerberos) and how to build a small isolated AD lab for authorized security practice.

Most large organizations run their user accounts, computers and permissions through Active Directory (AD), Microsoft's directory service for Windows networks. It decides who can log in where, which files a person can open and which settings every laptop receives. Because it holds the keys to almost everything, it is also the most valuable target inside a corporate network, and understanding it is mandatory for both attackers' and defenders' work. This lesson covers the concepts and how to build a safe home lab. The next lesson, AD Network Attacks, Enumeration and Defenses, builds on it.

Practice Active Directory testing only in a lab you build yourself on isolated virtual networks, never on an employer's or a third party's domain without written permission. Use evaluation or lab licenses from the vendor and keep the lab disconnected from your real network. The runnable examples here are models in memory.

The core ideas

What Active Directory holds

Domain A security boundary and name, like corp.example.
Domain controller Server that stores the directory and logs people in.
Objects Users, groups, computers.

One directory, many machines.

1 / 2
  • Active Directory Domain Services (AD DS) is the role that stores the directory database, which lists every user, group and computer, along with their attributes.
  • A domain is an administrative boundary with a DNS-style name such as corp.example.test. Several domains can be grouped in a tree and several trees in a forest, the outer security boundary.
  • A domain controller (DC) is a server running AD DS. Organizations run at least two for resilience. Compromising a DC is usually game over, which is why defenders protect it like a vault.
  • Organizational units (OUs) are containers that arrange objects, for example by department or location. Administrators delegate control per OU.
  • Groups assign permissions to many users at once. Good design gives rights to groups, then adds people to groups. Membership in privileged groups, such as Domain Admins, is the most sensitive fact in the directory.
  • Group Policy Objects (GPOs) apply configuration to computers or users in an OU: password rules, firewall settings, software, scripts. A weak or overly open GPO can change many machines at once, for good or ill.
  • Authentication uses Kerberos by default (tickets issued by the DC) and falls back to NTLM in some situations, an older challenge-response protocol that is weaker and a frequent source of findings.
  • DNS is tightly bound to AD: clients find domain controllers by DNS records, so a broken DNS means a broken domain.
flowchart TD
  F["Forest: example.test"] --> D["Domain: corp.example.test"]
  D --> DC["Domain controllers"]
  D --> OU1["OU: Staff"]
  D --> OU2["OU: Servers"]
  OU1 --> U["Users"]
  OU1 --> W["Workstations"]
  OU2 --> S["File and app servers"]
  D --> G["Groups: Domain Admins, Helpdesk, ..."]
  D --> P["GPOs linked to OUs"]

Objects live in OUs, groups carry permissions and GPOs configure machines.

Why security people care

AD was designed so that ordinary users can read a lot about the directory: names, groups, computers. That makes it easy to administer and easy to enumerate. Attackers who obtain any low-privilege account can usually map the domain, then look for paths to higher privileges through group membership, delegated rights and weak configurations. Defenders turn the same knowledge into hardening: tiered administration, fewer privileged accounts, patched domain controllers, strong policies and monitoring of sensitive changes.

Building a small lab

A minimal lab needs three virtual machines on an internal-only virtual network. Use evaluation images from the vendor and plan roughly 8 to 12 GB of RAM across them.

  1. Domain controller: a Windows Server evaluation VM. Install the AD DS role, promote it to a DC for a new forest such as lab.test, and install DNS with it. Set a static IP address.
  2. Workstation: a Windows client evaluation VM joined to the domain. Set its DNS server to the DC's IP.
  3. Analyst VM: your Kali Linux machine on the same internal network, for testing.

Then build realistic content so that there is something to learn from: a handful of users across two or three OUs, a few security groups, a file share, a service account and one or two intentionally weak settings that you document. Take snapshots at each stable point. Typical administration steps, shown read-only because they need a real Windows server:

TEXT
# on the domain controller (PowerShell, lab only)
Install-WindowsFeature AD-Domain-Services -IncludeManagementTools
Install-ADDSForest -DomainName "lab.test"
New-ADOrganizationalUnit -Name "Staff" -Path "DC=lab,DC=test"
New-ADUser -Name "Alice Lab" -SamAccountName alice -Path "OU=Staff,DC=lab,DC=test" -Enabled $true
New-ADGroup -Name "Helpdesk" -GroupScope Global -Path "OU=Staff,DC=lab,DC=test"
Add-ADGroupMember -Identity "Helpdesk" -Members alice

Use obviously fake lab credentials (and never reuse a real password) and write down the intentional weaknesses so you know what to look for when you test.

A directory model stand-in

The stand-in builds a tiny AD in memory and answers two questions a defender cares about: who is in privileged groups, and which GPO applies to a machine. It is a model, not AD.

Node.js Model users, groups, OUs and GPOs

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

Real audits ask the same questions over thousands of objects, which is why tools that visualize the directory are so useful.

Reading permissions by group nesting

Groups can contain other groups, so a user can hold a privilege indirectly: bob is in Helpdesk, which is in Server Operators, which can log on to domain controllers. These nested memberships are the usual source of surprising access. The second stand-in resolves effective membership and shows how a long chain hides an admin right.

Node.js Resolve nested group membership

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

Defender checklist

  • Keep privileged groups tiny and review them regularly; give service accounts only the rights they need.
  • Use separate admin accounts for administration, and never log in to ordinary workstations with them.
  • Patch domain controllers first and restrict who can log on to them.
  • Require SMB and LDAP signing, disable legacy protocols where you can and monitor NTLM use.
  • Log and alert on changes to privileged groups, new accounts and policy edits.
  • Back up AD and test restore as part of incident response.

Foreign security principals and trusts

In a multi-domain forest, an object from another domain can be placed in a local group. Active Directory represents it with a foreign security principal (FSP) object in the local domain's container, which holds only the foreign object's SID. When reviewing a domain, list FSPs, because they show cross-domain access that is easy to forget. Remove stale entries and review trust relationships regularly.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is a domain controller?

    A domain controller runs AD DS, holds the directory database and handles logins. Compromising it usually means compromising the whole domain.
  2. 2. What do Group Policy Objects do?

    GPOs apply settings such as password rules and security options to the objects in the OUs they are linked to.
  3. 3. Why is nested group membership a security concern?

    Effective permissions follow the whole chain of memberships, so audits must resolve nesting rather than read only direct groups.
  4. 4. Where should you practice AD security testing?

    Authorization is mandatory. A lab on an internal-only virtual network lets you learn without risk.

Summary

  • Active Directory centralizes users, groups, computers and policies; domain controllers store the directory and authenticate logins.
  • Domains, trees and forests structure it; OUs organize objects; groups carry permissions; GPOs push settings.
  • Kerberos is the default authentication; NTLM remains in places and is a common weakness.
  • A small lab needs a domain controller, a joined workstation and an analyst machine on an internal-only network.
  • Privileged and nested group membership are the first things to audit.
  • Harden with minimal privileged groups, tiered admin accounts, patched DCs, signing and monitoring.

Next: Cloud and Container Security Testing