Skip to content

Bagre Password Spray Executor

Category: Discovery and Reconnaissance Script: bagre_spray.py Integration: Python SDK (bagre) Faraday Plugin: Raw JSON Website: https://intelx.io/

Description

Validates a set of credentials against the services of an existing Faraday workspace, or against credentials associated with a domain from a configured leak source, and reports every successful authentication as a Faraday vulnerability. Use it to confirm whether previously discovered or leaked credentials are still valid on your targets.

Prerequisites

  • Written authorization to test authentication against the target systems
  • The bagre Python package installed in the agent's environment (bundled with the Faraday Agent Dispatcher image)
  • A Faraday server and workspace with the hosts, services and/or credentials to test (FARADAY_URL, FARADAY_WORKSPACE)
  • Credentials or API access to the configured leak source (Intelligence X or an on-prem ClickHouse leak database), if you want to pull credentials from there instead of the workspace

Configuration

Environment Variables (Setup)

Variable Required Description
BAGRE_SOURCE No Leak source backend to query when not testing workspace credentials: intelx, intelx_leaks or clickhouse (default: intelx)
INTELX_API_KEY No Intelligence X API key, required when using the intelx or intelx_leaks source
INTELX_BASE_URL No Intelligence X API base URL (default: https://free.intelx.io; paid tenants use https://2.intelx.io)
INTELX_BUCKETS No Comma-separated Intelligence X bucket names to search (default: leaks.public.general,leaks.private.general)
INTELX_MAX_FILES No Maximum number of files to read per bucket (default: 100)
CLICKHOUSE_HOST No Host of the on-prem ClickHouse leak database, used only when BAGRE_SOURCE is clickhouse
CLICKHOUSE_PORT No ClickHouse port (default: 9000)
CLICKHOUSE_DATABASE No ClickHouse database name
CLICKHOUSE_USER No ClickHouse username
CLICKHOUSE_PASSWORD No ClickHouse password
FARADAY_URL Yes Faraday server URL used to read the workspace's hosts, services and credentials (e.g., https://faraday.example.com)
FARADAY_USER Yes Faraday username with access to the workspace
FARADAY_PASSWORD Yes Password for FARADAY_USER
FARADAY_WORKSPACE Yes Faraday workspace to read targets from and to report results to
BAGRE_PASSWORD_SPRAY_MAX_ATTEMPTS_PER_USER No Maximum number of authentication attempts per username (default: 3)
BAGRE_PASSWORD_SPRAY_DELAY_MS No Delay in milliseconds between authentication attempts (default: 1000)
BAGRE_PASSWORD_SPRAY_TIMEOUT_S No Network timeout per attempt, in seconds (default: 10)
BAGRE_PASSWORD_SPRAY_MAX_TOTAL_ATTEMPTS No Maximum total authentication attempts for the whole run (default: 1000)
BAGRE_PASSWORD_SPRAY_CONCURRENCY No Number of authentication attempts to run in parallel (default: 5)
BAGRE_PASSWORD_SPRAY_EXCLUDE_USERS No Comma-separated usernames that are never tested (default: admin,administrator,root)
BAGRE_PASSWORD_SPRAY_DRY_RUN No Set to true to log the planned attempts without making them (default: false)

These variables are also accepted as execution arguments, so a single run can override them.

Execution Arguments

Parameter Type Mandatory Description
TARGET_DOMAIN string Yes Apex domain whose leaked or stored credentials will be tested against the Faraday workspace's assets (e.g., example.com)
TARGET_SUBDOMAIN string No Restrict the credential source to one subdomain (e.g., apps.example.com)
PROTOCOLS list No Protocols to test: ssh, http, https, ftp, smb, smtp, imap, pop3. Default: all of them.
LIMIT integer No Maximum number of credentials to fetch before testing (default: 500, from BAGRE_PASSWORD_SPRAY_MAX_CREDENTIALS)

YAML Configuration Example

executors:
  bagre_spray:
    repo_executor: bagre_spray.py
    max_size: 65536
    varenvs:
      BAGRE_SOURCE: "intelx"
      INTELX_API_KEY: "<intelx_api_key>"
      INTELX_BASE_URL: "https://free.intelx.io"
      INTELX_BUCKETS: "leaks.public.general,leaks.private.general"
      INTELX_MAX_FILES: "100"
      CLICKHOUSE_HOST: "<clickhouse_host>"
      CLICKHOUSE_PORT: "9000"
      CLICKHOUSE_DATABASE: "<clickhouse_database>"
      CLICKHOUSE_USER: "<clickhouse_user>"
      CLICKHOUSE_PASSWORD: "<clickhouse_password>"
      FARADAY_URL: "https://faraday.example.com"
      FARADAY_USER: "<faraday_user>"
      FARADAY_PASSWORD: "<faraday_password>"
      FARADAY_WORKSPACE: "<faraday_workspace>"
      BAGRE_PASSWORD_SPRAY_MAX_ATTEMPTS_PER_USER: "3"
      BAGRE_PASSWORD_SPRAY_DELAY_MS: "1000"
      BAGRE_PASSWORD_SPRAY_TIMEOUT_S: "10"
      BAGRE_PASSWORD_SPRAY_MAX_TOTAL_ATTEMPTS: "1000"
      BAGRE_PASSWORD_SPRAY_CONCURRENCY: "5"
      BAGRE_PASSWORD_SPRAY_EXCLUDE_USERS: "admin,administrator,root"
      BAGRE_PASSWORD_SPRAY_DRY_RUN: "false"
    params:
      TARGET_DOMAIN:
        mandatory: true
        type: string
        base: string
      TARGET_SUBDOMAIN:
        mandatory: false
        type: string
        base: string
      PROTOCOLS:
        mandatory: false
        type: list
        base: list
      LIMIT:
        mandatory: false
        type: integer
        base: integer

How It Works

  1. Authenticates to the Faraday workspace given in FARADAY_URL / FARADAY_WORKSPACE
  2. Gets a set of credentials to test: by default, the credentials already stored in that workspace; alternatively (BAGRE_PASSWORD_SPRAY_SOURCE=intelx or clickhouse), credentials associated with TARGET_DOMAIN from the configured leak source. Credentials are restricted to hosts under TARGET_DOMAIN (and TARGET_SUBDOMAIN when set).
  3. Builds a list of authentication attempts by pairing each credential with a matching service already discovered in the workspace (or, if the workspace has no scanned services, with the credential's own source URL)
  4. Runs the authentication attempts against the target services using the protocol validators (SSH, HTTP/HTTPS basic or form login, FTP, SMB, SMTP, IMAP, POP3), following the limits in the Password-Spray Policy variables
  5. Creates one Faraday vulnerability, severity critical, for every attempt that authenticates successfully, with the credential, protocol, host and run statistics in its description

Notes

  • You must be authorized to test authentication against the target systems before running this executor.
  • The credential's password is only ever shown truncated (password_preview) in the generated vulnerability; it is never written out in full.
  • BAGRE_PASSWORD_SPRAY_DRY_RUN=true logs the attempts that would be made without performing them, useful to validate the scope first.
  • BAGRE_PASSWORD_SPRAY_MAX_ATTEMPTS_PER_USER, BAGRE_PASSWORD_SPRAY_MAX_TOTAL_ATTEMPTS, BAGRE_PASSWORD_SPRAY_DELAY_MS and BAGRE_PASSWORD_SPRAY_CONCURRENCY bound how many authentication attempts are made and how fast, to stay under account lockout thresholds.
  • Accounts in BAGRE_PASSWORD_SPRAY_EXCLUDE_USERS (default: admin, administrator, root) are never tested.
  • Hosts without a successful authentication are not imported; only validated credentials are reported.
  • If the bagre package is not installed, or the Faraday connection cannot be established, the executor exits without error and imports nothing.
  • The shared agent parameters (AGENT_CONFIG_* tags and severity filters) are not applied by this executor.