How the attack works
Source code is the first thing an attacker takes from a GitHub organization, because it holds intellectual property and very often credentials. There are three ways to take a lot of it quickly. Cloning copies a repository with its full history, and a token that can read many repositories can clone them one after another. Downloading a source code archive gives a snapshot of one branch, tag or commit as a ZIP file without the history. An organization migration, which only organization owners can start, packages one or more repositories into a single archive that by default contains the Git data, the metadata, the attachments and the releases.
All three leave audit events, but not in the same place. repo.download_zip and the migration actions migration.create and migration.download are ordinary audit log events. Clones are Git events: GitHub records git.clone, git.fetch and git.push, states that these events are not available in the web interface and delivers them only through the REST API, audit log streaming and exports. It also retains Git events for seven days, against 180 days for the rest of the audit log. An organization that does not stream its audit log or query the API with Git events included therefore has no record of who cloned what after a week. The Cloud Security Alliance summary of the campaign that Wiz tracks as Gheist describes this step: the tool cycled through stolen tokens of several users and automation accounts within minutes and cloned private repositories before it planted its workflow.
What an attacker needs
- A credential that can read the repositories: a personal access token, an OAuth or app token, an SSH key, a deploy key or a signed-in session. Read access is enough to clone or download.
- For a migration archive, an organization owner. GitHub states that the migration endpoints are only available to authenticated organization owners and do not work with fine-grained personal access tokens or GitHub App tokens.
Impact
The attacker holds a copy of the organization's source code, and with clones and migration archives also its history, which is where removed secrets remain. A migration archive adds issues, pull requests, attachments and releases. The copy cannot be taken back. What follows is the search of the code for credentials, the use of those credentials elsewhere, and the publication or sale of the code.
Detection rules
One Actor Cloned Many GitHub Repositories
Counts, per actor, the different repositories that were cloned (git.clone, counted by repo). A stolen token that copies every repository it can read leaves one clone in each of many repositories within minutes. Twenty or more repositories for one actor within one hour fit that pattern. The count and the window are starting points to tune. The rule depends on Git events: GitHub states that git.clone is not available in the web interface, only through the REST API, audit log streaming and exports, and it retains Git events for seven days. The rule returns nothing unless your collection includes Git events, for example an audit log stream or an API query with include=git.
Fires when one actor has at least 20 different repo values within 1 hour.
title: GitHub Repository Cloned (Bulk Cloning Base Event)
id: b523b40f-09a4-43e0-9f72-071e66e8f8f0
name: github_repository_cloned
status: experimental
description: >-
Base event of the threshold rule in this file. A git.clone event, which
GitHub writes when a repository is cloned. GitHub does not show this
event in the web interface. It is available through the REST API, audit
log streaming and exports only.
logsource:
product: github
service: audit
detection:
selection:
action: git.clone
condition: selection
level: low
---
title: One Actor Cloned Many GitHub Repositories
id: 23b63581-ff78-45d1-b449-17b59b21640e
status: experimental
description: >-
Counts, per actor, the different repositories that were cloned
(git.clone, counted by repo). A stolen token that copies every repository
it can read leaves one clone in each of many repositories within minutes.
Twenty or more repositories for one actor within one hour fit that
pattern. The count and the window are starting points to tune. The rule
depends on Git events: GitHub states that git.clone is not available in
the web interface, only through the REST API, audit log streaming and
exports, and it retains Git events for seven days. The rule returns
nothing unless your collection includes Git events, for example an audit
log stream or an API query with include=git.
references:
- https://docs.github.com/en/enterprise-cloud@latest/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/audit-log-events-for-your-enterprise
- https://docs.github.com/en/enterprise-cloud@latest/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/using-the-audit-log-api-for-your-enterprise
- https://docs.github.com/en/enterprise-cloud@latest/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/streaming-the-audit-log-for-your-enterprise
- https://labs.cloudsecurityalliance.org/research/csa-research-note-gheist-github-token-actions-secret-theft-2/
- https://attack.mitre.org/techniques/T1213/003/
author: Forestall
date: 2026-11-18
tags:
- attack.collection
- attack.t1213.003
correlation:
type: value_count
rules:
- github_repository_cloned
group-by:
- actor
timespan: 1h
condition:
field: repo
gte: 20
falsepositives:
- Build systems, backup jobs and code search tools that clone many repositories under one identity. Exclude those identities by actor.
- A developer who sets up a new machine and clones a team's repositories in one go. Confirm with the developer.
- The values of 20 repositories and one hour are starting points, not tested limits. An attacker who clones slowly stays below the count.
level: medium
False positives
- Build systems, backup jobs and code search tools that clone many repositories under one identity. Exclude those identities by actor.
- A developer who sets up a new machine and clones a team's repositories in one go. Confirm with the developer.
- The values of 20 repositories and one hour are starting points, not tested limits. An attacker who clones slowly stays below the count.
One Actor Downloaded Source Archives of Many GitHub Repositories
Counts, per actor, the different repositories whose source code archive was downloaded as a ZIP file (repo.download_zip, counted by repo). People download an archive of a repository now and then. An account that downloads the archives of many repositories in a short time is copying code without using Git, which leaves no Git event. Ten or more repositories for one actor within 30 minutes fit that pattern. The count and the window are starting points to tune. Unlike clones, this event is part of the ordinary audit log and does not need Git events to be collected.
Fires when one actor has at least 10 different repo values within 30 minutes.
title: GitHub Repository Source Archive Downloaded (Bulk Download Base Event)
id: f3ab4e37-efac-433c-b931-6e4ccbb63b6b
name: github_repository_zip_downloaded
status: experimental
description: >-
Base event of the threshold rule in this file. A repo.download_zip event,
which GitHub writes when a source code archive of a repository is
downloaded as a ZIP file.
logsource:
product: github
service: audit
detection:
selection:
action: repo.download_zip
condition: selection
level: low
---
title: One Actor Downloaded Source Archives of Many GitHub Repositories
id: 70b90d07-b8b4-4bb7-80ab-f3994eb4ab43
status: experimental
description: >-
Counts, per actor, the different repositories whose source code archive
was downloaded as a ZIP file (repo.download_zip, counted by repo). People
download an archive of a repository now and then. An account that
downloads the archives of many repositories in a short time is copying
code without using Git, which leaves no Git event. Ten or more
repositories for one actor within 30 minutes fit that pattern. The count
and the window are starting points to tune. Unlike clones, this event is
part of the ordinary audit log and does not need Git events to be
collected.
references:
- https://docs.github.com/en/enterprise-cloud@latest/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/audit-log-events-for-your-enterprise
- https://docs.github.com/en/enterprise-cloud@latest/repositories/working-with-files/using-files/downloading-source-code-archives
- https://attack.mitre.org/techniques/T1213/003/
author: Forestall
date: 2026-11-18
tags:
- attack.collection
- attack.t1213.003
correlation:
type: value_count
rules:
- github_repository_zip_downloaded
group-by:
- actor
timespan: 30m
condition:
field: repo
gte: 10
falsepositives:
- Tools that fetch source archives of many repositories under one identity, for example a licence scanner or an internal mirror. Exclude that identity by actor.
- The values of 10 repositories and 30 minutes are starting points, not tested limits. An attacker who downloads slowly stays below the count.
level: medium
False positives
- Tools that fetch source archives of many repositories under one identity, for example a licence scanner or an internal mirror. Exclude that identity by actor.
- The values of 10 repositories and 30 minutes are starting points, not tested limits. An attacker who downloads slowly stays below the count.
GitHub Organization Migration Archive Created or Downloaded
Detects an organization migration export. migration.create is written when a migration file is created for transferring data from a source location, such as a GitHub.com organization, to a GitHub Enterprise Server instance, and migration.download when such a file is downloaded. A migration archive packages one or more repositories, by default with their Git data, metadata, attachments and releases, into a single file. Only organization owners can start one, and the operation is rare outside a planned move, so each event deserves a check. The download event means that the archive left GitHub.
title: GitHub Organization Migration Archive Created or Downloaded
id: 17c5595d-f598-4e29-8652-3e57d866a6d1
status: experimental
description: >-
Detects an organization migration export. migration.create is written
when a migration file is created for transferring data from a source
location, such as a GitHub.com organization, to a GitHub Enterprise
Server instance, and migration.download when such a file is downloaded.
A migration archive packages one or more repositories, by default with
their Git data, metadata, attachments and releases, into a single file.
Only organization owners can start one, and the operation is rare outside
a planned move, so each event deserves a check. The download event means
that the archive left GitHub.
references:
- https://docs.github.com/en/enterprise-cloud@latest/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/audit-log-events-for-your-enterprise
- https://docs.github.com/en/enterprise-cloud@latest/rest/migrations/orgs
- https://attack.mitre.org/techniques/T1213/003/
author: Forestall
date: 2026-11-18
tags:
- attack.collection
- attack.t1213.003
logsource:
product: github
service: audit
detection:
selection:
action:
- migration.create
- migration.download
condition: selection
falsepositives:
- A planned migration of repositories to GitHub Enterprise Server, and backup tools that use the migrations API. Confirm the plan with the organization owners and exclude a known backup identity by actor.
level: medium
False positives
- A planned migration of repositories to GitHub Enterprise Server, and backup tools that use the migrations API. Confirm the plan with the organization owners and exclude a known backup identity by actor.
Detection logic
Patterns that need more than one event, a baseline or knowledge of your own environment. Each is a hypothesis to build and tune in your SIEM, not a ready rule.
Repositories cloned and then pushed to by the same account within minutes
The Gheist campaign, as the Cloud Security Alliance summarises it, reads first and writes second: the tool clones the private repositories a stolen token can reach before it plants a workflow in them. One account that clones several repositories and pushes to the same repositories shortly afterwards, across repositories that have nothing else in common, follows that order.
- Clones by one account:
git.clone. Keepactor,repoand the time for each. - Pushes by the same
actorto the samerepowithin 30 minutes of the clone:git.push. - Alert when this pair occurs in 5 or more different repositories for one actor within an hour, and raise the priority when
programmatic_access_typeshows a token.
Eventsgit.clonegit.push
LimitsA release engineer who updates a shared file in many repositories produces the same pattern, as do dependency update bots, which have to be excluded by actor. All three Git events reach only the REST API, audit log streaming and exports, and GitHub notes that the Git event export leaves out events that were started in the web browser or through the REST or GraphQL API. The numbers are starting points.
Account cloned many repositories it had not read before
A fixed count separates attackers from build systems badly. The set of repositories an identity reads is stable from week to week, so an identity that suddenly clones many repositories outside its own history is unusual whatever its volume.
- Build, per
actor, the set of repositories inrepothat it cloned or fetched over the last 30 days:git.cloneandgit.fetch. - For each new day, count the repositories the actor cloned that are not in its set.
- Alert when the count of new repositories passes a number you choose, for example 10, and list them.
Eventsgit.clonegit.fetch
LimitsGitHub keeps Git events for seven days, so the 30 day history exists only in your own store. New employees, new build pipelines and reorganizations create the same jump and need to be confirmed once. The 30 days and the count of 10 are starting points.
Triage
- Identify the account (
actor) and list the repositories it cloned or downloaded in the period (repo), with their visibility (repository_publicon Git events,visibilityonrepo.download_zip). - Identify the credential.
programmatic_access_typeandhashed_tokenshow the token, andtransport_protocol_nameon Git events shows whether HTTP or SSH was used. Checkuser_agent, and the source IP address where your enterprise displays IP addresses in the audit log, against what the account normally uses. - Compare the list with the account's work. A build identity clones the same repositories every day, and a developer rarely clones dozens of unrelated repositories in an hour.
- For a migration, ask the organization owners whether a move to GitHub Enterprise Server is planned, and note that
migration.downloadmeans the archive left GitHub. - Look at what the same account did next, in particular pushes to the same repositories, new workflow files, deleted workflow runs and new tokens.
Response
Once the attack is confirmed:
- Revoke the token or key that was used, or end the sessions and reset the credentials of a person's account, and remove the owner role from an account that should not hold it.
- Treat every credential in the copied repositories and their history as exposed. Use the secret scanning alerts of those repositories as the list, and rotate each credential.
- Delete a migration archive that still exists. GitHub deletes it automatically after seven days and offers an endpoint to delete it sooner.
- Export the Git events and audit events of the period at once, because Git events are kept for seven days only.
- Review the cloud accounts, registries and other systems that the exposed credentials open, for use since the first clone.
Mitigation
- Stream the audit log to a SIEM so that Git events are kept longer than the seven days GitHub retains them, and make sure the stream or the API query includes them.
- Give tokens access to the repositories they need and no more. Prefer fine-grained personal access tokens and GitHub Apps with selected repositories over classic tokens that can read everything their owner can.
- Lower the base permission of the organization, so that a member account does not read every private repository by default.
- Keep the number of organization owners small, since owners can export any repository in a migration archive.
- Enable secret scanning and push protection, so that the repositories an attacker copies hold as few live credentials as possible.
Frequently asked questions
Why do I not see clones in the audit log of my organization?
GitHub records clones, fetches and pushes as Git events and states that these events are not available in the web interface. They are delivered through the REST API, where the request has to ask for them with `include=git` or `include=all`, through audit log streaming, and through the separate export of Git events. GitHub retains Git events for seven days.
Does a downloaded ZIP archive contain the history of the repository?
No. GitHub states that source code archives are snapshots of a branch, a tag or a commit and do not contain the entire repository history. A clone does. For an attacker who looks for secrets that were removed from the code, the clone and the migration archive are therefore worth more than the ZIP file.
Who can create an organization migration archive?
Organization owners. GitHub states that the REST endpoints for organization migrations are only available to authenticated organization owners, and that they do not work with fine-grained personal access tokens or GitHub App tokens. The archive can hold several repositories and is deleted automatically after seven days.
How many clones are too many?
There is no fixed number. Build systems clone hundreds of repositories a day, so the threshold rules count different repositories per account and start at values that have to be tuned. The stronger signals are an account that reads repositories it never touched before, a token used from a new address, and clones that are followed by pushes to the same repositories.
References
- MITRE ATT&CK T1213.003: Code Repositories
- Audit log events for your enterprise
- Audit log for an enterprise
- Using the audit log API for your enterprise
- Streaming the audit log for your enterprise
- Exporting audit log activity for your enterprise
- Identifying audit log events performed by an access token
- Downloading source code archives
- REST API endpoints for organization migrations
- Exporting migration data from GitHub.com
- Cloud Security Alliance: Gheist, stolen GitHub tokens turn Actions logs into exfiltration channels (29 October 2026)