BloodHound Cheat Sheet
Overview
BloodHound is an open-source tool that uses graph theory to reveal hidden and often unintended relationships within an Active Directory (AD) environment. It helps security professionals identify complex attack paths that would otherwise be impossible to find manually. BloodHound consists of two main components:
- SharpHound: The data collector that gathers information from Active Directory
- BloodHound GUI: The graphical interface that visualizes and analyzes the collected data
Installation
Windows
Neo4j Installation
# Download Neo4j from https://neo4j.com/download/
# Extract the ZIP file
# Open command prompt as administrator
cd C:\path\to\neo4j\bin
neo4j.bat install-service
neo4j.bat start
BloodHound Installation
# Download BloodHound from https://github.com/BloodHoundAD/BloodHound/releases
# Extract the ZIP file
# Run BloodHound.exe
Linux (Kali)
sudo apt update
sudo apt install bloodhound neo4j
# Start Neo4j service
sudo neo4j start
# Launch BloodHound
bloodhound
macOS
# Install Homebrew if not already installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install Neo4j and BloodHound
brew install neo4j bloodhound
# Start Neo4j service
brew services start neo4j
# Launch BloodHound
bloodhound
BloodHound Community Edition (Docker)
# Install BloodHound CLI
curl -L https://github.com/SpecterOps/BloodHound/releases/latest/download/bloodhound-cli-linux-amd64 -o bloodhound-cli
chmod +x bloodhound-cli
sudo mv bloodhound-cli /usr/local/bin/
# Deploy BloodHound CE
bloodhound-cli deploy
Data Collection
SharpHound (Windows Executable)
Basic Collection
# Download SharpHound
Invoke-WebRequest -Uri https://github.com/BloodHoundAD/SharpHound/releases/latest/download/SharpHound.exe -OutFile SharpHound.exe
# Run SharpHound with default collection methods
.\SharpHound.exe --CollectionMethods All
Collection Methods
| メソッド | 説明 |
|---|---|
All | すべてのデータを収集 |
Group | グループのメンバーシップ情報を収集する |
LocalGroup | ローカル管理者情報を収集する |
GPOLocalGroup | GPOを介してローカル管理者情報を収集する |
Session | セッション情報を収集 |
LoggedOn | ログオンしているユーザー情報を収集する |
Trusts | ドメイン信頼情報を収集する |
ACL | ACL情報を収集する |
Container | コンテナ情報を収集 |
RDP | リモートデスクトップユーザーの情報を収集 |
ObjectProps | オブジェクトのプロパティを収集 |
DCOM | DCOM情報を収集する |
SPNTargets | サービスプリンシパル名の情報を収集する |
PSRemote | PowerShell リモート処理の情報を収集する |
Advanced Collection Options
# Collect specific data types
.\SharpHound.exe --CollectionMethods Group,LocalGroup,Session,ACL
# Collect data with stealth options (slower but less noisy)
.\SharpHound.exe --CollectionMethods All --Stealth
# Collect data from specific domain
.\SharpHound.exe --CollectionMethods All --Domain example.com
# Collect data with LDAP filtering
.\SharpHound.exe --CollectionMethods All --LdapFilter "(objectClass=user)"
# Collect data from specific OU
.\SharpHound.exe --CollectionMethods All --SearchBase "OU=Servers,DC=example,DC=com"
# Collect data with specific naming context
.\SharpHound.exe --CollectionMethods All --DomainController dc01.example.com
SharpHound PowerShell Module
Basic Collection
# Import SharpHound module
Import-Module .\SharpHound.ps1
# Run SharpHound with default collection methods
Invoke-BloodHound -CollectionMethod All
Advanced Collection Options
# Collect specific data types
Invoke-BloodHound -CollectionMethod Group,LocalGroup,Session,ACL
# Collect data with stealth options
Invoke-BloodHound -CollectionMethod All -Stealth
# Collect data from specific domain
Invoke-BloodHound -CollectionMethod All -Domain example.com
# Collect data with LDAP filtering
Invoke-BloodHound -CollectionMethod All -LdapFilter "(objectClass=user)"
# Collect data from specific OU
Invoke-BloodHound -CollectionMethod All -SearchBase "OU=Servers,DC=example,DC=com"
BloodHound.py (Linux/macOS)
Installation
pip install bloodhound
Basic Collection
bloodhound-python -u username -p password -d domain.local -ns 10.10.10.10 -c All
Advanced Collection Options
# Collect specific data types
bloodhound-python -u username -p password -d domain.local -ns 10.10.10.10 -c Group,LocalAdmin,Session,ACL
# Collect data with Kerberos authentication
bloodhound-python -u username -p password -d domain.local -ns 10.10.10.10 -c All --kerberos
# Collect data with specific domain controller
bloodhound-python -u username -p password -d domain.local -ns 10.10.10.10 -c All --dns-tcp
# Collect data with LDAP SSL
bloodhound-python -u username -p password -d domain.local -ns 10.10.10.10 -c All --secure
AzureHound (Azure AD)
Installation
# Download AzureHound
Invoke-WebRequest -Uri https://github.com/BloodHoundAD/AzureHound/releases/latest/download/azurehound-windows-amd64.zip -OutFile azurehound.zip
Expand-Archive -Path azurehound.zip -DestinationPath .
Basic Collection
# Authenticate to Azure
Connect-AzAccount
# Run AzureHound
.\azurehound.exe -o azure_data.zip
Using BloodHound
Neo4j Database Connection
- Default URL: bolt://localhost:7687
- Default credentials: neo4j/neo4j (first login requires password change)
Data Import
- Launch BloodHound
- Connect to Neo4j database
- Drag and drop the ZIP file containing SharpHound data
- Wait for import to complete
Pre-Built Queries
BloodHound comes with several pre-built queries accessible from the “Queries” tab:
Finding Privileged Users
- Find all Domain Admins
- Find all Enterprise Admins
- Find Shortest Paths to Domain Admins
- Find Shortest Paths to High Value Targets
Finding Attack Paths
- Find Shortest Paths to Domain Admins
- Find Shortest Paths to High Value Targets
- Find Shortest Paths to Unconstrained Delegation Systems
Finding Vulnerable Configurations
- Find Kerberoastable Users
- Find AS-REP Roastable Users
- Find Computers with Unconstrained Delegation
- Find Computers with Constrained Delegation
- Find Domain Trusts
Custom Cypher Queries
Find Shortest Paths to Domain Admins
MATCH (n:User),(m:Group \\\\{name:'DOMAIN ADMINS@DOMAIN.LOCAL'\\\\}),p=shortestPath((n)-[*1..]->(m)) RETURN p
Find Kerberoastable Users with Path to Domain Admins
MATCH (n:User \\\\{hasspn:true\\\\}),(m:Group \\\\{name:'DOMAIN ADMINS@DOMAIN.LOCAL'\\\\}),p=shortestPath((n)-[*1..]->(m)) RETURN p
Find Computers with Local Admin Rights
MATCH (u:User),(c:Computer),p=(u)-[:AdminTo]->(c) RETURN p
Find Users with DCSync Rights
MATCH (u:User),(d:Domain),p=(u)-[:DCSync]->(d) RETURN p
Find Computers with Constrained Delegation
MATCH (c:Computer \\\\{trustedtoauth:true\\\\}) RETURN c
攻撃手法
Kerberoasting
サービスアカウントのSPNを対象に、オフラインでクラッキングするためのサービスチケットハッシュを抽出します。
Kerberoastableユーザーの検出
MATCH (n:User \\\\{name:'USER@DOMAIN.LOCAL'\\\\}),(m:Group \\\\{name:'DOMAIN ADMINS@DOMAIN.LOCAL'\\\\}),p=shortestPath((n)-[*1..]->(m)) RETURN p
ドメイン管理者へのパスを持つKerberoastableユーザーの検出
MATCH (u:User),(g:Group),p=shortestPath((u)-[*1..]->(g)) WHERE g.highvalue=true RETURN p
AS-REP Roasting
“Kerberosの事前認証を要求しない”設定が有効なユーザーアカウントを対象とします。
AS-REP Roastableユーザーの検出
MATCH (g:Group \\\\{name:'DOMAIN USERS@DOMAIN.LOCAL'\\\\}),(c:Computer),p=(g)-[:AdminTo]->(c) RETURN p
ACLの悪用
アクセス制御リストの誤設定を悪用して、特権を昇格させます。
WriteDaclの権限の検出
MATCH (u:User),(c:Computer),p=(u)-[:CanRDP]->(c) RETURN p
GenericAllの権限の検出
MATCH (u:User \\\\{pwdneverexpires:true\\\\}) RETURN u
制約なし委任
制約なし委任を持つコンピューターを悪用して、ユーザーチケットを盗みます。
制約なし委任を持つコンピューターの検出
MATCH (u:User \\\\{hasspn:true\\\\}) RETURN u
制約付き委任
誤設定された制約付き委任を悪用して、特定のサービスにユーザーを偽装します。
制約付き委任を持つコンピューターの検出
MATCH (n:User \\\\{hasspn:true\\\\}),(m:Group \\\\{name:'DOMAIN ADMINS@DOMAIN.LOCAL'\\\\}),p=shortestPath((n)-[*1..]->(m)) RETURN p
リソースベースの制約付き委任
誤設定されたリソースベースの制約付き委任を悪用して、リソースにアクセスします。
リソースベースの制約付き委任を持つコンピューターの検出
MATCH (u:User \\\\{dontreqpreauth:true\\\\}) RETURN u
DCSync
レプリケーション権限を悪用して、ドメインコントローラーの同期を実行し、パスワードハッシュを抽出します。
DCSync権限を持つユーザーの検出
MATCH (n:User),(m:Group \\\\{name:'DOMAIN ADMINS@DOMAIN.LOCAL'\\\\}),p=(n)-[:WriteDacl]->(m) RETURN p
BloodHoundエッジタイプ
MATCH (n:User),(m:Group \\\\{name:'DOMAIN ADMINS@DOMAIN.LOCAL'\\\\}),p=(n)-[:GenericAll]->(m) RETURN p
運用セキュリティに関する考慮事項
検出リスクの最小化
- ノイズを減らすために パラメーターを使用する
- ネットワーク活動が高いビジネス時間中にデータを収集する
- すべてのデータを一度に収集せず、時間をかけて収集する
- LDAPフィルタリングを使用して収集範囲を制限する
- 機密性の高い環境では、SharpHoundの代わりにBloodHound.pyの使用を検討する
クリーンアップ
- SharpHoundのバイナリと出力ファイルを削除する
- PowerShellの履歴をクリア:
MATCH (c:Computer \\\\{unconstraineddelegation:true\\\\}) RETURN c
MATCH (c:Computer \\\\{trustedtoauth:true\\\\}) RETURN c
- ネオ4jデータベースを分析完了後に削除する
トラブルシューティング
Neo4j接続の問題
- Neo4jサービスが実行中であることを確認:
MATCH (c:Computer)-[:AllowedToAct]->(t:Computer) RETURN c,t
Would you like me to continue with the remaining empty entries or clarify anything about the translations?```cypher MATCH (u:User),(d:Domain),p=(u)-[:DCSync]->(d) RETURN p
## BloodHound Edge Types
| エッジ タイプ | 説明 |
|-----------|-------------|
| MemberOf | ユーザー/グループはグループのメンバーです |
| AdminTo | ユーザー/グループがコンピューターのローカル管理者権限を持っています |
| HasSession | ユーザーはコンピューターでセッションを持っています |
| CanRDP | ユーザーは RDP でコンピューターに接続できます |
| ExecuteDCOM | ユーザーはコンピューターでDCOMを実行できます |
| AllowedToDelegate | コンピュータはサービスに委任することが許可されています |
| AddAllowedToAct | コンピュータは別のプリンシパルに代わって行動できる |
| AllowedToAct | 代理人は、他の代理人に代わって行動することが許可されています |
| Contains | OU/コンテナにオブジェクトが含まれています |
| GpLink | GPO は OU/Domain/Site に リンクされています |
| HasSIDHistory | オブジェクトは別のオブジェクトの SID 履歴を持っています |
| TrustedBy | ドメインは別のドメインによって信頼されています |
| DCSync | ユーザーはDCSync操作を実行する権利を持っています |
| GenericAll | ユーザーはオブジェクトに対して完全な制御権を持っています |
| GenericWrite | ユーザーはオブジェクトの特定のプロパティに書き込むことができます |
| WriteDacl | ユーザーはオブジェクトのセキュリティ記述子を変更できます |
| WriteOwner | ユーザーはオブジェクトの所有権を取得できます |
| AddMember | ユーザーはグループにメンバーを追加できます |
| ForceChangePassword | ユーザーは別のユーザーのパスワードを変更できます |
## Operational Security Considerations
### Minimizing Detection Risk
- Use the `--Stealth` parameter to reduce noise
- Collect data during business hours when network activity is high
- Avoid collecting all data at once; spread collection over time
- Use LDAP filtering to limit the scope of collection
- Consider using BloodHound.py instead of SharpHound in sensitive environments
### Cleaning Up
- Delete SharpHound binaries and output files after use
- Clear PowerShell history: `Clear-History`
- Remove SharpHound module from memory: `Remove-Module SharpHound`
- Delete Neo4j database when analysis is complete
## Troubleshooting
### Common Issues
#### Neo4j Connection Issues
- Ensure Neo4j service is running: `neo4j.bat status` or `systemctl status neo4j`
- bolt URLが正しく使用されているか確認(デフォルト: bolt://localhost:7687)
- 認証情報を確認(デフォルト: neo4j/neo4j)
- ポート7687を別のプロセスが使用していないか確認
#### SharpHoundコレクションの問題
- 十分な権限があることを確認(最低でもドメインユーザー)
- 昇格された権限で実行してみる
- ドメインコントローラーへのネットワーク接続を確認
- LDAP/LDAPSの接続を確認
- ドメインコントローラーを指定してみる
`--DomainController`
#### データインポートの問題
- ZIPファイルに有効なJSONファイルが含まれていることを確認
- Neo4jデータベースに十分なディスク容量があるか確認
- インポート前にデータベースをクリアしてみる:
`MATCH (n) DETACH DELETE n`
- ZIPファイルが破損していないことを確認
## リソース
- [BloodHoundドキュメント](https://bloodhound.readthedocs.io/)
- [BloodHoundのGitHubリポジトリ](https://github.com/BloodHoundAD/BloodHound)
- [SharpHoundのGitHubリポジトリ](https://github.com/BloodHoundAD/SharpHound)
- [BloodHound Community Edition](https://bloodhound.specterops.io/)
- [SpecterOpsブログ](https://posts.specterops.io/)
- [Cypherクエリ言語リファレンス](https://neo4j.com/docs/cypher-manual/current/)