ShadowHound is a set of PowerShell scripts for Active Directory enumeration without the need for introducing known-malicious binaries like SharpHound. It leverages native PowerShell capabilities to minimize detection risks and offers two methods for data collection:
- ShadowHound-ADM.ps1: Uses the Active Directory module (ADWS).
- ShadowHound-DS.ps1: Utilizes direct LDAP queries via
DirectorySearcher
.
For more details and context, check out the blog post.
- Method: Active Directory module (
Get-ADObject
via ADWS). - Usage Scenario: When the AD module is available and ADWS is accessible.
- Features:
- Handles large domains with
-SplitSearch
,-Recurse
, and-LetterSplitSearch
options. - Enumerates certificates with the
-Certificates
flag.
- Handles large domains with
- Method: Direct LDAP queries using
DirectorySearcher
. - Usage Scenario: Environments where the AD module isn't available or LDAP is preferred.
- Features:
- Enumerates certificates with the
-Certificates
flag. - Supports alternate credentials with the
-Credential
parameter.
- Enumerates certificates with the
# Basic usage
ShadowHound-ADM -OutputFilePath "C:\Results\ldap_output.txt"
# Specify a domain controller and custom LDAP filter
ShadowHound-ADM -Server "dc.domain.local" -OutputFilePath "C:\Results\ldap_output.txt" -LdapFilter "(objectClass=user)"
# Use alternate credentials
$cred = Get-Credential
ShadowHound-ADM -OutputFilePath "C:\Results\ldap_output.txt" -Credential $cred -SearchBase "DC=domain,DC=local"
# Basic usage
ShadowHound-DS -OutputFile "C:\Results\ldap_output.txt"
# Specify a domain controller
ShadowHound-DS -Server "dc.domain.local" -OutputFile "C:\Results\ldap_output.txt"
# Use a custom LDAP filter
ShadowHound-DS -OutputFile "C:\Results\ldap_output.txt" -LdapFilter "(objectClass=computer)"
Both scripts support enumerating certificate-related objects for those juicy ADCS vectors:
# Using ShadowHound-ADM.ps1
ShadowHound-ADM -OutputFilePath "C:\Results\cert_output.txt" -Certificates
# Using ShadowHound-DS.ps1
ShadowHound-DS -OutputFile "C:\Results\cert_output.txt" -Certificates
# Split search across top-level containers with letter splitting
ShadowHound-ADM -OutputFilePath "C:\Results\ldap_output.txt" -SplitSearch -LetterSplitSearch
-SplitSearch
: Splits the search across top-level containers.-Recurse
: Recurses into containers that fail to return results.-LetterSplitSearch
: Further splits searches by the first letter of CN.
If the ldap_output.txt you got using ShadowHound is too large and you want to batch you, you can do so using split_output.py:
# Split ldap_output.txt to 100 chunks which are named split_output_1.txt, split_output_2.txt and so on...
python3 split_output.py -i ldap_output.txt -o split_output -n 100
After collecting data, use BofHound to convert it into BloodHound-compatible JSON files:
python3 bofhound.py -i ldap_output.txt -p All --parser ldapsearch
For large JSON files (>100MB), consider splitting them with tools like ShredHound.
- Yehuda Smirnov
- Twitter: @yudasm_
- BlueSky: @yudasm.bsky.social