AD Enumeration

Initial Active Directory Enumeration

Active Directory Enumeration

Domain Enumeration

Get current domain

PV: Get-Domain
ADM: Get-ADDomain

Get object of another domain

PV: Get-Domain -Domain evilcorp.local
ADM: Get-ADDomain -Identity evilcorp.local

Get domain SID for the current domain

PV: Get-DomainSID
ADM: (Get-ADDomain).DomainSID

Get domain policy for the current domain

PV: Get-DomainPolicyData
ADM: (Get-DomainPolicyData).systemaccess

Get domain policy for another domain

ADM: (Get-DomainPolicyData -domain evilcorp.local).systemaccess

Get domain controllers for current domain

Get domain controllers for another domain

User Enumeration

Get users in current domain

Get list of properties for users in the current domain

Search for a particular string in a user's attributes

Computers

Get list of computers in the current domain

Groups

Get all the groups in the current domain

Get all the members of the Domain Admins group

Get group membership for a user

List all the local groups on a machine (needs administrator privs on non-dc machines)

Get members of the local group "Administrators" on a machine (needs administrator privs on non-dc machines)

Logged On Users

Get actively logged on users on a computer (needs local admin rights on the target)

Get locally logged users on a computer (needs remote registry on the target - enabled by defualt on server OS)

Get the last logged user on a computer (needs administrative rights and remote registry on the target)

Shares

Find shares on hosts in current domain

Find sensitive files on computers in the domain

Get all fileservers of the domain

Group Policy Objects

Get list of GPO in current domain

Get GPOs which use Restricted Groups or groups.xml for interesting users

Get Local Resultant Set of Policy (local machine only)

Get users which are in a local group of a machine using GPO

Get machines where the given user is a member of a specific group

Organizational Units

Get OUs in a domain

Get GPO applied on an OU. Read GPOname from gplink attribute from Get-NetOU

Get computers in a OU

Access Control Model

  • Enables control on the ability of a process to access objects and other resources in active directory based on:

    • Access Tokens (security context of a process - identity and privs of user)

    • Security Descriptors (SID of the owner, Discretionary ACL (DACL) and System ACL (SACL))

Access Control Lists (ACL)

  • List of Access Control Entries (ACE) - ACE corresponds to indivirual permission or audits access.

    • DACL - Defines the permissions trustees (a user or group) have on an object

    • SACL - Logs success and failure audit messages when an object is accessed

  • ACLs are vital to security architecture of AD

Get the ACLs associated with an object

Get the ACLs associated with the specified prefix to be used for search

Enumerate ACLs using AD Module with resolving GUIDs

Search for interesting ACEs

Get the ACLs associated with the specified path

Trusts

  • Relationship between two domains or forests that allows users of one domain or forest to access resources in the other domain or forest

  • Trust can be automatic (parent-child, same forest, etc.) or established (forest, external)

  • Trusted Domain Objects (TDOs) represent the trust relationship in a domain

Direction

  • One-way trust - Unidirectional. Users in the trusted domain can access resources in the trusting domain but the reverse is not true

  • Two-way trust - Bi-directional. Users of both domains can access resources in the other domain

  • Transitive - Can be extended to establish trust relationships with other domains

    • All the defaul intra-forest trust relationships (Tree-root, Parent-Child) between domains within a same forest are transitive two-way trusts

  • Nontransitive - Cannot be extended to other domains in the forest. Can be two-way or one-way

    • This is the default trust (called external trust) between two domains in different forests when forests do not have a trust relationship

Default / Automatic Trusts

  • Parent-child trust

    • Created automatically between the new domain and the domain that precedes it in the namespace hierarchy, whenever a new domain is added in a tree. For example, livecorp.evilcorp.local is a child of evilcorp.local

    • This trust is always two-way transitive

  • Tree-root trust

    • Create automatically whenever a new domain tree is added to a forest root

    • This trust is always two-way transitive

External Trusts

  • Between two domains in different forests when forests do not have a trust relationship

  • Can be one-way or two-way and is nontransitive

Forest Trusts

  • Between forest root domain

  • Cannot be extended to a third forst (no implicit trust)

  • Can be one-way or two-way and transitive or nontransitive

Domain Trust Mapping

Get a list of all domain trusts for the current domain

Forest Mapping

Get all domains in forest

Get all global catalogs for the current forest

Map trusts of a forest (no forest trusts in the lab)

Get all external trusts in forest

Get domains in specified forest

Get domain trust relationships of domains in specified forest

User Hunting

Find all machines on the current domain where the current user has local admin access

  • Queries the DC of the current or provided domain for a list of computers (Get-NetComputer) and then use multi-threaded Invoke-CheckLocalAdminAccess on each machine

  • This can also be done with the help of remote administration tools like WMI and PowerShell remoting. Pretty useful in cases ports (RPC and SMB) used by Find-LocalAdminAccess are blocked

  • See Find-WMILocalAdminAccess.ps1 and Find-PSRemotingLocalAdminAccess.ps1

Find computers where a domain admin (or specified user/group) has sessions

  • Server 2019 and onwards require local administrator privilege to list sessions

  • Queries the DC of the current or provided domain for members of the given group (Domain Admins by default) using Get-DomainGroupMember, gets a list of computers (Get-DomainComputer) and list sessions and logged on users (Get-NetSession/Get-NetLoggedon) from each machine

Find computers where a domain admin session is available and current user has admin access (uses Test-AdminAccess)

Find computers (File Servers and Distributed File servers) where a domain admin session is available

Tools

PowerView

https://github.com/ZeroDayLab/PowerSploit/blob/master/Recon/PowerView.ps1

ActiveDirectory PowerShell Module

https://github.com/samratashok/ADModule

Last updated