Hunting for LDAP Enumerations (Bloodhound_Sharphound)
Last updated
Last updated
SharpHound Enumeration:
The attacker runs SharpHound on a compromised system.
It queries LDAP for extensive domain information and generates a ZIP file.
Data Analysis:
The ZIP file is transferred to the attacker’s system.
Loaded into BloodHound, it visualizes domain structure and identifies potential attack paths, including paths to privileged accounts like Domain Admins.
LDAP enumeration is difficult to distinguish from legitimate usage because LDAP queries are integral to Active Directory operations. However, detection becomes feasible by focusing on Event ID 4662 and using CANARY objects.
Key Event to Monitor
Event ID 4662: Logged when LDAP queries access objects in Active Directory.
Indicators of Suspicious LDAP Enumeration:
High Volume of Events in a Short Time:
Hundreds of events with Event ID 4662 from the same user account indicate automated enumeration.
Access to CANARY Objects:
These are fake objects (users, groups, computers) placed in the directory. Any access to these objects should raise immediate alerts.
Below is an example from Event ID 4662 during SharpHound enumeration:
User: cyberjunkie
Object Accessed: dr strange
(CANARY user)
Operation Type: LDAP query.
Analyzing multiple such events:
Timestamps:
Events generated within milliseconds of each other from the same account indicate automation.
Target Objects:
Access to CANARY objects like Test
(fake computer) reinforces suspicion of enumeration.
Use the following filters to detect LDAP enumeration:
Additional Indicators:
Multiple 4662 events in rapid succession for legitimate objects but originating from a single user account.
Deploy CANARY Objects:
Create fake users, groups, and computers with realistic names.
Enable auditing for these objects to detect any access.
Monitor Privileged Accounts:
Limit the use of accounts that can query LDAP extensively.
Restrict permissions for regular users to prevent them from performing extensive LDAP queries.
Prevent Session Enumeration:
Apply Group Policy to limit access to sensitive resources and enforce strong access controls.
Audit and Alert on Suspicious Queries:
Set up alerts for spikes in Event ID 4662.
Focus on patterns of access indicating automated tools.
Educate and Train Admins:
Ensure system administrators understand the risks and do not inadvertently grant unnecessary permissions to service accounts or users.
By carefully monitoring Event ID 4662 and leveraging CANARY objects, defenders can effectively detect LDAP enumeration attacks like those performed using BloodHound. Combining detection strategies with proactive mitigation steps will strengthen Active Directory defenses and limit opportunities for privilege escalation.