Active Directory is a directory service that stores users, computers, groups, and policies as hierarchical objects. It is designed for backward compatibility, which is exactly why it is rarely secure by default — any authenticated user can enumerate most of the environment. Knowing the structure is step one to breaking it.
Forest, Tree, Domain, OU
- Forest — the topmost container and the actual security boundary. Everything inside shares one schema and one configuration partition.
- Tree — a chain of domains sharing a contiguous DNS namespace (e.g.
corp.local→dev.corp.local). A forest is a collection of one or more trees. - Domain — a logical partition of objects (users, computers, groups). Domains inside a forest are joined by automatic two-way transitive parent-child trusts.
- Organizational Unit (OU) — a container used to group objects for delegation and GPO application. OUs are where real administrative boundaries live within a domain.
Forest is the boundary, not the domain
Compromising one domain in a forest almost always means you can pivot to the forest root. Domain admin in a child = enterprise admin via SID history / inter-realm TGT forging.
Trusts (Overview)
A trust links the authentication systems of two domains or forests. Trust enables authentication; it does not grant permissions — those still require ACL entries on the target side.
| Trust | Where it lives |
|---|---|
| Parent-child | Auto-created inside a forest; two-way transitive |
| Tree-root | Between forest root and a new tree root; two-way transitive |
| Cross-link | Shortcut between two child domains to speed auth |
| External | Between two domains in different forests; non-transitive, uses SID filtering |
| Forest | Between two forest roots; transitive within each forest |
Direction is inverted from access
If Domain A trusts Domain B, users from B can access resources in A. Arrow in BloodHound points from trusting → trusted.
FSMO Roles
AD is multi-master for most writes, but five operations would conflict if every DC handled them. These are pinned to one DC at a time (Flexible Single Master Operation).
Forest-wide (one per forest):
- Schema Master — owns writes to the AD schema
- Domain Naming Master — adds/removes domains in the forest
Domain-wide (one per domain):
- RID Master — hands out pools of RIDs so no two objects collide on a SID
- PDC Emulator — password changes, lockout, time sync, GPO authority, legacy clients
- Infrastructure Master — resolves cross-domain references (SID/GUID/DN)
Role holders can be transferred (graceful, holder online) or seized (forced, used when the holder is dead).
GPOs
Group Policy Objects are reusable collections of settings — registry tweaks, logon scripts, security options, software install. Each GPO has a GUID and lives half in SYSVOL (templates) and half in AD (the GPO container). GPOs link to sites, domains, or OUs (SDOU) and apply in LSDOU order: Local → Site → Domain → OU.
SYSVOL is an attacker's goldmine
Logon scripts, old GPP XMLs (
Groups.xmlwithcpassword), and MSI installers routinely leak creds. Any domain user can read SYSVOL.
SIDs, RIDs, and Well-Known SIDs
A Security Identifier (SID) uniquely identifies any security principal (user, group, computer). Format: S-1-5-21-<domain>-<RID>. The trailing RID (Relative Identifier) is what makes an object unique inside the domain; the rest is the domain SID.
RIDs below 1000 are reserved for built-ins:
500 Built-in Administrator
501 Guest
502 krbtgt
512 Domain Admins
513 Domain Users
514 Domain Guests
515 Domain Computers
516 Domain Controllers
518 Schema Admins
519 Enterprise Admins
520 Group Policy Creator Owners
Universal well-known SIDs you will see constantly:
S-1-1-0 Everyone
S-1-5-11 Authenticated Users
S-1-5-18 LOCAL SYSTEM
S-1-5-19 LOCAL SERVICE
S-1-5-20 NETWORK SERVICE
S-1-5-32-544 BUILTIN\Administrators
S-1-5-32-545 BUILTIN\Users
S-1-5-32-551 BUILTIN\Backup Operators
SID history is an attack vector
The
sIDHistoryattribute is preserved during migrations. If SID filtering is off across a trust, injecting a parent-forest EA SID into a forged ticket’s PAC grants enterprise admin.
User Accounts vs Machine Accounts
Every domain-joined host gets a machine account that behaves like a user. It appears in AD as HOSTNAME$ (dollar-sign suffix). The password is 120 random characters, rotated every 30 days by default, and used to encrypt service tickets for any Kerberos service running as SYSTEM/NETWORK SERVICE on that host.
| Attribute | User | Machine |
|---|---|---|
| sAMAccountName | jsmith | WS01$ |
| Password | user-chosen | 120-char random |
| Rotation | per policy | ~30 days auto |
| Default SPNs | none | HOST/…, RestrictedKrbHost/… |
The machine account's NT hash is the host
If you dump the local SAM’s
$MACHINE.ACCsecret or the computer account hash, you can request Kerberos tickets as the host and impersonate SYSTEM-level services on it.
Key Built-in Groups
- Domain Admins — full admin on every domain-joined host and DC in the domain
- Enterprise Admins — forest-wide admin; lives in the forest root
- Schema Admins — can modify the schema (dormant most of the time)
- Administrators (BUILTIN) — local admin on DCs; typically contains DA/EA
- Account Operators — can create/modify non-admin users and groups; frequent lateral-movement target because membership is often over-granted
- Backup Operators — can read any file via
SeBackupPrivilege; game-over equivalent to DA - Server Operators — can start/stop services on DCs; path to SYSTEM on DC
- Print Operators — load drivers on DCs (PrintNightmare-adjacent)
- DnsAdmins — legacy abuse to load a DLL as SYSTEM on the DNS server (usually a DC)
- Protected Users — defensive group; members cannot be delegated, can’t use NTLM, RC4 Kerberos, or long-lived TGTs. Blocks several classic attacks.
AdminCount=1 is a flag, not a fix
Members of protected groups get
adminCount=1and inherit AdminSDHolder ACLs. Watch for staleadminCount=1users no longer in any admin group — their ACLs are still locked down (or the inverse, still over-privileged).
Service Principal Names (SPNs)
An SPN uniquely identifies an instance of a service to Kerberos. Format: service/host:port/servicename, e.g. MSSQLSvc/sql01.corp.local:1433, HTTP/web01.corp.local, CIFS/dc01.corp.local.
- When a client wants to use a service, it asks the KDC for a TGS for that SPN. The KDC returns a ticket encrypted with the NT hash of the account that owns the SPN.
- Machine accounts auto-register
HOST/,RestrictedKrbHost/SPNs on join. - When an SPN is registered on a user account (service account), any domain user can request that ticket and crack it offline — this is Kerberoasting.
SPN presence = Kerberoastable
Get-DomainUser -SPNorGetUserSPNs.pylists every user with a non-emptyservicePrincipalName. Prioritize ones withadmincount=1and weak/old passwords.
Related
- 19 · Active Directory Enumeration & Attacks — module index
- 00 · Cheatsheet & Checklist
- Core Protocols
- External Recon & Initial Enumeration
- LLMNR & NBT-NS Poisoning
- Password Policy & User Lists
- Password Spraying
- Credentialed Enumeration (Linux)
- Credentialed Enumeration (Windows)
- Kerberoasting & AS-REP Roasting
- ACL Abuse
- Lateral Movement & Attacks
- Trust Abuse
- Hardening & Detection
