Cypher Queries for BloodHound
OSCP Relevance: BloodHound is one of the most powerful AD enumeration tools on the exam. Knowing Cypher queries lets you go beyond the built-in UI queries and find attack paths the GUI might miss. You don’t need to memorize every query — but you MUST understand the patterns and know how to adapt them.
Table of Contents
- Cypher Query Language Basics
- Basic Queries
- Advanced Queries
- Query Patterns and Templates
- BloodHound Built-in Queries Reference
- Quick Reference Cheat Sheet
- Common Pitfalls and Tips
1. Cypher Query Language Basics
What is Cypher?
Cypher is a declarative graph query language developed by Neo4j. BloodHound stores all AD relationships as a graph database in Neo4j, and Cypher is how you query that graph.
| Concept | Description | Analogy |
|---|---|---|
| Node | An entity (User, Computer, Group, GPO, Domain) | A person or object |
| Relationship | A directed edge between nodes | “knows”, “owns”, “controls” |
| Property | Key-value data on nodes/relationships | Attributes like name, domain |
| Label | Node type identifier (:User, :Computer) |
Category/tag |
| Path | A sequence of connected nodes and relationships | A chain of connections |
Core Syntax Elements
MATCH — Find patterns in the graph
MATCH (n:User) -- Find all User nodes
MATCH (n:User {name:'jsmith'}) -- Find a specific user
MATCH (n)-[:MemberOf]->(m) -- Find users and their group memberships
RETURN — Specify what to output
RETURN n.name -- Return just the name property
RETURN n -- Return the entire node
RETURN p -- Return an entire path
WHERE — Filter results
WHERE n.name CONTAINS 'admin' -- Case-insensitive substring match
WHERE n.donotrequirepreauth = true -- Boolean property check
WHERE n.serviceprincipalname IS NOT NULL -- Null check
WHERE n.name <> m.name -- Not equal (exclude self-references)
ShortestPath — Find the shortest path between nodes
MATCH p = ShortestPath((start)-[*1..]->(end))
RETURN p
The *1.. means “any relationship type, 1 or more hops, no maximum.”
Node Patterns
(n:User {name:'jsmith@CORP.LOCAL'}) -- Specific user by name
(n:Computer) -- Any computer node
(n:Group {name:'DOMAIN ADMINS@CORP.LOCAL'}) -- Specific group
(n) -- Any node (no label filter)
Critical: BloodHound stores names in the format
NAME@DOMAIN. Always use the full format for precision.
Relationship Patterns
(n)-[:MemberOf]->(m) -- n is a member of m
(n)-[:AdminTo]->(c) -- n has admin rights on computer c
(n)-[:HasSession]->(c) -- n has an active session on c
(n)-[:CanRDP]->(c) -- n can RDP to c
(n)-[:GenericAll]->(m) -- n has GenericAll ACL on m
(n)-[:CanResetPassword]->(m) -- n can reset m's password
Relationship Direction Matters
(n)-[:MemberOf]->(m) -- n IS A MEMBER OF m (correct direction)
(m)<-[:MemberOf]-(n) -- Same thing, just written differently
(n)-[:MemberOf]-(m) -- Directionless (matches either direction) — use with caution
Path Patterns
(n)-[*1..]->(m) -- Any path, any relationships, 1+ hops
(n)-[*1..3]->(m) -- Any path, max 3 hops
(n)-[:MemberOf*1..]->(m) -- Only MemberOf relationships, 1+ hops
(n)-[:AdminTo|HasSession*1..]->(m) -- Only these relationship types
Variable Assignment
MATCH p = ShortestPath(...) -- Assign the path to variable 'p'
RETURN p -- Return the full path visualization
2. Basic Queries
These are the foundational queries every OSCP candidate should know.
2.1 Find All Paths to Domain Admins
What it finds: Every possible attack path from any object to the Domain Admins group.
Match p=ShortestPath((n)-[*1..]->(m:Group {name:'DOMAIN ADMINS@CORP.LOCAL'}))
Return p
| Aspect | Detail |
|---|---|
| Use case | Initial recon — see the full attack surface |
| OSCP value | HIGH — identifies all potential DA paths at once |
| Warning | Can return thousands of results on large domains; consider filtering |
2.2 Find Shortest Path from a Specific User to Domain Admins
What it finds: The minimum-hop path from your current user to DA.
Match p=ShortestPath((n:User {name:'JSMITH@CORP.LOCAL'})-[*1..]->(m:Group {name:'DOMAIN ADMINS@CORP.LOCAL'}))
Return p
| Aspect | Detail |
|---|---|
| Use case | You have a foothold as jsmith — what’s the fastest path to DA? |
| OSCP value | CRITICAL — this is your primary attack planning query |
| Tip | Replace JSMITH@CORP.LOCAL with your actual username |
2.3 Find All Users with Direct DA Membership
What it finds: Users who are directly members of Domain Admins (no nesting).
Match (n:User)-[:MemberOf]->(m:Group {name:'DOMAIN ADMINS@CORP.LOCAL'})
Return n.name
| Aspect | Detail |
|---|---|
| Use case | Identify high-value targets for credential theft |
| OSCP value | HIGH — these are your primary targets |
| Note | This does NOT find nested group memberships |
2.4 Find All Groups That Lead to Domain Admins
What it finds: Any group that has a path to Domain Admins.
Match p=ShortestPath((n:Group)-[*1..]->(m:Group {name:'DOMAIN ADMINS@CORP.LOCAL'}))
Where n.name <> 'DOMAIN ADMINS@CORP.LOCAL'
Return p
2.5 Find All Computers with Admin Sessions
What it finds: Computers where your user has an active session (enables DCSync, Mimikatz, etc.).
Match p=ShortestPath((n:User {name:'JSMITH@CORP.LOCAL'})-[*1..]->(c:Computer))
Return p
3. Advanced Queries
3.1 Users with GenericAll on Any Object
What it finds: Any user/principal that has full control (GenericAll) over another object.
Match (n)-[:GenericAll]->(m)
Where n.name <> m.name
Return n.name, m.name, m.objectclass
| Aspect | Detail |
|---|---|
| What GenericAll means | Full control — can modify anything, reset passwords, add members, change ACLs |
Why n.name <> m.name |
Excludes self-references (an object always has GenericAll on itself) |
| Attack relevance | If you control n, you have complete ownership of m |
| OSCP value | CRITICAL — one of the most common ACL abuse vectors on exams |
| Exploitation | Use Rubeus or PowerView / SharpHound to abuse; reset passwords, add yourself to groups |
Practical exploitation flow:
1. Query finds: LOW_PRIV_USER has GenericAll on ADMIN_GROUP
2. Action: Add your user to ADMIN_GROUP via ACL modification
3. Tool: Add-DomainGroupMember (PowerView) or dsacls.exe
4. Result: Privilege escalation through group membership
3.2 Users Who Can Reset Passwords
What it finds: Users who have the ForceChangePassword or CanResetPassword ACL right on other users.
Match (n:User)-[:CanResetPassword]->(m:User)
Return n.name, m.name
| Aspect | Detail |
|---|---|
| ACL right | ForceChangePassword (AD-Right: 0x00000020) |
| Attack relevance | Reset the target’s password, then log in as them |
| OSCP value | HIGH — common misconfiguration on exams |
| Exploitation | Set-DomainUserPassword -Identity <target> -AccountPassword (ConvertTo-SecureString "P@ssw0rd!" -AsPlainText -Force) |
3.3 Computers with Unconstrained Delegation
What it finds: Computers configured for unconstrained delegation — a goldmine for ticket capture.
Match (n:Computer)-[:AllowedToDelegate]->(m)
Where n.trustedtoauthenticate = false
Return n.name, m.name
Note: The original query uses
pricedaccess = falsewhich appears to be a typo. The correct property istrustedtoauthenticate = false(to filter out constrained delegation). A cleaner version:
Match (n:Computer)
Where n.unconstraineddelegation = true
Return n.name
| Aspect | Detail |
|---|---|
| What unconstrained delegation means | The computer receives TGTs for users who authenticate to services on it |
| Attack relevance | Get a session on this machine → capture TGTs with Mimikatz → impersonate any user (including DA) |
| OSCP value | CRITICAL — classic exam attack path |
| Exploitation | 1. Get admin access to the computer 2. Run Mimikatz sekurlsa::tickets /export 3. Find a DA TGT 4. kerberos::ptt to impersonate |
3.4 All GPOs That Current User Can Modify
What it finds: Group Policy Objects you have write access to — enabling GPO-based persistence and privilege escalation.
Match (n:User {name:'JSMITH@CORP.LOCAL'})-[:GenericAll|GenericWrite|Owns|WriteDACL|WriteOwner]->(g:GPO)
Return g.name
| Aspect | Detail |
|---|---|
| Why GPOs matter | GPOs run with SYSTEM privileges on all linked OUs/computers |
| Attack relevance | Modify GPO → inject a malicious GPO PowerShell preference or scheduled task → get SYSTEM on targeted machines |
| OSCP value | HIGH — GPO abuse is a frequent exam objective |
| Exploitation | Use GPO-Atomic-Tests or manually edit the GPO’s Preferences to add a local admin or scheduled task |
Relationship types explained:
| Relationship | Meaning |
|---|---|
GenericAll |
Full control over the GPO |
GenericWrite |
Can modify GPO properties |
Owns |
You own the GPO object (can change any ACL) |
WriteDACL |
Can modify who has access to the GPO |
WriteOwner |
Can change the GPO’s owner |
3.5 Attack Paths via ACL Abuse
What it finds: The shortest path from your user to Domain Admins using ONLY ACL-based relationships.
Match p=ShortestPath(
(n:User {name:'JSMITH@CORP.LOCAL'})-[:GenericAll|GenericWrite|WriteDACL|WriteOwner|AddMember|ForceChangePassword|CanResetPassword*1..]->
(m:Group {name:'DOMAIN ADMINS@CORP.LOCAL'})
)
Return p
| Aspect | Detail |
|---|---|
| Why this matters | Filters out non-ACL paths, showing only ACL-abuse chains |
| OSCP value | CRITICAL — ACL abuse is one of the most tested AD attack vectors |
| Each relationship type | See table below |
ACL relationship types:
| Relationship | ACL Right | What You Can Do |
|---|---|---|
GenericAll |
Full Control (0x000F01FF) | Everything — modify, delete, change ACLs |
GenericWrite |
Write Properties (0x00020089) | Modify object attributes |
WriteDACL |
DACL Edit (0x00040000) | Modify who has access to the object |
WriteOwner |
Owner Control (0x00010000) | Change the object’s owner |
AddMember |
Add to Group | Add users to a group |
ForceChangePassword |
Reset Password | Force a password change on a user |
CanResetPassword |
Reset Password | Same as above (BloodHound alias) |
3.6 Users with Sessions on Domain Controllers
What it finds: Users who currently have active sessions on DCs — their credentials may be extractable.
Match (n:User)-[:HasSession]->(c:Computer)
Where c.primarygroupname CONTAINS 'DOMAIN CONTROLLERS'
Return n.name, c.name
Alternative (simpler DC detection):
Match (n:User)-[:HasSession]->(c:Computer)
Where c.domain == 'CORP.LOCAL' AND c.name CONTAINS 'DC'
Return n.name, c.name
| Aspect | Detail |
|---|---|
| Attack relevance | If a DA has a session on a DC you control, dump their credentials |
| OSCP value | HIGH — session hijacking is a common exam path |
| Exploitation | 1. Compromise the DC 2. Run Mimikatz to extract credentials from the session 3. Use harvested credentials |
3.7 All Trust Relationships
What it finds: All domain trust relationships in the forest.
Match (n:Domain)-[:TrustedBy]->(m:Domain)
Return n.name, m.name
| Aspect | Detail |
|---|---|
| Direction | n trusts m — users from m can potentially access n |
| Attack relevance | Trusts are lateral movement bridges between domains/forests |
| OSCP value | MEDIUM-HIGH — important in multi-domain labs |
| Trust types to watch | Parent-Child, Forest, External, Realm |
3.8 Shortest Path Across Trusts
What it finds: The shortest attack path from a user in one domain to DA in another domain, crossing trust boundaries.
Match p=ShortestPath(
(n:User {name:'JSMITH@SOURCE.DOMAIN'})-[*1..]->
(m:Group {name:'DOMAIN ADMINS@TARGET.DOMAIN'})
)
Return p
| Aspect | Detail |
|---|---|
| Use case | Multi-domain environments — you’re in a child domain, want root in the parent |
| OSCP value | HIGH for multi-domain labs |
| Key insight | BloodHound automatically follows trust relationships in [*1..] paths |
3.9 Users Who Can RDP to Any Computer
What it finds: Users with Remote Desktop access rights to any machine.
Match (n:User)-[:CanRDP]->(c:Computer)
Return n.name, c.name
| Aspect | Detail |
|---|---|
| ACL source | RemoteDesktop ACL or membership in Remote Desktop Users group |
| Attack relevance | RDP access = potential interactive shell + credential capture |
| OSCP value | MEDIUM — useful for lateral movement planning |
3.10 Computers Where User is Local Admin
What it finds: All computers where your user has local administrator access.
Match (n:User {name:'JSMITH@CORP.LOCAL'})-[:AdminTo]->(c:Computer)
Return c.name
| Aspect | Detail |
|---|---|
| How AdminTo is determined | Direct local admin group membership, or via global/universal groups |
| Attack relevance | Local admin = Mimikatz, credential dumping, service manipulation |
| OSCP value | CRITICAL — your first step after initial foothold |
| Exploitation | Use psexec, winrm, or WMI to access these machines |
3.11 All Objects Owned by a User
What it finds: Every AD object that a specific user owns.
Match (n:User {name:'JSMITH@CORP.LOCAL'})-[:Owns]->(m)
Return m.name, m.objectclass
| Aspect | Detail |
|---|---|
| Why ownership matters | Object owners have implicit GenericAll — they can change any ACL on their objects |
| Attack relevance | If you own a DA’s user object, you can grant yourself GenericAll on it |
| OSCP value | HIGH — ownership abuse is a sneaky but powerful vector |
| Exploitation | Take ownership → modify ACL → reset password or add to privileged groups |
3.12 Users with WriteDACL (Dangerous)
What it finds: Users who can modify the Discretionary ACL on any object.
Match (n)-[:WriteDACL]->(m)
Where n.name <> m.name
Return n.name, m.name, m.objectclass
| Aspect | Detail |
|---|---|
| Why WriteDACL is dangerous | You can grant yourself ANY permission on the target object |
| Attack chain | WriteDACL → Grant yourself GenericAll → Full control |
| OSCP value | CRITICAL — WriteDACL abuse is a favorite exam scenario |
| Exploitation | Set-Acl or dacl.exe to add GenericAll for your user on the target |
3.13 Kerberoasting Targets
What it finds: Users with Service Principal Names (SPNs) set — their TGS tickets can be requested and cracked offline.
Match (n:User)
Where n.serviceprincipalname IS NOT NULL AND n.serviceprincipalname <> []
Return n.name, n.serviceprincipalname
| Aspect | Detail |
|---|---|
| What Kerberoasting is | Request TGS ticket for a service → extract the encrypted part → crack offline with hashcat |
| Why SPN matters | Any user with an SPN can be kerberoasted by any domain user |
| OSCP value | CRITICAL — one of the most reliable AD attacks |
| Exploitation | Rubeus.exe kerberoast /user:<username> /outfile:hashes.txt → hashcat -m 13100 hashes.txt wordlist.txt |
3.14 AS-REP Roasting Targets
What it finds: Users with “Do not require Kerberos preauthentication” enabled.
Match (n:User)
Where n.donotrequirepreauth = true
Return n.name
| Aspect | Detail |
|---|---|
| What AS-REP Roasting is | Request AS-REP without preauth → extract encrypted portion → crack offline |
| Difference from Kerberoasting | Doesn’t require any authentication; targets users, not services |
| OSCP value | CRITICAL — often the easiest first blood in AD labs |
| Exploitation | Rubeus.exe asreproast /format:hashcat /outfile:asrephashes.txt → hashcat -m 18200 asrephashes.txt wordlist.txt |
3.15 LAPS-Enabled Computers with Read Access
What it finds: Users/principals who can read LAPS passwords on specific computers.
Match (n)-[:CanReadLAPSPassword]->(c:Computer)
Return n.name, c.name
| Aspect | Detail |
|---|---|
| What LAPS is | Local Administrator Password Solution — randomizes local admin passwords, stores in AD |
| Attack relevance | If you can read LAPS password → you have local admin on that computer |
| OSCP value | HIGH — LAPS misconfigurations are common exam scenarios |
| Exploitation | Get-DomainObject -Identity <computer> -Properties ms-mcs-admpwd (if you have read access) |
4. Query Patterns and Templates
4.1 Reusable Query Templates
Template 1: Shortest Path from Any Principal to a Target Group
Match p=ShortestPath(
(n:{NODE_TYPE} {name:'{IDENTITY}'})-[*1..]->
(m:Group {name:'{TARGET_GROUP}'})
)
Return p
Substitutions:
{NODE_TYPE}→User,Computer,Group{IDENTITY}→ e.g.,JSMITH@CORP.LOCAL{TARGET_GROUP}→ e.g.,DOMAIN ADMINS@CORP.LOCAL,ENTERPRISE ADMINS@CORP.LOCAL
Template 2: Find All Objects a Principal Can Control
Match (n:{NODE_TYPE} {name:'{IDENTITY}'})-[:GenericAll|GenericWrite|Owns|WriteDACL|WriteOwner]->(m)
Return m.name, m.objectclass, type(n)
Template 3: Find All Principals That Can Control a Target
Match (n)-[:GenericAll|GenericWrite|Owns|WriteDACL|WriteOwner]->(m:{NODE_TYPE} {name:'{TARGET}'})
Where n.name <> m.name
Return n.name, n.objectclass, type(n)
Template 4: Shortest Path with Relationship Filtering
Match p=ShortestPath(
(n:User {name:'{IDENTITY}'})-[:{REL_TYPE1}|{REL_TYPE2}|{REL_TYPE3}*1..]->
(m:Group {name:'{TARGET_GROUP}'})
)
Return p
Template 5: Find All High-Value Targets in a Domain
Match (n:User)
Where n.enabled = true
AND (
n.serviceprincipalname IS NOT NULL AND n.serviceprincipalname <> []
OR n.donotrequirepreauth = true
)
Return n.name, n.serviceprincipalname, n.donotrequirepreauth
4.2 Combining Multiple Relationship Types
Cypher supports OR logic within relationship patterns using |:
-- Any of these ACL relationships
(n)-[:GenericAll|GenericWrite|Owns]->(m)
-- ACL + membership + session relationships
(n)-[:MemberOf|AdminTo|HasSession|CanRDP*1..]->(m)
-- All privilege escalation relationships
(n)-[:GenericAll|GenericWrite|WriteDACL|WriteOwner|AddMember|ForceChangePassword|CanResetPassword|AllowedToDelegate*1..]->(m)
4.3 Adapting Queries for Different Scenarios
| Scenario | Adaptation |
|---|---|
| You compromised a computer | Change User to Computer in the start node: (n:Computer {name:'WORKSTATION01@CORP.LOCAL'}) |
| Target is Enterprise Admins | Change target group: {name:'ENTERPRISE ADMINS@CORP.LOCAL'} |
| Multi-domain attack | Include domain in names: JSMITH@CHILD.CORP.LOCAL → DOMAIN ADMINS@CORP.LOCAL |
| Limit hop count | Change *1.. to *1..4 to limit to 4 hops max |
| Find paths to a specific user | Change target to (m:User {name:'ADMIN@CORP.LOCAL'}) |
| Exclude certain relationships | Use WHERE NOT or filter in the relationship type list |
4.4 Advanced Pattern: Accumulated ACL Abuse Chain
Match p=ShortestPath(
(start:User {name:'JSMITH@CORP.LOCAL'})-[*1..]->(end:Group {name:'DOMAIN ADMINS@CORP.LOCAL'})
)
Where ALL(rel IN relationships(p) WHERE rel IN [
:MemberOf, :AdminTo, :HasSession, :CanRDP,
:GenericAll, :GenericWrite, :WriteDACL, :WriteOwner,
:AddMember, :ForceChangePassword, :CanResetPassword,
:AllowedToDelegate, :CanReadLAPSPassword, :Owns
])
Return p
This ensures every step in the path is an exploitable relationship.
5. BloodHound Built-in Queries Reference
BloodHound ships with pre-built queries accessible from the UI. Here are the most important ones mapped to their Cypher equivalents.
5.1 User Queries
| Built-in Query Name | What It Does | Cypher Equivalent |
|---|---|---|
| Find all groups a user is effectively a part of | Shows all group memberships (direct + nested) | Match p=(n:User {name:'X'})-[:MemberOf*1..]->(m:Group) Return p |
| Find all computers a user has a session on | Active sessions | Match (n:User {name:'X'})-[:HasSession]->(c:Computer) Return c.name |
| Find all computers a user can AdminTo | Local admin access | Match (n:User {name:'X'})-[:AdminTo]->(c:Computer) Return c.name |
| Find all computers a user can RDP to | RDP access | Match (n:User {name:'X'})-[:CanRDP]->(c:Computer) Return c.name |
| Find shortest path to DA from user | Attack planning | Match p=ShortestPath((n:User {name:'X'})-[*1..]->(m:Group {name:'DOMAIN ADMINS@*'})) Return p |
| Find all users who can reset this user’s password | Password reset abuse | Match (n:User)-[:CanResetPassword]->(m:User {name:'X'}) Return n.name |
| Find all objects this user owns | Ownership abuse | Match (n:User {name:'X'})-[:Owns]->(m) Return m.name, m.objectclass |
| Find all GPOs this user can modify | GPO abuse | Match (n:User {name:'X'})-[:GenericAll|GenericWrite|Owns|WriteDACL|WriteOwner]->(g:GPO) Return g.name |
5.2 Computer Queries
| Built-in Query Name | What It Does | Cypher Equivalent |
|---|---|---|
| Find all users with sessions on this computer | Session targets | Match (n:User)-[:HasSession]->(c:Computer {name:'X'}) Return n.name |
| Find all users who are local admins on this computer | Admin targets | Match (n)-[:AdminTo]->(c:Computer {name:'X'}) Return n.name |
| Find shortest path from this computer to DA | Computer-based attack path | Match p=ShortestPath((n:Computer {name:'X'})-[*1..]->(m:Group {name:'DOMAIN ADMINS@*'})) Return p |
| Find all computers this computer can admin | Lateral movement | Match (c:Computer {name:'X'})-[:AdminTo]->(m:Computer) Return m.name |
5.3 Group Queries
| Built-in Query Name | What It Does | Cypher Equivalent |
|---|---|---|
| Find all effective members of a group | Nested membership resolution | Match p=(n)-[:MemberOf*1..]->(m:Group {name:'X'}) Return p |
| Find shortest path from any user to this group | Who can reach this group | Match p=ShortestPath((n:User)-[*1..]->(m:Group {name:'X'})) Return p |
| Find all groups this group is a member of | Group nesting | Match (n:Group {name:'X'})-[:MemberOf*1..]->(m:Group) Return m.name |
5.4 Domain / Forest Queries
| Built-in Query Name | What It Does | Cypher Equivalent |
|---|---|---|
| Find all trust relationships | Trust mapping | Match (n:Domain)-[:TrustedBy]->(m:Domain) Return n.name, m.name |
| Find all domains this domain trusts | Outbound trusts | Match (n:Domain {name:'X'})-[:TrustedBy]->(m:Domain) Return m.name |
| Find shortest path across trusts to target DA | Cross-domain attack | Match p=ShortestPath((n:User {name:'X@SOURCE'})-[*1..]->(m:Group {name:'DOMAIN ADMINS@TARGET'})) Return p |
5.5 Privilege Escalation Queries
| Built-in Query Name | What It Does | Cypher Equivalent |
|---|---|---|
| Find all users with GenericAll on any object | Full control abuse | Match (n)-[:GenericAll]->(m) Where n.name <> m.name Return n.name, m.name, m.objectclass |
| Find all Kerberoasting targets | SPN-based attack | Match (n:User) Where n.serviceprincipalname IS NOT NULL AND n.serviceprincipalname <> [] Return n.name |
| Find all AS-REP Roasting targets | Preauth bypass | Match (n:User) Where n.donotrequirepreauth = true Return n.name |
| Find all computers with unconstrained delegation | Ticket capture | Match (n:Computer) Where n.unconstraineddelegation = true Return n.name |
| Find all LAPS-readable computers | LAPS abuse | Match (n)-[:CanReadLAPSPassword]->(c:Computer) Return n.name, c.name |
| Find all users with WriteDACL | ACL modification | Match (n)-[:WriteDACL]->(m) Where n.name <> m.name Return n.name, m.name |
6. Quick Reference Cheat Sheet
6.1 Most Important Queries for OSCP (Priority Order)
| Priority | Query | When to Use |
|---|---|---|
| P0 | Shortest path from your user to DA | Always — your first BloodHound query |
| P0 | Computers where you are local admin | After initial foothold |
| P0 | AS-REP Roasting targets | Early recon — no auth needed |
| P0 | Kerberoasting targets | Early recon — low hanging fruit |
| P1 | Users with GenericAll / WriteDACL | ACL abuse hunting |
| P1 | Unconstrained delegation computers | Ticket capture planning |
| P1 | GPOs you can modify | GPO-based privesc |
| P1 | Users who can reset passwords | Password reset abuse |
| P2 | LAPS-readable computers | LAPS-specific labs |
| P2 | Trust relationships | Multi-domain labs |
| P2 | Sessions on DCs | Credential harvesting |
6.2 BloodHound Relationship Types Quick Reference
| Relationship | Arrow Direction | Meaning |
|---|---|---|
MemberOf |
User → Group | User is member of group |
AdminTo |
User/Group → Computer | Has local admin on computer |
HasSession |
User → Computer | Active logon session |
CanRDP |
User/Group → Computer | Can Remote Desktop |
GenericAll |
Principal → Object | Full control ACL |
GenericWrite |
Principal → Object | Can write properties |
WriteDACL |
Principal → Object | Can modify ACLs |
WriteOwner |
Principal → Object | Can change ownership |
Owns |
Principal → Object | Is the owner |
CanResetPassword |
User → User | Can reset target’s password |
AddMember |
Principal → Group | Can add members |
AllowedToDelegate |
Computer → Principal | Delegation relationship |
CanReadLAPSPassword |
Principal → Computer | Can read LAPS password |
TrustedBy |
Domain → Domain | Trust relationship |
Contains |
Domain/OU → Object | Container relationship |
GPLink |
GPO → OU | GPO is linked to OU |
6.3 Command-Line Workflow
# Step 1: Collect data with SharpHound
.\SharpHound.exe --CollectionMethods All --Domain corp.local
# Step 1b: Alternative with BloodHound.py (Python)
bloodhound-python -u user -p 'password' -d corp.local -ns 10.0.0.1 -c All
# Step 2: Upload zip to BloodHound UI
# (Open http://localhost:8080, drag and drop the .zip file)
# Step 3: Run Cypher queries in the query bar
# (Click the Cypher query tab in BloodHound)
# Step 4: Right-click results → "Find Shortest Path to" → select target
7. Common Pitfalls and Tips
7.1 Name Format Issues
| Mistake | Correct |
|---|---|
JSMITH |
JSMITH@CORP.LOCAL |
DOMAIN ADMINS |
DOMAIN ADMINS@CORP.LOCAL |
| Mixed case names | BloodHound names are UPPERCASE by default |
Rule: Always use
NAME@DOMAINformat in uppercase.
7.2 Case Sensitivity
-- BloodHound stores names in UPPERCASE
Match (n:User {name:'jsmith@corp.local'}) -- May NOT work
Match (n:User {name:'JSMITH@CORP.LOCAL'}) -- Correct
Match (n:User) Where n.name CONTAINS 'jsmith' -- Works (CONTAINS is case-insensitive)
7.3 Performance Tips
| Tip | Why |
|---|---|
Limit hop count: *1..4 instead of *1.. |
Reduces query time dramatically |
| Filter by node label first | (n:User) is faster than (n) |
Use RETURN n.name instead of RETURN n |
Less data to transfer |
Avoid ShortestPath on very large graphs without filters |
Can timeout; use specific relationship types |
7.4 Query Debugging
-- Step 1: Verify the node exists
Match (n:User {name:'JSMITH@CORP.LOCAL'})
Return n
-- Step 2: Check what relationships exist from this node
Match (n:User {name:'JSMITH@CORP.LOCAL'})-[r]->(m)
Return type(r), m.name
-- Step 3: Build up to the full query
Match p=ShortestPath((n:User {name:'JSMITH@CORP.LOCAL'})-[*1..2]->(m))
Return p
7.5 OSCP Exam Tips
- Always run SharpHound first after gaining any domain-level access
- Upload and query immediately — don’t wait; attack paths reveal themselves fast
- Start with the built-in queries — they cover 80% of what you need
- Use custom Cypher only when built-ins fall short — e.g., specific ACL chains
- The shortest path is not always the easiest — a 2-hop ACL abuse might be harder than a 3-hop Kerberoast path
- Check for AS-REP and Kerberoast targets early — these require zero privileges
- Look for computers you can AdminTo — these are your immediate lateral movement targets
- Don’t ignore GPOs — GPO abuse is a common and reliable exam path
- In multi-domain labs, always check trusts — the path to root often crosses a trust boundary
- Take screenshots of BloodHound paths — useful for your writeup
7.6 BloodHound Collection Methods
| Method | What It Collects | When to Use |
|---|---|---|
All |
Everything | Default — use this on the exam |
DCOnly |
DC-only data (faster) | When you can only reach DCs |
Group,User,LocalAdmin,Session,Trust,ACL,Session,DCOM,RDP,GPOLocalGroup,Container,ObjectProps,LoggedOn |
Specific methods | When bandwidth/time is limited |
# Full collection
.\SharpHound.exe --CollectionMethods All
# Quick collection (essential only)
.\SharpHound.exe --CollectionMethods Group,User,LocalAdmin,Session,Trust,ACL
Summary
| Category | Key Takeaway |
|---|---|
| Cypher Basics | MATCH finds patterns, RETURN outputs results, ShortestPath finds attack chains |
| Node Syntax | (n:Label {property:'value'}) — always use NAME@DOMAIN uppercase |
| Relationship Syntax | (n)-[:REL_TYPE]->(m) — direction matters |
| Path Syntax | [*1..] = any relationship, 1+ hops; [:A|B*1..] = specific types |
| Top Attack Vectors | ACL abuse (GenericAll/WriteDACL), Kerberoasting, AS-REP Roasting, Unconstrained Delegation, GPO abuse, LAPS misconfig |
| Exam Strategy | SharpHound → Upload → Built-in queries → Custom Cypher if needed → Exploit shortest viable path |
**Final exam advice: BloodHound doesn’t find exploits — it finds paths. Your job is to translate a BloodHound path into actual commands. Always verify each step manually before committing to an attack chain.