GitHub Activity from Credential Scanner User Agent

edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.

GitHub Activity from Credential Scanner User Agent

edit

Identifies GitHub audit activity from a user agent associated with credential-scanning and secret-harvesting tooling such as TruffleHog or Nord Stream. These tools walk repository contents and API routes to locate hardcoded secrets, tokens, deploy keys, and other credentials. Legitimate users rarely drive GitHub API traffic with these user agents, so a match is a strong signal that an adversary or an unsanctioned scan is mining the organization for exposed credentials, frequently as a precursor to credential access and data collection from code repositories.

Rule type: esql

Rule indices: None

Severity: medium

Risk score: 47

Runs every: 5m

Searches indices from: now-9m (Date Math format, see also Additional look-back time)

Maximum alerts per execution: 100

References:

Tags:

  • Domain: Cloud
  • Domain: SaaS
  • Platform: GitHub
  • Use Case: Threat Detection
  • Tactic: Collection
  • Tactic: Credential Access
  • Tactic: Discovery
  • Data Source: Github
  • Data Source: GitHub Audit Logs
  • Rule Type: ES|QL
  • Resources: Investigation Guide

Version: 1

Rule authors:

  • Elastic

Rule license: Elastic License v2

Investigation guide

edit

Triage and analysis

Disclaimer: This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.

Investigating GitHub Activity from Credential Scanner User Agent

TruffleHog, Nord Stream, and similar credential scanners identify themselves in the github.user_agent string when they call the GitHub API. This rule matches those user agents across GitHub audit events, so an alert means a client advertising a known secret-harvesting tool interacted with your organization. The matching activity is typically a burst of API requests against secrets, contents, and repository routes as the tool walks the organization looking for exposed tokens and keys. Review the authenticating identity (user.name), the source address (github.actor_ip), the token used (github.hashed_token and github.programmatic_access_type), and the repositories and routes touched (github.org, github.repo, github.route) to determine whether this is a sanctioned scan or an adversary mining for credentials.

Possible investigation steps

  • Review github.user_agent to confirm which scanning tool was advertised, and whether it maps to any sanctioned CI job or security automation in your environment.
  • Identify the actor using user.name and github.actor_ip, and determine whether the source IP and its ASN are expected for that user.
  • Examine the token via github.hashed_token and github.programmatic_access_type to establish whether a PAT, OAuth grant, or GitHub App installation token was used, and who owns it.
  • Review github.org, github.repo, and github.route to see which repositories and API routes were enumerated, focusing on secrets, contents, and public-key routes.
  • Pivot on the same actor or token for follow-on secret_scanning_alert.create, clone (git.clone), or archive download (repo.download_zip) events that indicate the scan progressed to collection or exfiltration.

False positive analysis

  • Authorized secret-scanning jobs that run TruffleHog or similar tools in CI and keep the default user agent. Confirm the identity and source against known automation, and scope exceptions to the specific user.name and repository values rather than the user agent alone.
  • Security team assessments or red-team exercises that use these tools with prior approval. Validate against change-management or engagement records before dismissing.

Response and remediation

  • Revoke the token identified by github.hashed_token and require the owning user to reauthenticate.
  • Rotate any secrets, deploy keys, or tokens stored in the repositories the tool enumerated, prioritizing routes in github.route that returned contents or secrets.
  • Review the actor’s recent GitHub audit activity for successful secret access, clones, or archive downloads that indicate data was collected.
  • If the identity or token is confirmed compromised, reset the user’s credentials and review their OAuth app authorizations and PAT grants, removing any that are unauthorized.
  • Block or rate-limit the offending github.actor_ip at the network edge as a compensating control, recognizing that user agents and source IPs are easily changed.
  • Escalate to the repository and organization owners, and engage incident response per your organization’s playbooks if sensitive data was exposed.

Rule query

edit
from logs-github.audit-* metadata _id, _index, _version
| where
  event.module == "github" and data_stream.dataset == "github.audit" and
    (
      TO_LOWER(github.user_agent) LIKE "*trufflehog*" or
      TO_LOWER(github.user_agent) LIKE "*nord-stream*" or
      TO_LOWER(github.user_agent) LIKE "*nordstream*"
    )
| keep
    _id,
    _index,
    _version,
    @timestamp,
    event.action,
    user.name,
    github.org,
    github.repo,
    github.route,
    github.actor_ip,
    github.hashed_token,
    github.programmatic_access_type,
    github.user_agent

Framework: MITRE ATT&CKTM