
BloodHound is a powerful and popular security tool designed to analyze and visualize Active Directory (AD) environments. It is used by both attackers and defenders to identify and understand complex relationships and attack paths within AD. The primary goal of BloodHound is to help security professionals discover hidden and often overlooked attack vectors that could be exploited to escalate privileges and move laterally within a network.
BloodHound Collection Methods
BloodHound uses SharpHound to collect data from an Active Directory environment. The collection methods are executed via SharpHound, typically in PowerShell or a command-line environment.
Invoke-BloodHound -CollectionMethod All #Collects all dataInvoke-BloodHound -CollectionMethod Default #Default collection methodsInvoke-BloodHound -CollectionMethod Group #Collects group membershipsInvoke-BloodHound -CollectionMethod LocalGroup #Collects local group membershipsInvoke-BloodHound -CollectionMethod Session #Collects active sessionsInvoke-BloodHound -CollectionMethod Trusts #Collects domain trustsInvoke-BloodHound -CollectionMethod ACL #Collects ACL informationInvoke-BloodHound -CollectionMethod ObjectProps #Collects object propertiesInvoke-BloodHound -CollectionMethod Container #Collects container informationInvoke-BloodHound -CollectionMethod RDP #Collects RDP sessionsInvoke-BloodHound -CollectionMethod DCOM #Collects DCOM object informationInvoke-BloodHound -CollectionMethod PSRemote #Collects PowerShell remoting sessionsSharpHound Collector Options
Invoke-BloodHound -Domain example.com #Specifies the target domainInvoke-BloodHound -LDAPUser username #LDAP username for authenticationInvoke-BloodHound -LDAPPass password #LDAP password for authenticationInvoke-BloodHound -SkipPortScan #Skips the port scanning phaseInvoke-BloodHound -NoSaveCache #Does not save the cache to diskInvoke-BloodHound -Throttle 2000 #Adds a delay (in milliseconds) between each requestInvoke-BloodHound -RandomDelay #Adds a random delay between requests to avoid detectionInvoke-BloodHound -Stealth #Uses stealth collection methods to avoid detectionInvoke-BloodHound -LdapOnly #Collects only LDAP informationInvoke-BloodHound -CSVFolder C:\path\to\folder #Specifies the folder to save CSV filesInvoke-BloodHound -ZipFileName C:\path\to\output.zip #Specifies the name of the output ZIP filePython BloodHound Collection Methods
bloodhound-python -d example.com -u username -p password #Specifies the target domain and credentialsbloodhound-python -dc dc.example.com #Specifies a specific Domain Controller to querybloodhound-python -c All #Collects all data (default)bloodhound-python -c Computers,Users,Groups #Collects specific object types (comma-separated)bloodhound-python -g #Retrieves group membershipsbloodhound-python -acls #Collects ACL (Access Control List) informationbloodhound-python --ldap #Uses LDAP only (no SMB or DCOM)bloodhound-python -ip 10.1.1.1 #Uses a specific Domain Controller by IPbloodhound-python -o output.zip #Specifies the output ZIP filebloodhound-python --disable-pooling #Disables connection pooling for stealthier queriesbloodhound-python --kerberos #Uses Kerberos authentication (TGT required)bloodhound-python --hashes NTLM_HASH #Uses an NTLM hash instead of a plaintext passwordbloodhound-python --json #Outputs results in JSON format instead of ZIPbloodhound-python --zip #Forces ZIP output formatThe combined full command I use is
bloodhound-python -u username -p password -c All --zip -d hacker.com -dc dc.hacker.com -ns 10.1.1.1 -gc dc.hack.com --auth-method ntlmAzureHound
AzureHound is the Azure AD ingestor for BloodHound, used to collect information about Azure AD users, roles, groups, applications, and attack paths.
Install and Import
Install-Module -name Az -AllowClobberInstall-Module -name AzureADPreview -AllowClobberConnect-AzureAD #Enter details on popupConnect-AzAccount #Enter details on popup or select signed in account
Import-Module .\AzureHound.ps1Invoke-AzureHoundAzureHound Commands
Invoke-AzureHound -CollectionMethod All #Collects all available Azure dataInvoke-AzureHound -CollectionMethod Default #Uses default collection methodsInvoke-AzureHound -CollectionMethod Users #Collects all Azure AD usersInvoke-AzureHound -CollectionMethod Groups #Collects Azure AD groupsInvoke-AzureHound -CollectionMethod Roles #Collects Azure AD roles and role assignmentsInvoke-AzureHound -CollectionMethod ServicePrincipals #Collects Azure AD service principalsInvoke-AzureHound -CollectionMethod Applications #Collects Azure AD applicationsInvoke-AzureHound -CollectionMethod Devices #Collects registered Azure AD devicesInvoke-AzureHound -CollectionMethod Subscriptions #Collects Azure subscriptions and permissionsInvoke-AzureHound -CollectionMethod ResourceGroups #Collects Azure resource groupsInvoke-AzureHound -CollectionMethod VMInstances #Collects Azure Virtual Machine instancesInvoke-AzureHound -CollectionMethod KeyVaults #Collects Azure Key Vault informationInvoke-AzureHound -CollectionMethod StorageAccounts #Collects Azure Storage Account permissionsInvoke-AzureHound -CollectionMethod Networks #Collects Azure virtual networks and security groupsInvoke-AzureHound -Tenant example.onmicrosoft.com #Specifies the target Azure AD tenantInvoke-AzureHound -AccessToken YOUR_ACCESS_TOKEN #Uses a provided Azure AD access token for authenticationInvoke-AzureHound -ClientID YOUR_CLIENT_ID #Uses a specific Azure AD client ID for authenticationInvoke-AzureHound -ClientSecret YOUR_CLIENT_SECRET #Uses a client secret for authenticationInvoke-AzureHound -RefreshToken YOUR_REFRESH_TOKEN #Uses a refresh token for authenticationInvoke-AzureHound -NoSaveCache #Does not save the cache to diskInvoke-AzureHound -Throttle 2000 #Adds a delay (in milliseconds) between each requestInvoke-AzureHound -RandomDelay #Adds a random delay between requests to avoid detectionInvoke-AzureHound -Stealth #Uses stealth collection methods to avoid detectionInvoke-AzureHound -OutputDirectory C:\path\to\folder #Specifies the folder to save collected dataInvoke-AzureHound -ZipFileName C:\path\to\output.zip #Specifies the name of the output ZIP fileInvoke-AzureHound -Throttle 5000 -RandomDelay #Slows down queries to evade detectionInvoke-AzureHound -CollectionMethod All -Tenant example.onmicrosoft.com -AccessToken YOUR_ACCESS_TOKEN #Collects all available Azure AD data while authenticating with an access tokenUsing SharpHound in Different Environments
Powershell
Import-Module .\SharpHound.ps1Invoke-BloodHound -CollectionMethod All -Domain example.com -LDAPUser user@example.com -LDAPPass password #Collects all available data while authenticating with an LDAP username and passwordInvoke-BloodHound -CollectionMethod All #Collects all available dataInvoke-BloodHound -CollectionMethod Default #Uses default collection methodsInvoke-BloodHound -CollectionMethod Group #Collects group membershipsInvoke-BloodHound -CollectionMethod LocalGroup #Collects local group membershipsInvoke-BloodHound -CollectionMethod Session #Collects active sessionsInvoke-BloodHound -CollectionMethod Trusts #Collects domain trustsInvoke-BloodHound -CollectionMethod ACL #Collects ACL (Access Control List) informationInvoke-BloodHound -CollectionMethod ObjectProps #Collects object propertiesInvoke-BloodHound -CollectionMethod Container #Collects container informationInvoke-BloodHound -CollectionMethod RDP #Collects RDP session dataInvoke-BloodHound -CollectionMethod DCOM #Collects Distributed COM object dataInvoke-BloodHound -CollectionMethod PSRemote #Collects PowerShell remoting session dataInvoke-BloodHound -Domain example.com #Specifies the target domainInvoke-BloodHound -LDAPUser user@example.com #LDAP username for authenticationInvoke-BloodHound -LDAPPass password #LDAP password for authenticationInvoke-BloodHound -SkipPortScan #Skips the port scanning phaseInvoke-BloodHound -NoSaveCache #Does not save the cache to diskInvoke-BloodHound -Throttle 2000 #Adds a delay (in milliseconds) between each requestInvoke-BloodHound -RandomDelay #Adds a random delay between requests to avoid detectionInvoke-BloodHound -Stealth #Uses stealth collection methods to avoid detectionInvoke-BloodHound -LdapOnly #Collects only LDAP informationInvoke-BloodHound -CSVFolder C:\path\to\folder #Specifies the folder to save CSV filesInvoke-BloodHound -ZipFileName C:\path\to\output.zip #Specifies the name of the output ZIP fileCommand Line (SharpHound.exe)
SharpHound.exe -c All -d example.com -u user@example.com -p password #Collects all available data while authenticating with a username and passwordSharpHound.exe -c All #Collects all available dataSharpHound.exe -c Default #Uses default collection methodsSharpHound.exe -c Computers,Users,Groups #Collects specific object types (comma-separated)SharpHound.exe -c LocalAdmin,Session,Trusts #Collects local admin, session, and trust dataSharpHound.exe -d example.com #Specifies the target domainSharpHound.exe -u user@example.com -p password #Specifies credentials for authenticationSharpHound.exe -u user@example.com --hashes NTLM_HASH #Uses an NTLM hash instead of a plaintext passwordSharpHound.exe -DomainController dc.example.com #Uses a specific Domain ControllerSharpHound.exe -ldaponly #Uses only LDAP queries (stealth mode)SharpHound.exe -acls #Collects ACL (Access Control List) informationSharpHound.exe -Stealth #Uses stealthy collection techniquesSharpHound.exe -Throttle 2000 #Adds a delay (milliseconds) between each requestSharpHound.exe -RandomDelay #Adds a random delay between requestsSharpHound.exe -NoSaveCache #Prevents cache from being saved to diskSharpHound.exe -SkipPortScan #Skips the port scanning phaseSharpHound.exe -JSON #Outputs results in JSON formatSharpHound.exe -ZipFileName C:\path\to\output.zip #Specifies the name of the output ZIP fileSharpHound.exe -OutputDirectory C:\path\to\folder #Specifies the folder to save output filesSharpHound.exe -CollectMethod DCOM,PSRemote,RDP #Collects specific remote access dataBloodHound GUI
BloodHound itself is a graphical interface to visualize the collected data. Once the data is collected using SharpHound, it can be uploaded and analyzed in the BloodHound interface.
Running BloodHound
neo4j console #Starts the Neo4j database orneo4j desktopbloodhound #Launches the BloodHound GUINeo4j Database Management
Starting Neo4j
neo4j consoleStopping Neo4j
neo4j stopChecking Neo4j Status
neo4j statusBloodHound Data Import
Open the BloodHound interface. Use the “Upload Data” button in the GUI to import data collected by SharpHound.
Common Queries in BloodHound
BloodHound provides predefined queries to analyze the data. Here are a few examples:
- Find all Domain Admins
- Find shortest paths to Domain Admins
- Identify users with unconstrained delegation
- Detect computers with local admin rights
- Analyze Kerberos delegation
Custom Queries in BloodHound
#Return all users of a specific groupMATCH (g:Group {name: 'IT USERS@HACKER.COM'})<-[:MemberOf]-(u:User) RETURN u.name AS UserName
#Return users with keyword in descriptionMATCH (u:User) WHERE u.description CONTAINS "pass" return u.name, u.displayname, u.description, u.group
#Gets all owned users in the specified groupMATCH (g:Group {name: 'VPN ACCESS GROUP@HACKER.COM'})<--(u:User) WHERE u.owned = true RETURN u.name AS OwnedUser, u.objectid AS ObjectID, g.name AS GroupName
#Gets all machines that a specific AD group is local Admin toMATCH (g:Group {name: 'DOMAIN USERS@HACKER.COM'})-[:AdminTo]->(c:Computer) RETURN g.name AS GroupName, c.name AS ComputerName
#Find users with empty passwordsMATCH (n:User {enabled: True, passwordnotreqd: True}) RETURN n
#Find users with descriptions and display themMATCH (c:User) WHERE c.description IS NOT NULL RETURN c.name,c.description
#Find computers with descriptions and display themMATCH (c:Computer) WHERE c.description IS NOT NULL RETURN c.name,c.description
#Get all users and their emails from BloodhoundIn neo4j desktop browserMATCH (u:User) RETURN u.nameMATCH (u:User) RETURN u.emaildownload as CSV
#Get all domain admins from BloodhoundIn neo4j desktop browserMATCH (u:User)-[:MemberOf]->(g:Group {name: 'DOMAIN ADMINS@HACKER.LOCAL'})RETURN u.namedownload as CSVAdditional SharpHound Collection Scenarios
SharpHound.exe -c Group -d example.com -u user@example.com -p password #Collecting Group Memberships OnlySharpHound.exe -c Session -d example.com -u user@example.com -p password #Collecting Sessions OnlySharpHound.exe -c All -d example.com -u user@example.com -p password --Stealth #Using Stealth ModeFull SharpHound Command Syntax
SharpHound.exe -c <CollectionMethod> -d <Domain> -u <Username> -p <Password> --SkipPortScan --NoSaveCache --Throttle <Milliseconds> --RandomDelay --Stealth --LdapOnly --CSVFolder <FolderPath> --ZipFileName <ZipFileName>



