GitHub Exfiltration via High Number of Repository ZIP Downloads


Description

Detects 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.

Query · esql

from 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

Investigation fields

Pivot points the source recommends for triage.

  • user.name
  • github.actor_ip
  • Esql.time_window
  • Esql.event_count
  • Esql.github_repo_unique_count
  • Esql.github_org_values
  • Esql.github_repo_values
  • Esql.github_programmatic_access_type_values
  • Esql.github_user_agent_values
  • Esql.github_token_id_values

Known false positives

  • Developers downloading archives for offline review, backup jobs, or CI that fetches zipballs. Confirm the actor, token type, and whether the repositories are 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 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.request enumeration, 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_ip or 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.
Raw source GitHub Exfiltration via High Number of Repository ZIP Downloads · Elastic TOML
Esc
Published by elastic/detection-rules ↗, licensed under Elastic License 2.0 ↗. Reproduced here unmodified.
[metadata]
creation_date = "2026/09/22"
integration = ["github"]
maturity = "production"
updated_date = "2026/11/03"

[rule]
author = ["Elastic"]
description = """
Detects 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.
"""
false_positives = [
    """
    Developers downloading archives for offline review, backup jobs, or CI that fetches zipballs. Confirm the actor,
    token type, and whether the repositories are expected.
    """,
]
from = "now-9m"
interval = "8m"
language = "esql"
license = "Elastic License v2"
name = "GitHub Exfiltration via High Number of Repository ZIP Downloads"
note = """## 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 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.request` enumeration, 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_ip` or 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.
"""
references = [
    "https://securitylabs.datadoghq.com/articles/mapping-out-your-unknown-threat-hunters-guide-to-github/",
    "https://github.blog/news-insights/company-news/security-alert-stolen-oauth-user-tokens/",
    "https://docs.github.com/en/rest/repos/contents#download-a-repository-archive-zip",
]
risk_score = 47
rule_id = "0fe75796-0258-4e19-a762-26228edcc468"
severity = "medium"
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",
]
timestamp_override = "event.ingested"
type = "esql"

query = '''
from 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
'''


[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1020"
name = "Automated Exfiltration"
reference = "https://attack.mitre.org/techniques/T1020/"
[[rule.threat.technique]]
id = "T1567"
name = "Exfiltration Over Web Service"
reference = "https://attack.mitre.org/techniques/T1567/"
[[rule.threat.technique.subtechnique]]
id = "T1567.001"
name = "Exfiltration to Code Repository"
reference = "https://attack.mitre.org/techniques/T1567/001/"


[rule.threat.tactic]
id = "TA0010"
name = "Exfiltration"
reference = "https://attack.mitre.org/tactics/TA0010/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1213"
name = "Data from Information Repositories"
reference = "https://attack.mitre.org/techniques/T1213/"
[[rule.threat.technique.subtechnique]]
id = "T1213.003"
name = "Code Repositories"
reference = "https://attack.mitre.org/techniques/T1213/003/"



[rule.threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"

[rule.investigation_fields]
field_names = [
    "user.name",
    "github.actor_ip",
    "Esql.time_window",
    "Esql.event_count",
    "Esql.github_repo_unique_count",
    "Esql.github_org_values",
    "Esql.github_repo_values",
    "Esql.github_programmatic_access_type_values",
    "Esql.github_user_agent_values",
    "Esql.github_token_id_values",
]

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.