BloodHound

repository·main·Indexed 25 days ago

https://github.com/specterops/bloodhound

A graph-based security analysis tool used to map identity and access relationships across environments like Active Directory and Azure. It provides a web interface to visualize complex attack paths and privilege structures. The project includes the BloodHound Community Edition, which can be deployed via Docker Compose, Helm for Kubernetes, or Skaffold, and utilizes a stack consisting of a Web UI, API, PostgreSQL, and Neo4J databases.

Tokens
28.4K
Snippets
51
Records
169
Agent score
85%

What's inside BloodHound

  1. Overview of Graphify workflow

    main

    Graphify is a tool designed to streamline working with graph data through the following workflow:

    1. Ingestion: Ingests user-specified JSON files into a PostgreSQL database.
    2. Analysis: Performs graph analysis on the ingested data.
    3. Output: Produces two graph-ready files:
      • A file representing the raw ingested graph.
      • A file containing the analyzed graph.
  2. Overview of DoodleUi component library

    main

    DoodleUi is the component library implementing the SpecterOps design system. It provides a unified set of components, patterns, and guidelines designed to ensure consistency, accessibility (WCAG), and brand alignment across SpecterOps products.

    Key features include:

    • Pre-built Components: Includes Buttons, checkboxes, inputs, tables, and more.
    • Accessibility: Components are designed to meet WCAG standards out of the box.
    • Development Approach: Components are generated using shadcn to avoid reinventing common UI patterns.
  3. Overview of BloodHound Community Edition

    main

    BloodHound Community Edition (CE) is a monolithic web application designed to reveal hidden relationships across identity and access management systems using graph theory. It is used by both red and blue teams to map complex privilege relationships and discover attack paths.

    Core Architecture:

    • Frontend: Embedded React application using Sigma.js for graph visualization.
    • Backend: Go-based REST API.
    • Databases: Requires PostgreSQL (application database) and Neo4j (graph database).
    • Data Ingestion: Fed by SharpHound and AzureHound data collectors.
    • Analysis Engine: Powered by OpenGraph, supporting analysis across Active Directory, Azure, and other diverse identity platforms.
  4. Overview of the schemagen architecture

    main

    The schemagen tool is organized into two primary components:

    1. generator: The core library responsible for language-specific code generation for all supported languages.
    2. tsgen: A TypeScript code-generation framework written in Go. It implements a subset of TypeScript syntax specifically designed to produce schema types and helper functions. Note that tsgen is not a general-purpose TypeScript generator and does not aim for full TypeScript compatibility.
  5. Overview of bh-playwright-testing

    main

    bh-playwright-testing provides shared Playwright testing utilities for BloodHound UI workspaces. It centralizes common building blocks to ensure consistency across different BloodHound UI test suites.

    Key features include:

    • axe-core fixture and reporting for accessibility testing.
    • Authentication bootstrap helpers.
    • API route stubs (Cypher queries, MFA, Password Reset, API Tokens).
    • Theme matrix helpers.

    Note: This package does not manage Playwright configurations (browsers, reporters), specific application pages/routes, or application-specific environment variables. Consumers are expected to compose these concerns on top of the provided modules.

  6. Manage database migrations with Goose

    main

    BloodHound uses Goose to manage database schema changes via versioned SQL files. Migrations are tracked in the goose_db_version table. Each migration file follows a timestamp-based naming convention (YYYYMMDDHHMMSS_description.sql) and contains two mandatory sections: -- +goose Up for applying changes and -- +goose Down for rolling them back.

    On application startup, the system automatically compares the goose_db_version table against available migration files and applies any pending migrations in the correct order.

  7. Understand BloodHound Branching Strategy

    main

    BloodHound uses a branching strategy designed for short-lived branches and isolated fixes. The repository uses the following branch types:

    • main: The default production-ready branch. Feature branches originate here, and staging branches are merged back here after a successful release.
    • Staging Branches (stage/vX.Y.Z): Short-lived branches used to prepare a Release Candidate (RC). Major/minor staging branches are created from main, while patch staging branches are created from the last production tag.
    • Feature Branches: Used for development and bug fixes. They are named using the issue number and an optional description (e.g., bed-1234-description). They branch from main and should ideally squash commits before merging.
    • Stabilization Branches: Used to fix bugs in a specific release or staged release. They branch from the corresponding staging branch and are merged back into that staging branch.
  8. Understand the BloodHound Enterprise package structure

    main

    The bhce/server repository is organized into a shared core and vertical feature slices. Each feature is a self-contained unit that owns its layers from HTTP to SQL.

    Directory Structure:

    • modules/: Contains the shared dependency container and the module registry.
    • responses/: Shared HTTP response helpers (envelopes, error wrappers).
    • <feature>/: A vertical feature slice containing:
      • <feature>.go: The entry point for registering the feature.
      • appdb/: The persistence layer (SQL via go-sqlbuilder + pgx).
      • handlers/: The HTTP layer (routes, handlers, JSON views).
      • services/: The business-logic layer (domain types and interfaces).
  9. Audit Logging Middleware RFC Overview

    main

    The Audit Logging Middleware proposal (RFC 7) shifts audit logging from the database layer to the HTTP middleware layer. This change ensures that audit coverage is the default behavior for all registered routes, rather than being an opt-in process requiring manual instrumentation at each call site.

    Key objectives include:

    • Coverage by default: Automatically auditing every registered route.
    • Separation of concerns: Moving auditing logic from the database layer to the HTTP layer.
    • Consistent attribution: Centralizing the derivation of Actor, source IP, request ID, and timing using bhctx and IdentityResolver.
    • Bounded table growth: Implementing monthly created_at partitioning for audit_logs to allow for controlled retention via DROP PARTITION.