AD Objects
Active Directory stores everything as objects. Every user, group, computer, organizational unit, and GPO is an object with attributes and a distinguished name. Understanding these objects and their relationships is the foundation of AD exploitation.
1. Users
User objects represent human (or service) accounts that authenticate to the domain. They are the most frequently targeted objects in AD attacks.
Key User Attributes
| Attribute |
Description |
Attack Relevance |
sAMAccountName |
Pre-Windows 2000 logon name |
Primary identifier for authentication attacks |
userPrincipalName |
UPN format logon name (user@domain) |
Kerberos TGT requests, may differ from sAMAccountName |
displayName |
Human-readable display name |
Social engineering, information gathering |
mail |
Email address |
Phishing targets, information gathering |
description |
Free-text description field |
CRITICAL: Often contains passwords in OSCP labs |
title |
Job title |
Identify high-value targets (admins, executives) |
department |
Department name |
Map organizational structure |
userAccountControl |
Bitmask of account flags |
Determines account capabilities and vulnerabilities |
pwdLastSet |
Last password change (FILET time) |
Identify stale passwords; 0 = must change at next logon |
lastLogon |
Last login (not replicated) |
Identify active accounts (check each DC) |
lastLogonTimestamp |
Last login (replicated, ~14 day delay) |
Quick active account identification |
servicePrincipalName |
Kerberos SPN(s) |
Kerberoasting targets |
memberOf |
Groups the user belongs to |
Privilege escalation paths |
primaryGroupID |
Primary group RID |
513 = Domain Users, 512 = Domain Admins |
badPasswordTime |
Last bad password attempt |
Detect brute force activity |
lockoutTime |
Account lockout status |
0 = not locked; non-zero = locked out |
UserAccountControl (UAC) Flags
The userAccountControl attribute is a bitmask — each bit represents a different account property. This is one of the most important attributes for OSCP.
| Flag |
Value |
Meaning |
Attack Relevance |
NORMAL_ACCOUNT |
512 |
Standard user account |
Baseline — most accounts have this |
DONT_EXPIRE_PASSWORD |
65536 |
Password never expires |
HIGH-VALUE TARGET — stale credentials, likely weak or reused |
NOT_DELEGATED |
1048576 |
Cannot be delegated |
Blocks delegation-based attacks against this account |
USE_DES_KEY_ONLY |
2097152 |
Forces DES encryption for Kerberos |
Weak encryption — easier to crack captured tickets |
DONT_REQ_PREAUTH |
4194304 |
Kerberos pre-authentication not required |
AS-REP Roasting — capture AS-REP and crack offline |
TRUSTED_FOR_DELEGATION |
524288 |
Unconstrained delegation enabled |
Delegation attack — capture TGTs of users who access this machine |
TRUSTED_TO_AUTH_FOR_DELEGATION |
1073741824 |
Protocol transition (S4U) enabled |
S4U2Self/S4U2Proxy — constrained delegation abuse |
SENSITIVE_ACCOUNT |
524288 |
Protected from delegation |
Defense indicator — this account cannot be delegated |
PASSWORD_NOT_REQUIRED |
32 |
Account can have empty password |
TRIVIAL TO EXPLOIT — empty password authentication |
ACCOUNTDISABLE |
2 |
Account is disabled |
Cannot authenticate, but ACL abuse still possible |
Calculating UAC — Worked Example
Given: UAC = 593920
Step 1: 593920 - 524288 (TRUSTED_FOR_DELEGATION) = 69632
Step 2: 69632 - 65536 (DONT_EXPIRE_PASSWORD) = 4096
Step 3: 4096 - 4096 (DONT_REQ_PREAUTH) = 0
Wait — let me recalculate:
593920 - 524288 = 69632
69632 - 65536 = 4096
4096 is not a standard flag...
Let me try again:
593920 = 512 + 65536 + 524288 + 4096
4096 = SCRIPT flag (logon script)
Result: NORMAL_ACCOUNT (512) + DONT_EXPIRE_PASSWORD (65536) + TRUSTED_FOR_DELEGATION (524288) + SCRIPT (4096)
This account:
✓ Is a normal user account
✓ Has a password that never expires (HIGH VALUE)
✓ Has unconstrained delegation enabled (CRITICAL)
✓ Has a logon script configured
Quick UAC Calculation Reference
Common UAC Values:
512 = Normal account
544 = Normal account + Disabled
514 = Normal account + Homedir req
66048 = Normal account + Password never expires
524800 = Normal account + Unconstrained delegation
593920 = Normal + No expire + Unconstrained delegation
4194304 = Normal + No pre-auth (AS-REP Roasting)
2. Groups
Groups are the primary mechanism for access control in Active Directory. They follow the principle of least privilege through nested membership.
Group Scopes
| Scope |
Can Contain |
Can Be Assigned Permissions On |
Replication |
| Universal |
Users, Global groups, other Universal groups |
Any resource in the entire forest |
Forest-wide (stored in Global Catalog) |
| Domain Local |
Any object type (users, global groups, universal groups, computers) |
Resources in the same domain only |
Domain-only |
| Global |
Users and other Global groups in the same domain |
Resources in the same domain only |
Domain-only |
Group Types
| Type |
Purpose |
Security Identifier |
| Security Group |
Used for access control (NTFS permissions, GPO security filtering) |
Has a SID — can be used in ACLs |
| Distribution Group |
Used for email distribution lists only |
No SID — cannot be used in ACLs |
Best Practice: AGDLP / AGUDLP
AGDLP (Single Domain):
Accounts → Global groups → Domain Local groups → Permissions
AGUDLP (Multi-Domain Forest):
Accounts → Global → Universal → Domain Local → Permissions
Example:
1. Users "alice" and "bob" are added to Global group "Sales_Users"
2. "Sales_Users" is added to Universal group "Sales_Users_Global"
3. "Sales_Users_Global" is added to Domain Local group "Sales_FileServer_Admins"
4. "Sales_FileServer_Admins" is granted Write permission on the file share
High-Value Built-in Groups
These groups are your primary targets during OSCP AD exploitation:
| Group |
SID Suffix |
Privilege |
Attack Relevance |
| Domain Admins |
S-1-5-32-544 |
Full control over the domain |
PRIMARY TARGET — DA = own the domain |
| Enterprise Admins |
S-1-5-32-519 |
Full control over the entire forest |
Forest-wide domination, cross-domain attacks |
| Schema Admins |
S-1-5-32-518 |
Can modify the AD schema |
Add malicious attributes, backdoor the directory |
| Account Operators |
S-1-5-32-548 |
Create/modify users and groups (except DA/EA) |
Create new admin accounts, modify existing users |
| Server Operators |
S-1-5-32-549 |
Manage domain controllers (start/stop services, manage shares) |
Service manipulation, share access |
| Print Operators |
S-1-5-32-550 |
Manage print spooler |
PrintNightmare — remote code execution on DC |
| Backup Operators |
S-1-5-32-551 |
Backup access to all files |
Can backup NTDS.dit, access sensitive files |
| DnsAdmins |
Custom (varies) |
DNS zone and server management |
DCOM privilege escalation — can reload DNS service with malicious DLL |
| Exchange Windows Permissions |
Custom (varies) |
Exchange management permissions |
Can modify Domain Admins group membership |
| RDS Management Servers |
Custom (varies) |
Remote Desktop Services management |
Can modify DA group in some configurations |
| VMware Admins |
Custom (varies) |
VMware vCenter management |
Can modify DA group in some configurations |
Group Enumeration Commands
# All groups
Get-ADGroup -Filter * -Properties *
# Members of a specific group (recursive)
Get-ADGroupMember "Domain Admins" -Recursive
# Groups a user belongs to
Get-ADPrincipalGroupMembership "username"
# High-value group members
$groups = @("Domain Admins", "Enterprise Admins", "Administrators",
"Account Operators", "Server Operators", "Backup Operators",
"DnsAdmins", "Print Operators")
foreach ($g in $groups) {
Write-Host "=== $g ===" -ForegroundColor Cyan
Get-ADGroupMember $g -Recursive | Select-Object Name, ObjectClass
}
# Groups with SID History (potential privilege escalation)
Get-ADGroup -Filter * -Properties sidHistory |
Where-Object { $_.sidHistory -ne $null }
3. Computers
Every domain-joined machine creates a computer object in Active Directory. Computer objects are often overlooked but are critical attack targets.
Computer Object Basics
| Property |
Detail |
| Account Name |
Machine name with $ suffix (e.g., WORKSTATION01$) |
| Password |
Machine account password, auto-rotated every 30 days |
| Default Group |
Member of Domain Computers group |
| Default Rights |
Can authenticate, read AD objects, create up to 10 computer accounts (default ms-DS-MachineAccountQuota) |
| Primary Group |
Domain Computers (RID 515) |
Computer Object Attack Relevance
| Attack |
Requirement |
Description |
| Resource-Based Constrained Delegation (RBCD) |
Write access to computer object (GenericAll/GenericWrite) |
Add your own machine to msDS-AllowedToActOnBehalfOfOtherIdentity, then delegate to the target as any user |
| GPO Abuse |
Computer is in an OU with a vulnerable GPO |
If you control the computer and a GPO with weak ACLs applies to its OU, you can abuse the GPO |
| MS-ESENT / PrinterBug |
Write DACL on computer object |
Use the computer object’s DACL write access to escalate to Domain Admin |
| Shadow Credentials |
Write msDS-KeyCredentialLink |
Add authentication material to the computer account, then authenticate as the computer using Kerberos Kerberos Armored Authentication (KERB) |
| RBCD via SPN |
Control over the computer’s SPN |
Manipulate SPN for Kerberoasting or delegation attacks |
| Local Admin Access |
Computer object controlled by attacker |
If you have local admin on the machine, you can dump credentials, install persistence, and pivot |
Computer Enumeration Commands
# All computers
Get-ADComputer -Filter * -Properties *
# Computers with specific attributes
Get-ADComputer -Filter * -Properties operatingSystem, lastLogonTimestamp, \
servicePrincipalName, msDS-AllowedToActOnBehalfOfOtherIdentity
# Domain Controllers (primaryGroupID = 516 = Domain Controllers group)
Get-ADComputer -Filter {operatingSystem -like "*Server*"} |
Where-Object { $_.primaryGroupID -eq 516 }
# Computers with unconstrained delegation
Get-ADComputer -Filter {userAccountControl -band 524288} -Properties userAccountControl
# RODCs
Get-ADComputer -Filter {isReadOnly -eq $true}
# Check machine account quota (how many computers can a user create?)
Get-ADDefaultDomainPasswordPolicy
Get-ADObject -Identity (Get-ADDomain).DistinguishedName -Properties ms-DS-MachineAccountQuota
4. OUs (Organizational Units)
Organizational Units are containers for organizing objects within a domain. They are NOT security boundaries but are critical for GPO application and delegation.
OU Characteristics
| Property |
Detail |
| Purpose |
Organize objects hierarchically within a domain |
| GPO Linkage |
GPOs are linked to OUs (not to groups) |
| Delegation |
Administrative delegation can be granted at the OU level |
| Security Boundary |
NO — OUs are NOT security boundaries |
| Nesting |
OUs can be nested within other OUs |
Example OU Structure
DC=corp,DC=local
├── OU=Users
│ ├── OU=Sales
│ │ ├── User: john.sales
│ │ └── User: jane.sales
│ └── OU=Engineering
│ ├── User: dev1
│ └── User: dev2
├── OU=Servers
│ ├── OU=DCs
│ │ └── Computer: DC01$
│ └── OU=FileServers
│ └── Computer: FILE01$
└── OU=Workstations
├── Computer: WS01$
└── Computer: WS02$
OU Attack Relevance
| Aspect |
Detail |
| GPO Targeting |
GPOs linked to an OU affect ALL objects in that OU and its child OUs. If you control an object in an OU with a vulnerable GPO, you can exploit that GPO. |
| Delegation |
Admins often delegate OU-level permissions to helpdesk or team leads. These delegated permissions can be abused. |
| ACL Inheritance |
ACLs set on an OU inherit to child objects. A weak ACL on an OU can affect all contained objects. |
| Admin SD Protection |
Protected groups have their ACLs reset every 60 minutes. Moving them to different OUs does not remove protection. |
5. GPOs (Group Policy Objects)
Group Policy Objects are the centralized configuration mechanism for Active Directory. They are one of the most commonly exploited vectors in OSCP labs.
GPO Basics
| Property |
Detail |
| Applied To |
OUs, domains, or sites (NOT groups) |
| Contents |
Group Policy Preferences (GPP) and security settings |
| Storage |
AD database (metadata) + SYSVOL (actual policy files) |
| Processing Order |
SDOU — Site → Domain → OU (last one wins) |
| Refresh Interval |
Every 90 minutes + random offset (30 min for computers) |
GPO Attack Vectors
| Attack Vector |
Description |
Required Access |
| GPP Passwords (cpassword) |
GPP stores passwords as AES-256 encrypted cpassword in XML files. The decryption key is public and hardcoded. |
Read access to SYSVOL (all domain users) |
| Restricted Groups |
GPO can force users into privileged groups (e.g., local Administrators). If you can modify the GPO, you can add yourself. |
Write access to the GPO |
| Preferences Drive Maps |
Mapped drives configured via GPP may contain credentials in XML. |
Read access to SYSVOL |
| Scheduled Tasks |
GPO can create scheduled tasks that run as SYSTEM or high-privilege users. Modify the task to run your payload. |
Write access to the GPO |
| Service Configuration |
GPO can configure services with specific credentials. These credentials may be extractable. |
Write access to the GPO |
| Logon Scripts |
Scripts deployed via GPO may contain hardcoded credentials or API keys. |
Read access to SYSVOL |
| GPO ACL Abuse |
If you have Write access to a GPO, you can modify it to escalate privileges. |
WriteDACL, GenericAll, or GenericWrite on the GPO |
GPO Storage Structure
\\DOMAIN\SYSVOL\DOMAIN\
├── Policies\
│ └── {GPO-GUID}\
│ ├── Machine\
│ │ ├── Preferences\
│ │ │ ├── Groups\
│ │ │ │ └── Groups.xml ← cpassword, restricted groups
│ │ │ ├── ScheduledTasks\
│ │ │ │ └── ScheduledTasks.xml ← scheduled task credentials
│ │ │ ├── Drives\
│ │ │ │ └── Drives.xml ← drive map credentials
│ │ │ └── Services\
│ │ │ └── Services.xml ← service credentials
│ │ └── Registry.pol ← compiled policy settings
│ └── User\
│ └── Preferences\
│ └── (same structure as Machine)
└── Scripts\
└── logon.bat ← logon scripts
OSCP Exam Checklist: AD Objects
Must-Know Facts
Must-Check Attributes (Every User Object)
Get-ADUser -Filter * -Properties \
sAMAccountName, description, servicePrincipalName, \
userAccountControl, pwdLastSet, lastLogonTimestamp, \
passwordNeverExpires, doesNotRequirePreAuth, \
trustedForDelegation, primaryGroupID