BloodHound: How Graph Databases Expose Active Directory Attack Paths
Hook
A single overlooked group membership can create a privilege escalation path spanning fifteen hops from intern to Domain Admin. BloodHound finds these paths in seconds by treating your Active Directory as what it really is: a graph of exploitable trust relationships.
Context
Before BloodHound, penetration testers enumerated Active Directory manually—running PowerView cmdlets, parsing LDAP queries, staring at spreadsheets of group memberships trying to mentally connect privilege dots. You'd discover that User A has WriteDacl on Group B, Group B is nested in Group C, Group C has GenericAll on User D who's in Domain Admins... but only after hours of manual correlation. The problem wasn't collecting data; it was understanding the relationships.
Active Directory is fundamentally a graph: users belong to groups, groups have permissions on computers, computers trust other computers, GPOs link to OUs in complex hierarchies. Traditional relational databases and static reports obscure these connections. SpecterOps released BloodHound in 2016 to reframe AD security assessment as a graph traversal problem. Instead of asking "what permissions does this user have," you ask "what's the shortest path from this compromised user to Domain Admin?" That shift—from enumeration to pathfinding—transformed offensive security. The Community Edition rebuild in Go represents a complete architectural reimagining of the original C# version, moving from a simple Neo4j browser interface to a full-stack platform with REST APIs, job queues, and extensible data ingestion.
Technical Insight
BloodHound's architecture revolves around a design decision that initially seems redundant: running both PostgreSQL and Neo4j in parallel. PostgreSQL handles application state—user accounts, authentication tokens, file uploads, analysis job queues. Neo4j stores the identity graph itself. This separation stems from a core insight: relational databases excel at transactional consistency and CRUD operations, while graph databases excel at pattern matching and traversal queries. Forcing one to do the other's job creates impedance mismatches.
When you upload a SharpHound collection (a JSON export of AD enumeration), the Go backend parses objects and relationships, then bulk-loads them into Neo4j using Cypher queries. Here's a simplified example of how BloodHound represents an AD relationship as a graph edge:
MATCH (u:User {objectid: $userId})
MATCH (g:Group {objectid: $groupId})
MERGE (u)-[r:MemberOf {isacl: false}]->(g)
SET r.lastseen = timestamp()
This Cypher statement creates two nodes (User and Group) if they don't exist, then creates a directed MemberOf edge between them. The isacl property distinguishes explicit ACL-based permissions from implicit group memberships. The real power emerges when you chain these relationships. To find all paths from a compromised user to Domain Admins, BloodHound runs traversal queries:
MATCH p=shortestPath(
(u:User {name: $compromisedUser})-[*1..10]->(g:Group {name: "DOMAIN ADMINS@CONTOSO.LOCAL"})
)
WHERE ALL(r IN relationships(p) WHERE r.isacl = true OR type(r) = 'MemberOf')
RETURN p
This query uses Neo4j's shortestPath algorithm to find the minimum hop count between two nodes, limited to 10 hops maximum (a configurable bound preventing infinite traversal). The WHERE clause filters edges to only include exploitable relationships—ACL-based permissions or group memberships.
The graph schema encodes Active Directory primitives as typed edges: GenericAll, WriteDacl, WriteOwner, ForceChangePassword, AddMember. Each edge type corresponds to a real attack technique. When SharpHound discovers that User A has WriteDacl permission on Group B (via LDAP ACL enumeration), BloodHound creates that edge. Later, when you ask "how can I escalate privileges," the traversal engine connects WriteDacl (can modify permissions) → AddMember (can add self to group) → MemberOf (inherits group privileges) into an attack chain.
The frontend uses Sigma.js for force-directed graph visualization, rendering nodes with WebGL acceleration. But here's a critical implementation detail: the Go backend doesn't stream graph data. It runs the Cypher query, marshals the entire result set into JSON, and sends it as an HTTP response. For complex queries returning thousands of nodes, this creates multi-megabyte payloads that overwhelm browser memory. The codebase includes pagination logic, but fundamentally the architecture assumes queries return manageable result sets:
type PathResult struct {
Nodes []Node `json:"nodes"`
Edges []Edge `json:"edges"`
}
func (s *GraphService) GetAttackPath(start, end string) (PathResult, error) {
query := buildPathQuery(start, end)
result, err := s.neo4j.Run(query)
// Entire result marshaled to JSON at once
return marshallGraphData(result), err
}
Analysis happens in two phases: ingestion-time precomputation and on-demand queries. During ingestion, BloodHound runs batch jobs calculating common attack paths (all paths to Domain Admins, all paths to Enterprise Admins, etc.) and caches results in PostgreSQL. This trades storage for latency—the UI can instantly display precomputed paths without waiting for Neo4j traversal. Custom queries still hit Neo4j directly.
The OpenGraph plugin system is architecturally significant. It defines an interface for custom data sources beyond Active Directory and Azure. Organizations can implement collectors for Okta, AWS IAM, or proprietary systems, as long as they output the standard node/edge JSON schema. BloodHound's traversal engine doesn't care whether an edge represents AD group membership or AWS IAM role assumption—it's just a directed relationship with properties. This abstraction makes BloodHound a general-purpose identity attack path analyzer, not just an AD tool.
Gotcha
BloodHound Community Edition uses Neo4j Community Edition, which prohibits clustering. You're running a single-node graph database. For enterprises with 100,000+ AD objects (large universities, Fortune 500s), this becomes a hard scaling wall. Query performance degrades, RAM requirements balloon past 16GB, and you can't horizontally shard the graph. The commercial BloodHound Enterprise uses Neo4j Enterprise with clustering, but that's not an option for the open-source version.
The snapshot-based analysis model creates operational friction for continuous monitoring. Every time you run SharpHound, you generate a new collection that triggers full re-ingestion and path recomputation. There's no incremental update mechanism—BloodHound can't diff two collections and only process changes. For red teams running occasional assessments, this is fine. For blue teams wanting real-time attack surface monitoring as AD changes daily, it's prohibitively expensive. You'd need to build custom tooling around the ingestion API to handle incremental updates, which defeats the point of using an off-the-shelf tool.
Client-side rendering hits a wall around 5,000 nodes. Despite GPU acceleration, the browser-based force-directed layout algorithm consumes exponential memory. Users end up manually filtering queries ("show me paths less than 5 hops") before visualizing, which defeats the exploration workflow. The architecture assumes queries return human-browsable graphs, not warehouse-scale data.
Verdict
Use BloodHound if you're conducting AD or Azure security assessments where visualizing privilege escalation paths provides immediate value—it's the industry standard for red team engagements and purple team exercises. It excels in mid-size environments (1,000-50,000 objects) where Neo4j's single-node architecture suffices and you need offline analysis from airgapped collector exports. The OpenGraph plugin system makes it valuable for organizations wanting to model custom identity platforms beyond AD. Skip it if you need real-time continuous monitoring (the snapshot model won't work), you're analyzing 100k+ object environments where Neo4j Community Edition won't scale, you require custom attack path logic without Go development skills (traversal rules are hardcoded), or you need multi-tenant RBAC separation (there's none). For those specific scenarios, consider Adalanche for simpler deployment or Purple Knight for compliance-focused AD hardening. But for traditional domain privilege escalation discovery, BloodHound's combination of graph-native architecture and community-contributed attack path queries remains unmatched.