Only collect from domains and tenants you own or have written permission to test; SharpHound and AzureHound are widely flagged by security tools. Once BloodHound is installed, open http://localhost:8080/ui/login, upload the SharpHound zip or AzureHound JSON with Quick Upload, and type Cypher queries into Explore > Cypher, which also has the pre-built searches. Names in BloodHound are upper case with the domain on the end, such as DOMAIN [email protected], and the well-known groups are matched by the end of their SID: -512 is Domain Admins, -513 Domain Users and -519 Enterprise Admins. Domain, user and file names are examples, so swap in your own.

Install BloodHound CE #

  • Install BloodHound CE with Docker (from the unpacked BloodHound CLI)Linux, macOS
    ./bloodhound-cli install
  • Install BloodHound CE with Docker (Windows)Windows
    .\bloodhound-cli.exe install
  • Start BloodHound again after a rebootLinux, macOS
    ./bloodhound-cli up
  • Stop BloodHoundLinux, macOS
    ./bloodhound-cli down
  • Show the BloodHound logsLinux, macOS
    ./bloodhound-cli logs
  • Reset the admin passwordLinux, macOS
    ./bloodhound-cli resetpwd
  • Update BloodHound CE to the latest versionLinux, macOS
    ./bloodhound-cli update
  • Find the first admin password after a Docker Compose installLinux, macOS
    docker compose logs bloodhound | grep "Initial Password"
  • Install the Python collector (Kali)Debian, Ubuntu
    sudo apt install bloodhound-ce-python
  • Install the Python collector with pipxLinux, macOS
    pipx install bloodhound-ce

Collect AD data with SharpHound #

  • Collect the default dataWindows
    SharpHound.exe
  • Collect everythingWindows
    SharpHound.exe -c All
  • Collect from the domain controllers only (quieter, no contact with workstations)Windows
    SharpHound.exe --CollectionMethods DCOnly
  • Collect from a named domainWindows
    SharpHound.exe -c All -d contoso.local
  • Collect from every domain in the forestWindows
    SharpHound.exe -c All --searchforest
  • Use a set domain controllerWindows
    SharpHound.exe -c All --domaincontroller dc01.contoso.local
  • Save the zip to a folder with a set nameWindows
    SharpHound.exe -c All --outputdirectory C:\Audit --zipfilename contoso-2026-12.zip
  • Collect every LDAP property, not just the usual onesWindows
    SharpHound.exe -c All --collectallproperties
  • Collect logged-on sessions in a loop (default 2 hours)Windows
    SharpHound.exe --CollectionMethods Session --Loop
  • Loop session collection for 5 hoursWindows
    SharpHound.exe --CollectionMethods Session --Loop --loopduration 05:00:00
  • Run from a machine that isn't domain-joinedWindows
    runas /netonly /user:CONTOSO\auditor cmd.exe
  • Collect with the PowerShell versionWindows
    Invoke-BloodHound -CollectionMethods All -OutputDirectory C:\Audit
  • Collect from a list of computers in a fileWindows
    SharpHound.exe -c All --computerfile computers.txt
  • Skip the domain controllers when collecting from computersWindows
    SharpHound.exe -c All --excludedcs
  • Collect with a different set of AD credentialsWindows
    SharpHound.exe -c All --ldapusername auditor --ldappassword "ChangeMe-2026!"
  • Collect group membership, local admins, sessions and trusts onlyWindows
    SharpHound.exe -c Group,LocalAdmin,Session,Trusts
  • Collect certificate services (AD CS) dataWindows
    SharpHound.exe -c CertServices
  • Show every SharpHound optionWindows
    SharpHound.exe --help

Collect AD data from Linux #

  • Collect everything into a zipLinux, macOS
    bloodhound-ce-python -d contoso.local -u auditor -dc dc01.contoso.local -ns 10.0.0.10 -c All --zip
  • Collect from the domain controller onlyLinux, macOS
    bloodhound-ce-python -d contoso.local -u auditor -dc dc01.contoso.local -ns 10.0.0.10 -c DCOnly --zip
  • Use DNS over TCP when UDP lookups failLinux, macOS
    bloodhound-ce-python -d contoso.local -u auditor -ns 10.0.0.10 --dns-tcp -c All --zip
  • Collect group membership, local admins, sessions and trusts onlyLinux, macOS
    bloodhound-ce-python -d contoso.local -u auditor -ns 10.0.0.10 -c Group,LocalAdmin,Session,Trusts --zip
  • Use more workers to speed up big domainsLinux, macOS
    bloodhound-ce-python -d contoso.local -u auditor -ns 10.0.0.10 -c All -w 20 --zip
  • Sign in with Kerberos (uses your current ticket)Linux, macOS
    bloodhound-ce-python -d contoso.local -u auditor -k -no-pass -dc dc01.contoso.local -ns 10.0.0.10 -c All --zip
  • Show every optionLinux, macOS
    bloodhound-ce-python -h

Collect Entra ID data with AzureHound #

  • Collect everything from a tenant to a fileLinux, macOS, Windows
    azurehound list -u "[email protected]" --tenant "contoso.onmicrosoft.com" -o azurehound.json
  • Collect Entra ID data onlyLinux, macOS, Windows
    azurehound list az-ad -u "[email protected]" --tenant "contoso.onmicrosoft.com" -o entra.json
  • Collect Azure resources onlyLinux, macOS, Windows
    azurehound list az-rm -u "[email protected]" --tenant "contoso.onmicrosoft.com" -o azure-rm.json
  • Collect only app registrationsLinux, macOS, Windows
    azurehound list apps -u "[email protected]" --tenant "contoso.onmicrosoft.com" -o apps.json
  • Reuse your Azure CLI sign-inLinux, macOS
    JWT=$(az account get-access-token --resource https://graph.microsoft.com | jq -r .accessToken) azurehound list --jwt "$JWT" -o azurehound.json
  • Collect as a service principalLinux, macOS, Windows
    azurehound list -a "6b5adee8-0d36-45b6-b393-8f29ae8a8cc8" -s "client-secret-value" --tenant "contoso.onmicrosoft.com" -o azurehound.json
  • Collect only usersLinux, macOS, Windows
    azurehound list users -u "[email protected]" --tenant "contoso.onmicrosoft.com" -o users.json
  • Collect only role assignments in Entra IDLinux, macOS, Windows
    azurehound list roles -u "[email protected]" --tenant "contoso.onmicrosoft.com" -o roles.json
  • List what AzureHound can collectLinux, macOS, Windows
    azurehound list -h

Cypher basics #

  • Show 25 usersBloodHound Cypher
    MATCH (u:User) RETURN u LIMIT 25
  • Find an object by nameBloodHound Cypher
    MATCH (n) WHERE n.name = '[email protected]' RETURN n
  • Find users whose name contains some textBloodHound Cypher
    MATCH (u:User) WHERE u.name CONTAINS 'ADMIN' RETURN u
  • Members of a group, including nested groupsBloodHound Cypher
    MATCH p=(n)-[:MemberOf*1..]->(g:Group) WHERE g.name = 'DOMAIN [email protected]' RETURN p
  • Groups a user belongs to, including nested groupsBloodHound Cypher
    MATCH p=(u:User)-[:MemberOf*1..]->(g:Group) WHERE u.name = '[email protected]' RETURN p
  • Members of Domain Admins (any domain)BloodHound Cypher
    MATCH p=(n)-[:MemberOf*1..]->(g:Group) WHERE g.objectid ENDS WITH '-512' RETURN p
  • Members of Enterprise AdminsBloodHound Cypher
    MATCH p=(n)-[:MemberOf*1..]->(g:Group) WHERE g.objectid ENDS WITH '-519' RETURN p
  • Everything in Tier ZeroBloodHound Cypher
    MATCH (n) WHERE n.system_tags CONTAINS 'admin_tier_0' RETURN n
  • Objects you've marked as ownedBloodHound Cypher
    MATCH (n) WHERE n.system_tags CONTAINS 'owned' RETURN n
  • Domain trustsBloodHound Cypher
    MATCH p=(:Domain)-[]->(:Domain) RETURN p

Attack paths to fix #

  • Shortest paths from any user to Domain AdminsBloodHound Cypher
    MATCH p=shortestPath((u:User)-[*1..]->(g:Group)) WHERE g.objectid ENDS WITH '-512' AND u<>g RETURN p LIMIT 100
  • Shortest paths from one user to Domain AdminsBloodHound Cypher
    MATCH p=shortestPath((u:User)-[*1..]->(g:Group)) WHERE u.name = '[email protected]' AND g.objectid ENDS WITH '-512' RETURN p
  • Shortest paths from owned objects to Domain AdminsBloodHound Cypher
    MATCH p=shortestPath((n)-[*1..]->(g:Group)) WHERE n.system_tags CONTAINS 'owned' AND g.objectid ENDS WITH '-512' AND n<>g RETURN p
  • Shortest paths into Tier ZeroBloodHound Cypher
    MATCH p=shortestPath((n)-[*1..]->(t)) WHERE t.system_tags CONTAINS 'admin_tier_0' AND NOT n.system_tags CONTAINS 'admin_tier_0' AND n<>t RETURN p LIMIT 100
  • Who can DCSync (read every password hash)BloodHound Cypher
    MATCH p=(n)-[:DCSync|GetChangesAll]->(d:Domain) RETURN p
  • Dangerous rights held by Domain UsersBloodHound Cypher
    MATCH p=(g:Group)-[:GenericAll|GenericWrite|Owns|WriteDacl|WriteOwner|ForceChangePassword|AddMember|AllExtendedRights]->(n) WHERE g.objectid ENDS WITH '-513' RETURN p
  • Computers where Domain Users are local adminsBloodHound Cypher
    MATCH p=(g:Group)-[:AdminTo]->(c:Computer) WHERE g.objectid ENDS WITH '-513' RETURN p
  • Computers Domain Users can RDP toBloodHound Cypher
    MATCH p=(g:Group)-[:CanRDP]->(c:Computer) WHERE g.objectid ENDS WITH '-513' RETURN p
  • Domain Admins logged on to computersBloodHound Cypher
    MATCH p=(c:Computer)-[:HasSession]->(u:User)-[:MemberOf*1..]->(g:Group) WHERE g.objectid ENDS WITH '-512' RETURN p
  • Who can change Group Policy linked to domain controllersBloodHound Cypher
    MATCH p=(n)-[:GenericAll|GenericWrite|Owns|WriteDacl|WriteOwner]->(:GPO)-[:GPLink]->(o:OU) WHERE o.name STARTS WITH 'DOMAIN CONTROLLERS' RETURN p
  • Who controls the certificate services (AD CS) objectsBloodHound Cypher
    MATCH p=(n)-[:Owns|WriteOwner|WriteDacl|GenericAll|GenericWrite]->(m) WHERE m.distinguishedname CONTAINS 'PUBLIC KEY SERVICES' AND NOT n.objectid ENDS WITH '-512' AND NOT n.objectid ENDS WITH '-519' AND NOT n.objectid ENDS WITH '-544' RETURN p LIMIT 1000
  • AD CS ESC1 paths (certificate templates that let users pick any name)BloodHound Cypher
    MATCH p=(n)-[:ADCSESC1]->(d:Domain) RETURN p
  • All AD CS escalation paths (ESC1 to ESC13)BloodHound Cypher
    MATCH p=(n)-[:ADCSESC1|ADCSESC3|ADCSESC4|ADCSESC6a|ADCSESC6b|ADCSESC9a|ADCSESC9b|ADCSESC10a|ADCSESC10b|ADCSESC13]->(d:Domain) RETURN p
  • Who can read LAPS passwordsBloodHound Cypher
    MATCH p=(n)-[:ReadLAPSPassword|SyncLAPSPassword]->(c:Computer) RETURN p
  • Who can read gMSA passwordsBloodHound Cypher
    MATCH p=(n)-[:ReadGMSAPassword]->(u:User) RETURN p
  • Who can add shadow credentials (AddKeyCredentialLink)BloodHound Cypher
    MATCH p=(n)-[:AddKeyCredentialLink]->(m) WHERE NOT n.objectid ENDS WITH '-512' AND NOT n.objectid ENDS WITH '-519' RETURN p
  • Resource-based constrained delegation set on computersBloodHound Cypher
    MATCH p=(n)-[:AllowedToAct]->(c:Computer) RETURN p
  • Who can add members to Tier Zero groupsBloodHound Cypher
    MATCH p=(n)-[:AddMember|AddSelf|GenericAll|GenericWrite|WriteDacl|WriteOwner|Owns]->(g:Group) WHERE g.system_tags CONTAINS 'admin_tier_0' AND NOT n.system_tags CONTAINS 'admin_tier_0' RETURN p
  • Who can reset other users' passwordsBloodHound Cypher
    MATCH p=(n)-[:ForceChangePassword]->(u:User {enabled:true}) RETURN p LIMIT 500
  • Where a user is a local adminBloodHound Cypher
    MATCH p=(u:User)-[:MemberOf*0..]->()-[:AdminTo]->(c:Computer) WHERE u.name = '[email protected]' RETURN p
  • Where a user is logged onBloodHound Cypher
    MATCH p=(c:Computer)-[:HasSession]->(u:User) WHERE u.name = '[email protected]' RETURN p

Risky accounts and settings #

  • Kerberoastable users (user accounts with an SPN)BloodHound Cypher
    MATCH (u:User {hasspn:true, enabled:true}) WHERE NOT u.name STARTS WITH 'KRBTGT' RETURN u
  • Kerberoastable users in Domain AdminsBloodHound Cypher
    MATCH p=(u:User {hasspn:true})-[:MemberOf*1..]->(g:Group) WHERE g.objectid ENDS WITH '-512' RETURN p
  • Users without Kerberos pre-authentication (AS-REP roastable)BloodHound Cypher
    MATCH (u:User {dontreqpreauth:true, enabled:true}) RETURN u
  • Computers with unconstrained delegation (DCs have it too)BloodHound Cypher
    MATCH (c:Computer {unconstraineddelegation:true}) RETURN c
  • Users with unconstrained delegationBloodHound Cypher
    MATCH (u:User {unconstraineddelegation:true}) RETURN u
  • Accounts allowed to delegate to other servicesBloodHound Cypher
    MATCH p=(n)-[:AllowedToDelegate]->(c:Computer) RETURN p
  • Enabled users whose password never expiresBloodHound Cypher
    MATCH (u:User {enabled:true, pwdneverexpires:true}) RETURN u
  • Enabled users that don't need a passwordBloodHound Cypher
    MATCH (u:User {enabled:true, passwordnotreqd:true}) RETURN u
  • Admin accounts that can be delegated (not marked sensitive)BloodHound Cypher
    MATCH (u:User {admincount:true, sensitive:false, enabled:true}) RETURN u
  • Computers without LAPSBloodHound Cypher
    MATCH (c:Computer {enabled:true, haslaps:false}) RETURN c
  • Computers on old Windows versionsBloodHound Cypher
    MATCH (c:Computer {enabled:true}) WHERE c.operatingsystem CONTAINS '2008' OR c.operatingsystem CONTAINS '2003' OR c.operatingsystem CONTAINS 'Windows 7' RETURN c
  • Global Administrators in Entra IDBloodHound Cypher
    MATCH p=(n)-[:AZHasRole]->(r:AZRole) WHERE r.name STARTS WITH 'GLOBAL ADMINISTRATOR' RETURN p
  • Shortest paths to Global Administrator in Entra IDBloodHound Cypher
    MATCH p=shortestPath((n)-[*1..]->(r:AZRole)) WHERE r.name STARTS WITH 'GLOBAL ADMINISTRATOR' AND n<>r RETURN p LIMIT 100
  • Service principals with privileged Entra rolesBloodHound Cypher
    MATCH p=(s:AZServicePrincipal)-[:AZHasRole]->(r:AZRole) WHERE r.name STARTS WITH 'GLOBAL ADMINISTRATOR' OR r.name STARTS WITH 'PRIVILEGED ROLE ADMINISTRATOR' RETURN p
  • Owners of app registrationsBloodHound Cypher
    MATCH p=(n)-[:AZOwns]->(a:AZApp) RETURN p
  • Who can add secrets to appsBloodHound Cypher
    MATCH p=(n)-[:AZAddSecret]->(a:AZApp) RETURN p
  • Who can reset Entra ID passwordsBloodHound Cypher
    MATCH p=(n)-[:AZResetPassword]->(u:AZUser) RETURN p LIMIT 500

Fix what you find #

  • Remove someone from Domain Admins (PowerShell)Windows
    Remove-ADGroupMember -Identity "Domain Admins" -Members svc_backup

    Warning: Check what the account still needs first, and keep at least two working admin accounts.

  • Turn Kerberos pre-authentication back on for a userWindows
    Set-ADAccountControl -Identity svc_backup -DoesNotRequirePreAuth $false
  • Remove an SPN from a user accountWindows
    Set-ADUser -Identity svc_backup -ServicePrincipalNames @{Remove='HTTP/app01.contoso.local'}

    Warning: Anything using that SPN for Kerberos will stop working. Move the service to a group managed service account first.

  • Turn off unconstrained delegation on a computerWindows
    Set-ADComputer -Identity APP01 -TrustedForDelegation $false
  • Mark an admin account as sensitive so it can't be delegatedWindows
    Set-ADUser -Identity svc_backup -AccountNotDelegated $true
  • Add an admin account to Protected UsersWindows
    Add-ADGroupMember -Identity "Protected Users" -Members svc_backup

    Warning: Protected Users blocks NTLM, DES/RC4 and delegation for the account. Test with one account first.

  • Make a user change their password at next logonWindows
    Set-ADUser -Identity svc_backup -ChangePasswordAtLogon $true
  • Make a user's password expire normally againWindows
    Set-ADUser -Identity svc_backup -PasswordNeverExpires $false

Spot collectors running #

  • Find SharpHound and BloodHound runs in DefenderKQL
    DeviceProcessEvents | where ProcessCommandLine has_any ("-CollectionMethod", "--CollectionMethods", "Invoke-BloodHound", "SharpHound", "--loopduration") | project Timestamp, DeviceName, AccountName, ProcessCommandLine
  • Find SharpHound zip files written to disk (Defender)KQL
    DeviceFileEvents | where FileName endswith "_BloodHound.zip" or FileName matches regex @"^\d{14}_BloodHound\.zip$" | project Timestamp, DeviceName, FolderPath, InitiatingProcessFileName