Domain 6Active Directory AttacksCORE

Enumeration from Inside AD

Comprehensive enumeration techniques from inside an Active Directory domain with credentials: user/group/computer/GPO/share/trust enumeration using PowerShell, Impacket, and other tools.

Domain: Domain 6: Active Directory Exploitation•Updated: 2026-09-01
#enumeration#powershell#inside-ad#ldap#impacket#oscp

Enumeration from Inside AD

Once you have domain credentials (even low-privilege) and are domain-joined (or can authenticate), you gain access to a wealth of information. Every domain user has read access to most AD objects by default, making internal enumeration extremely powerful.


1. Scenario Overview

Your Position:
═════════════
┌──────────────────────────────────────────────┐
│  Inside the Domain                            │
│                                               │
│  ┌──────────────┐    ┌──────────────┐        │
│  │  Compromised  │    │  Your Tools  │        │
│  │  Workstation  │───>│  PowerShell  │        │
│  │  (domain-     │    │  Impacket    │        │
│  │   joined)     │    │  BloodHound  │        │
│  │               │    │  PowerView   │        │
│  └──────────────┘    └──────────────┘        │
│                                               │
│  Credentials: DOMAIN\lowpriv_user:password    │
│  Access: LDAP, SMB, RPC, Kerberos             │
└──────────────────────────────────────────────┘

What You Have:
├── Domain credentials (even low-privilege)
├── Domain-joined machine OR ability to authenticate
├── Access to LDAP, SMB, RPC, Kerberos interfaces
└── Read access to most AD objects (default)

What You Can Enumerate:
├── All users and their attributes
├── All groups and memberships
├── All computers and their properties
├── All GPOs and their configurations
├── All shares and their permissions
├── All trust relationships
├── All OUs and their delegation
├── All ACLs and ACEs
└── Password policy

2. User Enumeration

User enumeration is your first priority inside AD. You need to identify high-value targets, Kerberoasting candidates, AS-REP Roasting targets, and accounts with misconfigured properties.

PowerShell Commands

# Get ALL users with ALL attributes
Get-ADUser -Filter * -Properties *

# Get specific attack-relevant attributes
Get-ADUser -Filter * -Properties \
  sAMAccountName, description, servicePrincipalName, \
  pwdLastSet, lastLogonTimestamp, userAccountControl, \
  passwordNeverExpires, doesNotRequirePreAuth, \
  trustedForDelegation, primaryGroupID, displayName, mail

# Users with SPNs (Kerberoasting targets)
Get-ADUser -Filter {servicePrincipalName -ne "$null"} \
  -Properties servicePrincipalName, sAMAccountName, description

# Users without pre-auth (AS-REP Roasting targets)
Get-ADUser -Filter {doesNotRequirePreAuth -eq $true} \
  -Properties sAMAccountName, description, displayName

# Users with password never expires
Get-ADUser -Filter {passwordNeverExpires -eq $true} \
  -Properties sAMAccountName, description, pwdLastSet

# Users with empty passwords
Get-ADUser -Filter {passwordNotRequired -eq $true} \
  -Properties sAMAccountName, description

# Users with unconstrained delegation
Get-ADUser -Filter {trustedForDelegation -eq $true} \
  -Properties sAMAccountName, userAccountControl

# Users who haven't logged in for 90+ days (stale accounts)
$threshold = (Get-Date).AddDays(-90)
Get-ADUser -Filter * -Properties lastLogonTimestamp |
  Where-Object {
    $_.lastLogonTimestamp -eq $null -or
    ([DateTime]::FromFileTime($_.lastLogonTimestamp) -lt $threshold)
  } | Select-Object sAMAccountName, lastLogonTimestamp

# Users with "password" in description
Get-ADUser -Filter * -Properties description |
  Where-Object { $_.description -match "password|pass|pwd|cred" }

# Convert pwdLastSet to readable date
Get-ADUser -Filter * -Properties pwdLastSet |
  Select-Object sAMAccountName,
    @{N='PwdLastSet';E={[DateTime]::FromFileTime($_.pwdLastSet)}}

Impacket Commands

# Get all users
getusers.py -dc-ip DC_IP DOMAIN/user:password@DC_IP

# LDAP search with credentials
ldapsearch -H ldap://DC_IP -D "DOMAIN\\user" -w password \
  -b "DC=domain,DC=com" "(objectClass=user)" \
  sAMAccountName description servicePrincipalName

# Kerberoasting (request TGS tickets)
getUserSPNs.py -request -dc-ip DC_IP DOMAIN/user:password@DC_IP

# AS-REP Roasting
getusers.py -dc-ip DC_IP DOMAIN/ -usersfile asrep_targets.txt

Key Attributes to Check

Attribute Why Check It Attack if Found
description Often contains passwords Direct credential access
servicePrincipalName Kerberoasting target Request TGS, crack offline
doesNotRequirePreAuth AS-REP Roasting target Request AS-REP, crack offline
passwordNeverExpires Stale credentials likely Target for brute force / spraying
trustedForDelegation Unconstrained delegation Capture TGTs from memory
pwdLastSet Stale password detection Old passwords likely reused
userAccountControl Account flags Identify delegation, pre-auth settings

3. Group Enumeration

Group membership is the primary path to privilege escalation in AD.

PowerShell Commands

# Get ALL groups
Get-ADGroup -Filter * -Properties *

# Get members of a specific group (recursive)
Get-ADGroupMember "Domain Admins" -Recursive

# Get groups a specific user belongs to
Get-ADPrincipalGroupMembership "username"

# Get all high-value group members
$groups = @("Domain Admins", "Enterprise Admins", "Administrators",
            "Account Operators", "Server Operators", "Backup Operators",
            "Print Operators", "DnsAdmins", "Exchange Windows Permissions",
            "RDS Management Servers", "VMware Admins")

foreach ($g in $groups) {
    Write-Host "=== $g ===" -ForegroundColor Cyan
    try {
        Get-ADGroupMember $g -Recursive |
          Select-Object Name, ObjectClass, DistinguishedName
    } catch {
        Write-Host "  Group not found or no access" -ForegroundColor Yellow
    }
}

# Groups with SID History (potential privilege escalation)
Get-ADGroup -Filter * -Properties sidHistory |
  Where-Object { $_.sidHistory -ne $null } |
  Select-Object Name, sidHistory

# Find nested group memberships
Get-ADGroup -Filter * -Properties member |
  Where-Object { $_.member -ne $null } |
  ForEach-Object {
      Write-Host "$($_.Name) has $($_.member.Count) members"
  }

High-Value Groups to Check

Group Why It Matters
Domain Admins Full domain control — primary target
Enterprise Admins Full forest control — cross-domain target
Administrators Local admin on all machines (via nesting)
Account Operators Can create/modify users (not DA/EA)
Server Operators Can manage DC services and shares
Backup Operators Can backup NTDS.dit
DnsAdmins DCOM privilege escalation to DA
Print Operators PrintNightmare RCE on DC
Schema Admins Can modify AD schema
Exchange Windows Permissions Can modify DA group

4. Computer Enumeration

Computer objects reveal infrastructure details and delegation targets.

PowerShell Commands

# Get ALL computers
Get-ADComputer -Filter * -Properties *

# Get computers with attack-relevant attributes
Get-ADComputer -Filter * -Properties \
  operatingSystem, lastLogonTimestamp, servicePrincipalName, \
  userAccountControl, msDS-AllowedToActOnBehalfOfOtherIdentity, \
  dnsHostName, whenCreated

# Domain Controllers (primaryGroupID = 516)
Get-ADComputer -Filter * |
  Where-Object { $_.primaryGroupID -eq 516 }

# Computers with unconstrained delegation
Get-ADComputer -Filter {userAccountControl -band 524288} \
  -Properties userAccountControl, dnsHostName

# RODCs (Read-Only Domain Controllers)
Get-ADComputer -Filter {isReadOnly -eq $true}

# Computers with RBCD configured
Get-ADComputer -Filter * -Properties msDS-AllowedToActOnBehalfOfOtherIdentity |
  Where-Object { $_."msDS-AllowedToActOnBehalfOfOtherIdentity" -ne $null }

# Servers (by OS)
Get-ADComputer -Filter {operatingSystem -like "*Server*"} \
  -Properties operatingSystem, dnsHostName

# Workstations
Get-ADComputer -Filter {operatingSystem -like "*Workstation*"} \
  -Properties operatingSystem, dnsHostName

# Computers that haven't logged in for 90+ days
$threshold = (Get-Date).AddDays(-90)
Get-ADComputer -Filter * -Properties lastLogonTimestamp |
  Where-Object {
    $_.lastLogonTimestamp -eq $null -or
    ([DateTime]::FromFileTime($_.lastLogonTimestamp) -lt $threshold)
  } | Select-Object Name, lastLogonTimestamp

# Live computers (ping test)
Get-ADComputer -Filter * |
  Where-Object { Test-Connection $_.Name -Count 1 -Quiet } |
  Select-Object Name

5. GPO Enumeration

GPOs are one of the most common privilege escalation vectors in OSCP labs.

PowerShell Commands

# Get ALL GPOs
Get-GPO -All

# Get GPO report (XML format — most detailed)
Get-GPOReport -Name "GPO_Name" -ReportType XML

# Get GPO report (HTML format — more readable)
Get-GPOReport -Name "GPO_Name" -ReportType HTML

# Get GPOs linked to a specific OU
Get-GPO -All | Where-Object { $_.LinksTo -like "*OU_PATH*" }

# Find GPOs with preferences (potential cpassword credentials)
Get-GPO -All | ForEach-Object {
    $path = "\\$env:USERDNSDOMAIN\SYSVOL\$env:USERDNSDOMAIN\Policies\{\$($_.Id)}"
    if (Test-Path $path) {
        $results = Get-ChildItem $path -Recurse -Filter "*.xml" |
          Select-String "cpassword" -List
        if ($results) {
            Write-Host "[$($_.DisplayName)] Found cpassword in:" -ForegroundColor Red
            $results | ForEach-Object { Write-Host "  $($_.Path)" }
        }
    }
}

# Check who can modify each GPO
Get-GPO -All | ForEach-Object {
    $acl = Get-Acl "GPO:\$($_.DisplayName)"
    $weak = $acl.Access | Where-Object {
        ($_.AccessRights -match "Write|GenericAll|GenericWrite|AllExtendedRights") -and
        ($_.IdentityReference -match "Authenticated Users|Domain Users|Users")
    }
    if ($weak) {
        Write-Host "[$($_.DisplayName)] WEAK ACL:" -ForegroundColor Red
        $weak | Format-Table IdentityReference, AccessRights
    }
}

# Get GPO permissions
Get-GPO -All | ForEach-Object {
    Write-Host "=== $($_.DisplayName) ===" -ForegroundColor Cyan
    Get-GPPermission -Name $_.DisplayName -All
}

6. Share Enumeration

PowerShell Commands

# Enumerate shares on a specific computer
Get-SmbShare -ComputerName TARGET

# Using net commands
net share \\TARGET

# Access a share
net use \\TARGET\SHARE /user:DOMAIN\user password

# List files in a share
dir \\TARGET\SHARE

CrackMapExec / NetExec

# Share enumeration
crackmapexec smb DC_IP -u user -p password --shares

# Share access with file listing
crackmapexec smb DC_IP -u user -p password --shares --share-read

# Check writable shares
crackmapexec smb DC_IP -u user -p password --shares --share-write

7. Trust Enumeration

# All trusts
Get-ADTrust -Filter *

# Trust details
Get-ADTrust -Filter * -Properties TrustDirection, TrustType, TrustAttributes, \
  SourceName, TargetName, TrustPartner

# Using net commands
netdom trust DOMAIN /domainlist

# Using systeminfo
systeminfo | Select-String "Domain", "Logon Server", "Forest"

# Using klist
klist domains

8. OU Enumeration

# All OUs
Get-ADOrganizationalUnit -Filter * -Properties *

# OU with GPO links
Get-ADOrganizationalUnit -Filter * -Properties name, linkedGroupPolicyObjects

# OU ACLs (who can modify?)
Get-ADOrganizationalUnit -Filter * | ForEach-Object {
    $acl = Get-Acl "AD:\$($_.DistinguishedName)"
    $weak = $acl.Access | Where-Object {
        $_.AccessRights -match "Write|GenericAll|GenericWrite|AllExtendedRights"
    }
    if ($weak) {
        Write-Host "[$($_.Name)] Has writable ACLs:" -ForegroundColor Yellow
        $weak | Format-Table IdentityReference, AccessRights
    }
}

9. Password Policy Enumeration

# Domain password policy
Get-ADDefaultDomainPasswordPolicy

# Fine-Grained Password Policies
Get-ADFineGrainedPasswordPolicy

# Password policy applied to a specific user
Get-ADUserResultantPasswordPolicy -Identity "username"

# Using rpcclient
rpcclient -U "user%pass" DC_IP
rpcclient> getdompwinfo

10. Inside Enumeration Checklist

Target Tool/Command Key Information Priority
Users Get-ADUser, ldapsearch SPNs, no-preauth, descriptions, UAC flags P0
Groups Get-ADGroupMember DA/EA membership, nested groups, high-value groups P0
Computers Get-ADComputer Delegation, OS, last logon, RBCD P0
GPOs Get-GPOReport Preferences, ACLs, scripts, cpassword P0
Shares crackmapexec --shares Readable/writable shares, SYSVOL access P1
Trusts Get-ADTrust Trust direction, type, transitivity P1
OUs Get-ADOrganizationalUnit Delegation, GPO links, ACLs P1
ACLs Get-Acl, dsacls ACE permissions, abuse potential P0
Password Policy Get-ADDefaultDomainPasswordPolicy Min length, complexity, lockout P1

OSCP Exam Checklist: Inside Enumeration

Must-Know Commands

  • Get-ADUser -Filter {servicePrincipalName -ne "$null"} → Kerberoasting targets
  • Get-ADUser -Filter {doesNotRequirePreAuth -eq $true} → AS-REP Roasting targets
  • Get-ADUser -Filter {passwordNeverExpires -eq $true} → Stale credential targets
  • Get-ADGroupMember "Domain Admins" -Recursive → DA membership
  • Get-ADComputer -Filter {userAccountControl -band 524288} → Unconstrained delegation
  • Get-GPO -All + check for cpassword → GPP password extraction
  • Get-ADTrust -Filter * → Trust relationships
  • Check description field on ALL users → Often contains passwords

Enumeration Order (OSCP Strategy)

  1. Users — Find Kerberoasting/AS-REP targets, check descriptions
  2. Groups — Identify DA/EA membership, high-value groups
  3. Computers — Find delegation targets, RBCD candidates
  4. GPOs — Find cpassword, weak ACLs, scripts with credentials
  5. ACLs — Find abusable permissions (GenericAll, WriteDACL, etc.)
  6. Trusts — Identify cross-domain attack paths
  7. Shares — Find readable/writable shares, sensitive files