Module 13: Active Directory Enumeration
Abusing Lightweight Directory Access Protocol
Understanding LDAP
LDAP was designed to interact with a directory service, such as Active Directory. It is built upon the client-server model.
LDAP clients send requests called operations to an LDAP server. These are used to authenticated clients or retrieve/modify entries within a directory.

Interacting with LDAP
LDAP is inter-operable with custom applications, which is largely possible due to the inclusion of Active Directory Service Interfaces (ADSI).
PowerShell script to perform LDAP lookup
PowerShell script to execute LDAP as a different user
Enumerating Active Directory with PowerView
PowerView contains dozens of functions that can be used to enumerate Active Directory. They incorporate OS APIs.
Detecting Active Directory Enumeration
Auditing Object Access
To identify malicious enumeration events taking place against AD, we need to implement an audit policy. These are extensions of the built-in Windows logging.
We can display and configure audit policies with the auditpol command line utility.
Listing audit policy categories
Listing audit policy subcategories
Listing audit policy subcategory setting



Object audit security elements
Principal
The identity that is being targeted for auditing
Type
Target success, failure, or both types of events
Access
Types of permissions that can be granted (and tracked)
Inherited From
Designates whether an audit entry was configured at a higher level than the target object, which would recurse down to any sub entries.
Applies To
Designates whether the entry is targeting only the current object, descendant objects, or specific object types

Key information
Subject: Details about the Account that accessed the object.
Object: Details about the object accessed.
Operation: Details about the action taken place.
Baseline Monitoring
Utilize XPath filters to select specific nodes from an XML document. When using the "Filter Current Log" option in Event Viewer, we are essentially building an XPath query that is parsed by the logging engine to provide the requested data.


XPath query for expected access
Running Get-WinEvent with created XPath
Get-WinEvent script with XML parsing
Results from updated Get-WinEvent script
XPath filter to suppress displaying events where the SID matches offsec's SID
Using Honey Tokens
The difference between a honey token and a general honeypot is that a honey token is a collection of different types of objects created throughout the directory. Any traffic destined to these lures should be considered suspect.
Last updated