GitHub Activity from Credential Scanner User Agent
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.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2026/09/22"
3integration = ["github"]
4maturity = "production"
5updated_date = "2026/09/22"
6
7[rule]
8author = ["Elastic"]
9description = """
10Identifies GitHub audit activity from a user agent associated with credential-scanning and secret-harvesting tooling
11such as TruffleHog or Nord Stream. These tools walk repository contents and API routes to locate hardcoded secrets,
12tokens, deploy keys, and other credentials. Legitimate users rarely drive GitHub API traffic with these user agents, so a
13match is a strong signal that an adversary or an unsanctioned scan is mining the organization for exposed credentials,
14frequently as a precursor to credential access and data collection from code repositories.
15"""
16false_positives = [
17 """
18 Authorized secret-scanning jobs that identify as TruffleHog in CI. Restrict exceptions to known automation
19 identities and repositories.
20 """,
21]
22from = "now-9m"
23language = "esql"
24license = "Elastic License v2"
25name = "GitHub Activity from Credential Scanner User Agent"
26note = """## Triage and analysis
27
28> **Disclaimer**:
29> 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.
30
31### Investigating GitHub Activity from Credential Scanner User Agent
32
33TruffleHog, 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.
34
35### Possible investigation steps
36
37- 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.
38- Identify the actor using `user.name` and `github.actor_ip`, and determine whether the source IP and its ASN are expected for that user.
39- 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.
40- 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.
41- 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.
42
43### False positive analysis
44
45- 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.
46- Security team assessments or red-team exercises that use these tools with prior approval. Validate against change-management or engagement records before dismissing.
47
48### Response and remediation
49
50- Revoke the token identified by `github.hashed_token` and require the owning user to reauthenticate.
51- Rotate any secrets, deploy keys, or tokens stored in the repositories the tool enumerated, prioritizing routes in `github.route` that returned contents or secrets.
52- Review the actor's recent GitHub audit activity for successful secret access, clones, or archive downloads that indicate data was collected.
53- 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.
54- 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.
55- Escalate to the repository and organization owners, and engage incident response per your organization's playbooks if sensitive data was exposed.
56"""
57references = ["https://github.com/trufflesecurity/trufflehog"]
58risk_score = 47
59rule_id = "76402e4d-c462-4852-aeb9-0266e6ee2890"
60severity = "medium"
61tags = [
62 "Domain: Cloud",
63 "Domain: SaaS",
64 "Platform: GitHub",
65 "Use Case: Threat Detection",
66 "Tactic: Collection",
67 "Tactic: Credential Access",
68 "Tactic: Discovery",
69 "Data Source: Github",
70 "Data Source: GitHub Audit Logs",
71 "Rule Type: ES|QL",
72 "Resources: Investigation Guide",
73]
74timestamp_override = "event.ingested"
75type = "esql"
76
77query = '''
78from logs-github.audit-* metadata _id, _index, _version
79| where
80 event.module == "github" and data_stream.dataset == "github.audit" and
81 (
82 TO_LOWER(github.user_agent) LIKE "*trufflehog*" or
83 TO_LOWER(github.user_agent) LIKE "*nord-stream*" or
84 TO_LOWER(github.user_agent) LIKE "*nordstream*"
85 )
86| keep
87 _id,
88 _index,
89 _version,
90 @timestamp,
91 event.action,
92 user.name,
93 github.org,
94 github.repo,
95 github.route,
96 github.actor_ip,
97 github.hashed_token,
98 github.programmatic_access_type,
99 github.user_agent
100'''
101
102
103[[rule.threat]]
104framework = "MITRE ATT&CK"
105[[rule.threat.technique]]
106id = "T1526"
107name = "Cloud Service Discovery"
108reference = "https://attack.mitre.org/techniques/T1526/"
109
110
111[rule.threat.tactic]
112id = "TA0007"
113name = "Discovery"
114reference = "https://attack.mitre.org/tactics/TA0007/"
115[[rule.threat]]
116framework = "MITRE ATT&CK"
117[[rule.threat.technique]]
118id = "T1552"
119name = "Unsecured Credentials"
120reference = "https://attack.mitre.org/techniques/T1552/"
121[[rule.threat.technique.subtechnique]]
122id = "T1552.001"
123name = "Credentials In Files"
124reference = "https://attack.mitre.org/techniques/T1552/001/"
125
126
127
128[rule.threat.tactic]
129id = "TA0006"
130name = "Credential Access"
131reference = "https://attack.mitre.org/tactics/TA0006/"
132[[rule.threat]]
133framework = "MITRE ATT&CK"
134[[rule.threat.technique]]
135id = "T1213"
136name = "Data from Information Repositories"
137reference = "https://attack.mitre.org/techniques/T1213/"
138[[rule.threat.technique.subtechnique]]
139id = "T1213.003"
140name = "Code Repositories"
141reference = "https://attack.mitre.org/techniques/T1213/003/"
142
143
144[rule.threat.tactic]
145id = "TA0009"
146name = "Collection"
147reference = "https://attack.mitre.org/tactics/TA0009/"
148
149[rule.investigation_fields]
150field_names = [
151 "@timestamp",
152 "event.action",
153 "user.name",
154 "github.org",
155 "github.repo",
156 "github.route",
157 "github.actor_ip",
158 "github.hashed_token",
159 "github.programmatic_access_type",
160 "github.user_agent",
161]
162
163[rule.alert_suppression]
164group_by = ["github.actor_ip", "github.hashed_token", "github.user_agent"]
165duration = { value = 1, unit = "h" }
166missing_fields_strategy = "suppress"
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_agentto 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.nameandgithub.actor_ip, and determine whether the source IP and its ASN are expected for that user. - Examine the token via
github.hashed_tokenandgithub.programmatic_access_typeto establish whether a PAT, OAuth grant, or GitHub App installation token was used, and who owns it. - Review
github.org,github.repo, andgithub.routeto 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.nameand 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_tokenand require the owning user to reauthenticate. - Rotate any secrets, deploy keys, or tokens stored in the repositories the tool enumerated, prioritizing routes in
github.routethat 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_ipat 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.
References
Related rules
- GitHub API Sensitive Resource Enumeration
- GitHub Repository Transferred Out of Organization
- GitHub Exfiltration via High Number of Repository ZIP Downloads
- GitHub Token Clone Push or ZIP from Unusual ASN
- GitHub Webhook Created or Configuration Changed