Brutus Authentication Testing Tool

repository·main·Indexed 43 days ago

https://github.com/praetorian-inc/brutus

A modern, multi-protocol authentication testing tool written in Go for offensive security professionals. Brutus validates credentials across diverse network services including SSH, RDP, Databases, Web Panels, SMB, LDAP, and more. It features a declarative oracle for account enumeration via `enum custom`, native JSON output for reconnaissance pipeline integration with tools like naabu and nerva, and built-in collections of known insecure SSH bad keys.

Tokens
71.7K
Snippets
193
Records
276
Agent score
51%

What's inside Brutus

  1. Overview of Brutus capabilities

    main

    Brutus is a multi-protocol authentication testing tool written in pure Go. It is designed for efficient credential validation across diverse network services (SSH, RDP, MySQL, PostgreSQL, MSSQL, Oracle, Redis, SMB, LDAP, WinRM, SNMP, HTTP Basic Auth, MQTT, etc.).

    Key Characteristics:

    • Zero Dependencies: Single binary deployment across Linux, Windows, and macOS.
    • Pipeline Integration: Native support for JSON output to integrate with naabu, nerva, nmap, and masscan.
    • Aggressiveness Modes: Use --mode cautious|default|aggressive to tune the balance between coverage and safety.
    • SOCKS5 Support: Route traffic through a proxy using the --proxy flag.
    • Embedded Intelligence: Includes built-in known SSH bad keys (e.g., Vagrant, F5) accessible via the badkeys subcommand.
  2. Brutus CLI Command Index

    main

    Brutus provides a wide range of commands for security testing, enumeration, and auditing. Use the following command index to identify the appropriate tool for your task:

    Credential Testing & Auditing

    • brutus badkeys (aliases: keys, ssh-keys, badkey): Test known weak/compromised SSH keys against targets.
    • brutus creds (aliases: services, defaults, credentials): Test default credentials on non-HTTP services (SSH, databases, SMB, etc.).
    • brutus snmp (alias: community): Test SNMP community strings against targets.
    • brutus web (aliases: http, panels): Audit HTTP/web panel credentials using AI-powered detection or credential lists.
    • brutus logon: Detect Windows logon-screen backdoors (sticky keys and utilman).
    • brutus stickykeys: Detect the Windows sticky-keys (sethc.exe) logon backdoor only.
    • brutus utilman: Detect the Windows utilman (Ease of Access) logon backdoor only.

    Account Enumeration

    • brutus enum: General account enumeration.
    • brutus enum active: Active account-existence enumeration against live oracles & directories.
    • brutus enum active [provider]: Specific active enumeration for providers like github, google, gravatar, kerberos, microsoft365, or teams.
    • brutus enum passive: API-key OSINT/HUMINT sources for employee email/contact discovery (e.g., apollo, dehashed, hunter, linkedin, lusha).
    • brutus enum generate: Generate email addresses or usernames from embedded name lists.

    Specialized Tools

    • brutus enum active teams: Microsoft Teams device-code auth, user enumeration, and tenant posture audit.
    • brutus enum active teams audit: Audit a Microsoft Teams tenant's external posture into graded findings.
  3. Configure a custom oracle spec (YAML)

    main

    An oracle specification is a YAML file that defines how to probe a target. It consists of a request template and a set of match rules.

    Request Template

    The request section defines the HTTP method, URL, headers, and body. It supports placeholders that are substituted per subject:

    • {{email}}: The full subject value.
    • {{username}}: The subject value.
    • {{localpart}}: The part before the @ (e.g., alice from alice@demo.local).
    • {{domain}}: The part after the @ (e.g., demo.local).

    Note: Placeholders are escaped according to body_encoding (json, form, or raw). URL placeholders are automatically URL-escaped.

    Match Rules and Verdicts

    Rules are evaluated in order; the first matching rule determines the verdict. Conditions within a when block are AND-ed together.

    Available when conditions:

    • status: Matches if the response status equals the integer or is in a provided list.
    • body_contains: Matches if the response body contains the specified substring.
    • body_regex: Matches if the response body matches the provided RE2 regex.
    • json_field: Matches if a dot-path value equals or is in a set.
    • header: Matches if a response header is present or equals a value.

    Verdicts:

    • exists: The subject is valid.
    • absent: The subject does not exist.
    • error: The response was ambiguous or no rules matched (use the default key to specify this behavior).
    version: "1"
    oracle:
      name: demo-forgot-password
      request:
        method: POST
        url: "http://localhost:8080/api/forgot-password"
        headers:
          Content-Type: application/json
        body: '{"email":"{{email}}"}'
        body_encoding: json
      match:
        rules:
          - when:
              status: 200
              body_contains: "reset link sent"
            verdict: exists
            confidence: high
          - when:
              status: 404
              body_contains: "No account found"
            verdict: absent
            confidence: high
        default: error
  4. Understand Brutus pipeline input formats

    main

    Brutus is highly flexible and accepts several input formats via stdin:

    1. Nerva JSON: Full JSON objects containing ip, port, protocol, etc.
    2. Nerva URI: URI-scheme lines (e.g., ssh://github.com:22). Brutus extracts the protocol from the scheme.
    3. Bare targets: Strings in ip:port format (e.g., 192.168.1.100:22). These are automatically fingerprinted using Nerva.

    Brutus automatically parses these formats, maps services to protocols, and tests appropriate credentials.

    # Example: Bare targets (auto-fingerprinted with Nerva)
    echo "192.168.1.100:22" | brutus creds
    
    # Example: Nerva URI
    echo "10.0.0.1:22" | nerva | brutus creds
  5. Use `brutus enum passive` for OSINT/HUMINT discovery

    main
    The brutus enum passive command is a parent command used to access various API-based OSINT and HUMINT sources for discovering and enriching employee email and contact information. It requires a specific provider subcommand (e.g., apollo, hunter, lusha, dehashed, or linkedin).
  6. Understand how Brutus generates usernames from wordlists

    main

    Brutus uses frequency-ranked username pairs to generate candidates for account enumeration. The primary source is likely-names.txt.gz, which contains approximately 248k statistically likely first.last username pairs.

    When you run brutus enum generate, the tool applies eight different formatting patterns to these ranked pairs. Because all formats are derived from the same ordered source, the resulting output remains ranked by likelihood and is bounded to a maximum of ~248k entries before deduplication.

    The supported username formats derived from these pairs are:

    • first.last (e.g., john.smith)
    • flast (e.g., jsmith)
    • firstl (e.g., johns)
    • f.last (e.g., j.smith)
    • lastf (e.g., smithj)
    • last.first (e.g., smith.john)
    • lastfirst (e.g., smithjohn)
    • first (e.g., john)
  7. Use service-account wordlists for enumeration

    main
    Brutus includes a service-accounts.txt wordlist containing common service-account names. This list is used by the brutus enum command to provide candidates specifically for service-account enumeration tasks. The file is a plaintext list where each line contains one name, and lines starting with # are treated as comments.
  8. Use Experimental AI for Credential Detection

    main

    The --experimental-ai flag enables automatic credential detection for HTTP services. It uses Claude Vision to identify devices from screenshots and suggests default credentials.

    Requirements:

    • ANTHROPIC_API_KEY (Required): For Claude Vision (device identification + credential suggestions).
    • PERPLEXITY_API_KEY (Optional): For additional web search research.
    • Chrome/Chromium: Required for form-based auth (headless rendering).

    Workflow:

    1. Detection: Probes auth type (Basic vs Form).
    2. Identification: Claude Vision analyzes screenshots/headers to identify the device.
    3. Suggestion: Claude suggests credentials; Perplexity (if configured) searches for more.
    4. Testing: Automatically tests the discovered credentials.
    # Set up API keys
    export ANTHROPIC_API_KEY="your-anthropic-key"
    export PERPLEXITY_API_KEY="your-perplexity-key"
    
    # AI-powered credential testing against HTTP services
    naabu -host 192.168.1.0/24 -p 80,443,8080 -silent | \
      nerva --json | \
      brutus web --experimental-ai
  9. Mass Scan RDP for Backdoors

    main

    The logon subcommand supports mass scanning via pipeline input, target files, or Nmap/Masscan imports. Only RDP services are tested.

    # Scan a /24 for sticky keys and utilman backdoors
    naabu -host 10.0.0.0/24 -p 3389 -silent | \
      nerva --json | \
      brutus logon --json -o rdp-findings.json
    
    # Scan from nmap results
    brutus logon --nmap-file scan.xml --json -o rdp-findings.json
    
    # Scan from targets file
    brutus logon --targets-file rdp-targets.txt --json
    
    # Extract critical findings
    jq 'select(.finding == "[CRITICAL]")' rdp-findings.json
  10. Install Brutus

    main

    Brutus is distributed as a single, zero-dependency binary for Linux, macOS, and Windows. You can also install it using go install if you have a Go environment set up.

    Pre-built Binaries

    Download the appropriate version from the GitHub Releases page.

    Go Install

    go install github.com/praetorian-inc/brutus/cmd/brutus@latest
    # Linux (amd64)
    curl -L https://github.com/praetorian-inc/brutus/releases/latest/download/brutus-linux-amd64.tar.gz | tar xz
    sudo mv brutus /usr/local/bin/
    
    # macOS (Apple Silicon)
    curl -L https://github.com/praetorian-inc/brutus/releases/latest/download/brutus-darwin-arm64.tar.gz | tar xz
    sudo mv brutus /usr/local/bin/
    
    # macOS (Intel)
    curl -L https://github.com/praetorian-inc/brutus/releases/latest/download/brutus-darwin-amd64.tar.gz | tar xz
    sudo mv brutus /usr/local/bin/
  11. Authenticate with Microsoft Teams / Entra ID

    main

    Obtain OAuth2 tokens (access, refresh, and ID tokens) from Microsoft Entra ID (Azure AD) using the device code flow.

    Workflow:

    1. Brutus requests a device code.
    2. A code and URL are displayed.
    3. You enter the code at the provided URL in a browser.
    4. Brutus polls for completion and prints the tokens.

    Note: The default client ID is the Microsoft Teams desktop application (1fec8e78-bce4-4aaf-ab1b-5451cc387264). Use --client-id to use your own Azure app registration.

    # Authenticate against the common endpoint
    brutus enum active teams auth
    
    # Authenticate against a specific tenant (domain or GUID)
    brutus enum active teams auth --tenant contoso.com
    brutus enum active teams auth --tenant 00000000-0000-0000-0000-000000000000
    
    # Request a different resource scope (space-separated)
    brutus enum active teams auth --scope "offline_access https://api.spaces.skype.com/.default"
    
    # Use a custom app registration
    brutus enum active teams auth --client-id 00000000-0000-0000-0000-000000000000
    
    # Capture the full token set as JSONL
    brutus enum active teams auth -o tokens.jsonl
    
    # Capture the full token set as JSON
    brutus enum active teams auth --json
  12. Use the `enum custom` declarative oracle

    main

    The enum custom command allows you to perform account enumeration by defining a declarative YAML specification (an oracle). This oracle maps observable HTTP responses (status codes, body content, headers) to a verdict: exists, absent, or error. This is useful for detecting vulnerabilities where an application's response differs based on whether a user exists.

    To use it, you need a YAML oracle spec and a list of subjects (e.g., emails or usernames) to test.

    ./brutus enum custom \
      -f path/to/oracle.yaml \
      -e subject1,subject2