GitHub Exfiltration via High Number of Repository ZIP Downloads
editGitHub Exfiltration via High Number of Repository ZIP Downloads
editDetects a high number of GitHub repository ZIP archive downloads by a single non-bot user from one source IP within a short window. The repo.download_zip action retrieves a full repository archive over HTTP, so adversaries use it to collect source code without a git clone (which clone-threshold rules watch), including with classic PATs, fine-grained PATs, or OAuth tokens. Grouping by actor and source IP and requiring a high archive-download count separates bulk source collection from occasional developer downloads.
Rule type: esql
Rule indices: None
Severity: medium
Risk score: 47
Runs every: 8m
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: Exfiltration
- 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
editTriage 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 Exfiltration via High Number of Repository ZIP Downloads
repo.download_zip is the audit action for repository archive/zipball downloads. Mass ZIP collection is a clone alternative that git.clone threshold rules do not catch, so it is a useful source-collection path for an adversary with a stolen token. The rule groups downloads by user.name and github.actor_ip in a 10-minute window, requires a high archive-download count, and excludes automated actors (github.actor_is_bot: true) and requests without an actor IP.
Possible investigation steps
-
Identify
user.name,github.actor_ip,github.programmatic_access_type, and the token (Esql.github_token_id_values), and confirm whether the token belongs to a known developer or automation identity. -
Review the distinct repositories downloaded (
Esql.github_repo_values,Esql.github_repo_unique_count) and the organizations (Esql.github_org_values), and whether those repositories are private or sensitive. -
Review the client from
Esql.github_user_agent_values; tooling or scripted user agents on a high download count are a stronger signal than a browser. -
Correlate with
git.clone,api.requestenumeration, collaborator changes, and secret-scanning alerts from the same token or actor IP to establish whether this is part of a broader collection campaign. -
Check the authentication context for the actor around the window for signs of a stolen token, such as a new
github.actor_ipor unfamiliar user agent for that token.
False positive analysis
- Approved bulk archive export, backup, or disaster-recovery tooling, and CI that fetches zipballs. Confirm the actor and token type and, if expected, scope exceptions by actor, token, or user agent.
- A developer legitimately downloading several archives for offline review over a short period.
Response and remediation
- Revoke the token if the actor is not a known automation identity, and review repository access and PAT/OAuth grants for the actor.
- Review the downloaded repositories for sensitive content and rotate any secrets they contain.
- Hunt for subsequent off-platform transfer of the archives from the same host or IP.
- Escalate to incident response if private or sensitive repositories were downloaded, or if the downloads coincide with other collection or credential-access activity by the same actor.
Rule query
editfrom logs-github.audit-* metadata _id, _index, _version | where data_stream.dataset == "github.audit" and event.action == "repo.download_zip" and github.actor_ip is not null and github.actor_is_bot == false | stats Esql.event_count = COUNT(*), Esql.github_repo_unique_count = COUNT_DISTINCT(github.repo), Esql.github_org_values = VALUES(github.org), Esql.github_repo_values = VALUES(github.repo), 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, Esql.time_window = DATE_TRUNC(10 minutes, @timestamp) | keep user.name, github.actor_ip, Esql.* | where Esql.event_count >= 8
Framework: MITRE ATT&CKTM
-
Tactic:
- Name: Exfiltration
- ID: TA0010
- Reference URL: https://attack.mitre.org/tactics/TA0010/
-
Technique:
- Name: Automated Exfiltration
- ID: T1020
- Reference URL: https://attack.mitre.org/techniques/T1020/
-
Technique:
- Name: Exfiltration Over Web Service
- ID: T1567
- Reference URL: https://attack.mitre.org/techniques/T1567/
-
Sub-technique:
- Name: Exfiltration to Code Repository
- ID: T1567.001
- Reference URL: https://attack.mitre.org/techniques/T1567/001/
-
Tactic:
- Name: Collection
- ID: TA0009
- Reference URL: https://attack.mitre.org/tactics/TA0009/
-
Technique:
- Name: Data from Information Repositories
- ID: T1213
- Reference URL: https://attack.mitre.org/techniques/T1213/
-
Sub-technique:
- Name: Code Repositories
- ID: T1213.003
- Reference URL: https://attack.mitre.org/techniques/T1213/003/