ActiveDirectory
Table of Contents
Related: Networking
Active Directory
Description
Active Directory is the backbone of most enterprise Windows environments. It stores information about objects on a network — users, computers, groups, and policies — and makes this information available to administrators and users. Understanding AD is essential for both defence and attack, as it is a primary target in real-world intrusions.
Core Concepts
Domain
A domain is the fundamental administrative unit in AD. It is a logical grouping of objects (users, computers, printers) that share the same AD database. A domain is identified by a DNS name (e.g., corp.example.com).
Domain Controller (DC)
A Domain Controller is a server that runs AD Domain Services (AD DS). It is responsible for:
- Authenticating users and computers
- Enforcing Group Policy
- Replicating directory data to other DCs
Every domain must have at least one DC. Compromise of a DC typically means full compromise of the domain.
Forest & Tree
- Tree: One or more domains sharing a contiguous DNS namespace and a trust relationship (e.g.,
corp.example.comanddev.corp.example.com). - Forest: The top-level container. A collection of one or more trees sharing a common schema and global catalogue. The forest is the ultimate security boundary in AD.
Organisational Unit (OU)
An OU is a container within a domain used to organise objects and delegate administrative control. Group Policy Objects (GPOs) are typically linked at the OU level.
Objects
Every entity in AD is an object. Key object types:
- User Account: Represents a person or service identity
- Computer Account: Represents a machine joined to the domain
- Group: A collection of users or computers used to assign permissions
- Service Account: Used by applications and services to authenticate
Schema
The schema defines every object type and attribute that can exist in the forest. It is forest-wide and changes to it replicate to all DCs.
Authentication Protocols
Kerberos
The default authentication protocol for modern AD environments. Key components:
- KDC (Key Distribution Centre): Runs on the DC; issues tickets
- TGT (Ticket Granting Ticket): Obtained at login; proves identity to the KDC
- TGS (Ticket Granting Service): Issued by the KDC to access a specific service
- SPN (Service Principal Name): Unique identifier for a service instance
The flow: User authenticates → receives TGT → presents TGT to request a TGS for a specific service → presents TGS to the service.
NTLM
An older challenge-response authentication protocol. Still used in some environments as a fallback. Considered weaker than Kerberos and a common attack target.
Group Policy
Group Policy Objects (GPOs) are collections of settings applied to users and computers within a domain. They are linked to Sites, Domains, or OUs and enforced by the DC. GPOs control everything from password policies to software deployment and desktop restrictions.
Trusts
A trust is a relationship between two domains or forests that allows users in one domain to access resources in another. Trusts can be:
- One-way or Two-way
- Transitive or Non-transitive
Misconfigured trusts are a common lateral movement path.
Common Attack Vectors
AD is a primary target in most enterprise intrusions. Common techniques include:
- Kerberoasting: Requesting TGS tickets for service accounts with SPNs and cracking them offline
- AS-REP Roasting: Targeting accounts with Kerberos pre-authentication disabled
- Pass-the-Hash (PtH): Using captured NTLM hashes to authenticate without the plaintext password
- Pass-the-Ticket (PtT): Injecting a stolen Kerberos ticket into a session
- Golden Ticket: Forging a TGT using the
krbtgtaccount hash — grants persistent domain access - Silver Ticket: Forging a TGS for a specific service using the service account hash
- DCSync: Simulating DC replication to extract password hashes from the DC
- LDAP Enumeration: Querying AD via LDAP to map users, groups, and permissions
- BloodHound Attack Paths: Mapping privilege escalation paths through AD relationships
Defensive Measures
- Enforce the Principle of Least Privilege for all accounts
- Audit and restrict privileged groups (Domain Admins, Enterprise Admins)
- Enable Protected Users security group for sensitive accounts
- Disable legacy protocols (NTLM where possible, LM always)
- Implement Tiered Administration Model to segment privileged access
- Monitor for anomalous Kerberos ticket requests and LDAP queries
- Regularly audit Service Principal Names and service accounts
- Use Microsoft Defender for Identity (formerly ATP) for AD-specific threat detection
Tools
Enumeration
ldapsearch— Query AD via LDAP from Linux- BloodHound /
SharpHound— Graph-based AD attack path mapping PowerView— PowerShell AD enumeration (part of PowerSploit)ADExplorer— Sysinternals tool for browsing AD objects
Exploitation
Mimikatz— Credential extraction, Pass-the-Hash, Golden/Silver Ticket attacksImpacket— Python toolkit for Kerberoasting, DCSync, SMB attacksRubeus— Kerberos attack and abuse toolkit
Defence & Monitoring
Microsoft Defender for Identity- PingCastle — AD health and security auditing
- Security Information and Event Management
- Windows event logs
Key Event Is to Monitor
| Event ID | Description |
|---|---|
| 4624 | Successful logon |
| 4625 | Failed logon |
| 4648 | Logon using explicit credentials |
| 4672 | Special privileges assigned at logon |
| 4768 | Kerberos TGT requested |
| 4769 | Kerberos TGS requested |
| 4771 | Kerberos pre-authentication failed |
| 4776 | NTLM authentication attempt |
| 4728 | User added to privileged group |
| 4732 | User added to local group |
Learning Resources
- TryHackMe — Active Directory Basics room
- TryHackMe — Attacking Kerberos room
- HackTheBox — Starting Point machines (Windows-focused)
- Microsoft Learn — Active Directory Domain Services documentation
- SpecterOps BloodHound documentation