GitHub API Failed Access Burst
Description
Detects a burst of failed GitHub API requests (HTTP 4xx/5xx) recorded as api.request, where a single non-bot actor
and source IP generate a high volume of failures spread across many distinct API routes within a short window. An
adversary probing private repositories, secrets, or admin routes produces clusters of 401/403/404 responses across many
endpoints, whereas broken automation usually hammers a small number of routes. Grouping by actor and source IP and
requiring both a high failure count and a high number of distinct routes separates broad enumeration from a single
misconfigured integration. Requires API Request Events on GitHub audit log streaming.
Query · esql
from logs-github.audit-* metadata _id, _index, _version
| where
data_stream.dataset == "github.audit" and event.action == "api.request" and github.status_code >= 400
and (github.actor_is_bot == false or github.actor_is_bot is null)
| stats
Esql.event_count = COUNT(*),
Esql.distinct_route_count = COUNT_DISTINCT(github.route),
Esql.distinct_repo_count = COUNT_DISTINCT(github.repo),
Esql.github_route_values = values(github.route),
Esql.github_status_code_values = values(github.status_code),
Esql.github_org_values = values(github.org),
Esql.github_programmatic_access_type_values = values(github.programmatic_access_type),
Esql.github_user_agent_values = values(github.user_agent),
Esql.agent_id_values = values(agent.id),
Esql.data_stream_dataset_values = values(data_stream.dataset),
Esql.data_stream_namespace_values = values(data_stream.namespace),
Esql.github_token_id_values = values(github.token_id)
by user.name, github.actor_ip
| keep user.name, github.actor_ip, Esql.*
| where Esql.event_count >= 15 and Esql.distinct_route_count >= 10
Investigation fields
Pivot points the source recommends for triage.
user.namegithub.actor_ipEsql.event_countEsql.distinct_route_countEsql.distinct_repo_countEsql.github_route_valuesEsql.github_status_code_valuesEsql.github_org_valuesEsql.github_programmatic_access_type_valuesEsql.github_user_agent_valuesEsql.github_token_id_values
Implementation guide
Requires the Elastic GitHub integration, GitHub Enterprise audit log streaming, and Enable API Request Events.
Known false positives
- Broken automation, expired tokens, or inventory tools hitting renamed repositories. Review the routes and whether the token is expected.
Analyst notes
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 API Failed Access Burst
Failed api.request status codes often precede successful enumeration after the attacker finds a valid path or token. This rule groups failed requests by user.name and github.actor_ip and fires when a single actor/IP produces at least 15 failures spread across 10 or more distinct API routes in the window, which distinguishes broad enumeration from a single broken integration hammering one endpoint.
Possible investigation steps
- Review the alerting
user.nameandgithub.actor_ip, and inspectEsql.distinct_route_countandEsql.github_route_valuesto see which routes were probed. - Review
Esql.github_status_code_valuesto confirm the mix of 401/403/404 responses typical of access probing. - Pivot on
Esql.github_token_id_valuesandEsql.github_programmatic_access_type_valuesto identify the token and access method used. - Check
Esql.distinct_repo_countandEsql.github_org_valuesto gauge how broadly the actor is probing across repositories and organizations. - Look for a later run of 200s on secrets, trees, or contents from the same actor or token, which indicates successful enumeration.
False positive analysis
- CI or inventory tooling using a token that lacks repo scope against private repositories. These typically hit a small number of routes, so review
Esql.distinct_route_countand the route values before dismissing. - Expired or rotated tokens causing widespread 401s from a known automation IP.
Response and remediation
- Revoke the token if the actor is not a known automation identity. Tighten org PAT policies.
- Block or monitor the source IP if the activity is clearly reconnaissance.
- Review whether any probed route later returned a success for the same actor.