1. Resources
  2. Detection rules
  3. Repository Transferred Out or Deleted in GitHub

Repository Transferred Out or Deleted in GitHub detection rules

An attacker with admin access to repositories transfers them to an account outside the organization or deletes them, so the organization loses its code, its history and the settings that protected it.

Platform
GitHub
Severity
High
Log source
GitHub audit log
Last updated
Rule formats
Sigmaand queries for: SplunkMicrosoft SentinelIBM QRadar
What an attacker needs
An organization owner account, or admin access to a repository where the policy lets repository administrators delete or transfer repositories.
Impact
The organization loses repositories with their history to deletion, or an outside account becomes the owner of the code, its secrets and its deploy keys.
Response
Restore deleted repositories within the 90 days GitHub allows, and rotate the secrets and deploy keys of every repository that was transferred out.
Mitigation
Limit repository deletion and transfer to organization owners by policy, keep owners few, and keep copies of the repositories outside GitHub.
Audit actions
repo.destroyorg.deletebusiness.remove_organizationmembers_can_delete_repos.enablemembers_can_delete_repos.clearrepo.transfer_startrepo.transfer_outgoingorg.transfer_outgoing

How the attack works

GitHub treats deleting a repository and transferring it to another owner as one capability. An organization owner can do both, and so can a member with admin access to the repository unless a policy restricts it: the organization setting "Allow members to delete or transfer repositories for this organization" and the enterprise policy "Repository deletion and transfer" decide whether repository administrators keep this right or whether it is limited to organization owners. GitHub's documentation says that limiting the ability to delete or transfer repositories helps prevent sensitive information from being exposed.

A transfer hands the repository to a new owner who, in GitHub's words, can immediately administer its contents, issues, pull requests, releases, projects and settings. Issues, pull requests, the wiki, webhooks, secrets and deploy keys move with it. For an attacker this is a way to take a complete repository with its history out of the organization in one step. A deletion removes the repository and, for a private or internal repository, all of its forks. A deleted repository can be restored within 90 days in most cases, but a deleted organization cannot, and GitHub states that it cannot restore the content after an organization is deleted. GitHub records these steps as repo.transfer_start, repo.transfer_outgoing, repo.destroy, org.transfer_outgoing and org.delete, and the enterprise policy change as members_can_delete_repos.enable. An enterprise owner can also remove a whole organization from the enterprise, recorded as business.remove_organization, after which the enterprise no longer governs its identity management, two-factor requirements and other policies and its IP allow list is disabled. A separate rule on this page reads that action.

What an attacker needs

  • Control of an organization owner account, or of an account with admin access to the repository where the policy lets repository administrators delete or transfer repositories.
  • For a transfer, a receiving user or organization. A transfer to an organization needs the permission to create repositories there.
  • For the deletion of an organization, an organization owner.

Impact

After a transfer the code, its full history and the issues and pull requests around it belong to an account the organization does not control, and the secrets and deploy keys of the repository went with it. After a deletion the repository and the forks of a private repository are gone, team permissions are lost for good, and builds and deployments that depend on the repository stop. Deleting many repositories, or the organization itself, is destruction on the scale of the whole code base.

Detection rules

One Actor Deleted Many GitHub Repositories

Counts the repositories that one actor deleted (repo.destroy). Cleanup removes a repository now and then. An account or token that deletes repository after repository in a short time is destroying the code base, or removing what it has just copied. Five or more deletions by one actor within 30 minutes fit that pattern. The count and the window are starting points to tune.

Fires when one actor has at least 5 matching events within 30 minutes.

Threshold ruleLevelHighStatusExperimentalLog sourceGitHub audit log
title: GitHub Repository Deleted (Bulk Deletion Base Event)
id: 461088e0-5a4a-42b3-b33c-05d42211265c
name: github_repository_deleted
status: experimental
description: >-
  Base event of the threshold rule in this file. A repo.destroy event,
  which GitHub writes when a repository is deleted.
logsource:
  product: github
  service: audit
detection:
  selection:
    action: repo.destroy
  condition: selection
level: low
---
title: One Actor Deleted Many GitHub Repositories
id: 91b282c6-33a1-4980-be42-4ac34bc45239
status: experimental
description: >-
  Counts the repositories that one actor deleted (repo.destroy). Cleanup
  removes a repository now and then. An account or token that deletes
  repository after repository in a short time is destroying the code base,
  or removing what it has just copied. Five or more deletions by one actor
  within 30 minutes fit that pattern. The count and the window are starting
  points to tune.
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/creating-and-managing-repositories/restoring-a-deleted-repository
  - https://attack.mitre.org/techniques/T1485/
author: Forestall
date: 2026-11-18
tags:
  - attack.impact
  - attack.t1485
correlation:
  type: event_count
  rules:
    - github_repository_deleted
  group-by:
    - actor
  timespan: 30m
  condition:
    gte: 5
falsepositives:
  - A planned cleanup of forks or test repositories, and automation that creates and removes temporary repositories. Exclude the identity that does this by actor.
  - The values of 5 deletions and 30 minutes are starting points, not tested limits. An attacker who deletes slowly stays below the count, and the single-event rule on this page covers that case.
level: high

False positives

  • A planned cleanup of forks or test repositories, and automation that creates and removes temporary repositories. Exclude the identity that does this by actor.
  • The values of 5 deletions and 30 minutes are starting points, not tested limits. An attacker who deletes slowly stays below the count, and the single-event rule on this page covers that case.

GitHub Organization Deleted

Detects the deletion of an organization (org.delete, which GitHub describes as an organization that was deleted by a user or staff). Deleting an organization permanently removes all of its repositories, forks of private repositories, wikis, issues and pull requests, and GitHub states that it cannot restore the content afterwards. Only organization owners can delete an organization, so the event means that an owner account did it.

LevelHighStatusExperimentalLog sourceGitHub audit log
title: GitHub Organization Deleted
id: ce1c1ee1-cfb9-4efa-abb3-6dba1dbc2aee
status: experimental
description: >-
  Detects the deletion of an organization (org.delete, which GitHub
  describes as an organization that was deleted by a user or staff).
  Deleting an organization permanently removes all of its repositories,
  forks of private repositories, wikis, issues and pull requests, and
  GitHub states that it cannot restore the content afterwards. Only
  organization owners can delete an organization, so the event means that
  an owner account did it.
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/organizations/managing-organization-settings/deleting-an-organization-account
  - https://attack.mitre.org/techniques/T1485/
author: Forestall
date: 2026-11-18
tags:
  - attack.impact
  - attack.t1485
logsource:
  product: github
  service: audit
detection:
  selection:
    action: org.delete
  condition: selection
falsepositives:
  - An organization that is retired on purpose after its repositories were moved, for example a test or a merged organization. Confirm the decision with the enterprise owners.
level: high

False positives

  • An organization that is retired on purpose after its repositories were moved, for example a test or a merged organization. Confirm the decision with the enterprise owners.

GitHub Organization Removed From the Enterprise

Detects an organization being removed from an enterprise account (business.remove_organization). GitHub states that the enterprise then no longer governs the organization's billing, identity management, two-factor requirements and other policies, that any IP allow list configured for the organization is disabled, that internal repositories become private and that the organization is downgraded to the free plan. The organization keeps its repositories and its owners, so the removal takes their code out of the enterprise's controls in one step, much like an organization transferred to another enterprise. GitHub documents that removal is not possible for enterprises with managed users or with data residency.

LevelHighStatusExperimentalLog sourceGitHub audit log
title: GitHub Organization Removed From the Enterprise
id: 7b6c6fcf-2a57-4682-8dbc-672d4b183414
status: experimental
description: >-
  Detects an organization being removed from an enterprise account
  (business.remove_organization). GitHub states that the enterprise then no
  longer governs the organization's billing, identity management,
  two-factor requirements and other policies, that any IP allow list
  configured for the organization is disabled, that internal repositories
  become private and that the organization is downgraded to the free plan.
  The organization keeps its repositories and its owners, so the removal
  takes their code out of the enterprise's controls in one step, much like
  an organization transferred to another enterprise. GitHub documents that
  removal is not possible for enterprises with managed users or with data
  residency.
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/managing-accounts-and-repositories/managing-organizations-in-your-enterprise/removing-organizations-from-your-enterprise
  - https://attack.mitre.org/techniques/T1537/
author: Forestall
date: 2026-11-18
tags:
  - attack.exfiltration
  - attack.t1537
logsource:
  product: github
  service: audit
detection:
  selection:
    action: business.remove_organization
  condition: selection
falsepositives:
  - An organization that is split off on purpose, for example after a divestiture, or a test organization that no longer belongs in the enterprise. Confirm the decision with the enterprise owners and a change record.
level: high

False positives

  • An organization that is split off on purpose, for example after a divestiture, or a test organization that no longer belongs in the enterprise. Confirm the decision with the enterprise owners and a change record.

GitHub Repository Deleted

Detects a repository being deleted (repo.destroy, which GitHub describes as a repository that was deleted). Deleting a private or internal repository also deletes all of its forks and permanently deletes team permissions. A single deletion is usually housekeeping, so the rule is context for the threshold rule on this page and for alerts on the same account. The event carries the visibility of the repository in visibility.

LevelLowStatusExperimentalLog sourceGitHub audit log
title: GitHub Repository Deleted
id: 0766619d-1e9e-447b-b8cd-7ce9c8a8847b
status: experimental
description: >-
  Detects a repository being deleted (repo.destroy, which GitHub describes
  as a repository that was deleted). Deleting a private or internal
  repository also deletes all of its forks and permanently deletes team
  permissions. A single deletion is usually housekeeping, so the rule is
  context for the threshold rule on this page and for alerts on the same
  account. The event carries the visibility of the repository in
  visibility.
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/creating-and-managing-repositories/deleting-a-repository
  - https://attack.mitre.org/techniques/T1485/
author: Forestall
date: 2026-11-18
tags:
  - attack.impact
  - attack.t1485
logsource:
  product: github
  service: audit
detection:
  selection:
    action: repo.destroy
  condition: selection
falsepositives:
  - Developers who delete forks, test repositories and repositories of finished projects. Keep the rule as context, or limit it to the repositories you could not afford to lose.
level: low

False positives

  • Developers who delete forks, test repositories and repositories of finished projects. Keep the rule as context, or limit it to the repositories you could not afford to lose.

GitHub Enterprise Policy Changed to Let Members Delete or Transfer Repositories

Detects a loosening of the enterprise policy for repository deletion and transfer. members_can_delete_repos.enable is written when members can delete or transfer repositories in any organization of the enterprise, and members_can_delete_repos.clear when an enterprise owner clears the policy setting, which leaves the decision to each organization. After either change a member with admin access to a repository can delete it or transfer it out, where before only organization owners could.

LevelMediumStatusExperimentalLog sourceGitHub audit log
title: GitHub Enterprise Policy Changed to Let Members Delete or Transfer Repositories
id: 043973e8-242b-4e89-9d34-b1dd73d488d4
status: experimental
description: >-
  Detects a loosening of the enterprise policy for repository deletion and
  transfer. members_can_delete_repos.enable is written when members can
  delete or transfer repositories in any organization of the enterprise,
  and members_can_delete_repos.clear when an enterprise owner clears the
  policy setting, which leaves the decision to each organization. After
  either change a member with admin access to a repository can delete it or
  transfer it out, where before only organization owners could.
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/enforcing-policies/enforcing-policies-for-your-enterprise/enforcing-repository-management-policies-in-your-enterprise
  - https://attack.mitre.org/techniques/T1485/
author: Forestall
date: 2026-11-18
tags:
  - attack.impact
  - attack.t1485
logsource:
  product: github
  service: audit
detection:
  selection:
    action:
      - members_can_delete_repos.enable
      - members_can_delete_repos.clear
  condition: selection
falsepositives:
  - An enterprise owner who changes the policy on purpose, for example to let teams clean up their own repositories. Confirm the decision, since it applies to every organization of the enterprise.
level: medium

False positives

  • An enterprise owner who changes the policy on purpose, for example to let teams clean up their own repositories. Confirm the decision, since it applies to every organization of the enterprise.

GitHub Repository or Organization Transferred Out

Detects a repository leaving its owner and an organization leaving its enterprise. repo.transfer_start is written when a user sends a request to transfer a repository to another user or organization, repo.transfer_outgoing when a repository is transferred to another repository network, and org.transfer_outgoing when an organization is transferred between enterprise accounts. The new owner of a transferred repository can administer its contents and settings at once, and its secrets and deploy keys stay with it. The events do not say in a documented field whether the receiver is inside your enterprise, so each one needs that check.

LevelHighStatusExperimentalLog sourceGitHub audit log
title: GitHub Repository or Organization Transferred Out
id: 4b84ee03-1e29-4d5b-8ce2-a19ffea1e7e8
status: experimental
description: >-
  Detects a repository leaving its owner and an organization leaving its
  enterprise. repo.transfer_start is written when a user sends a request to
  transfer a repository to another user or organization,
  repo.transfer_outgoing when a repository is transferred to another
  repository network, and org.transfer_outgoing when an organization is
  transferred between enterprise accounts. The new owner of a transferred
  repository can administer its contents and settings at once, and its
  secrets and deploy keys stay with it. The events do not say in a
  documented field whether the receiver is inside your enterprise, so each
  one needs that check.
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/creating-and-managing-repositories/transferring-a-repository
  - https://attack.mitre.org/techniques/T1537/
author: Forestall
date: 2026-11-18
tags:
  - attack.exfiltration
  - attack.t1537
logsource:
  product: github
  service: audit
detection:
  selection:
    action:
      - repo.transfer_start
      - repo.transfer_outgoing
      - org.transfer_outgoing
  condition: selection
falsepositives:
  - Repositories that are moved between organizations of the same enterprise during a reorganization, and a repository that a developer moves from a personal account into the organization. Confirm the receiving owner.
level: high

False positives

  • Repositories that are moved between organizations of the same enterprise during a reorganization, and a repository that a developer moves from a personal account into the organization. Confirm the receiving owner.

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.

Repository deleted soon after the same account cloned or downloaded it

Detection hypothesisSequence of eventsJoins two logs

An attacker who wants to hold the only copy of a repository takes it first and deletes it afterwards. A deletion that follows a clone or an archive download of the same repository by the same account within a short time is that order of steps, while ordinary cleanup deletes repositories nobody has touched for months.

  1. A repository is copied: git.clone or repo.download_zip. Keep actor, repo and the time. GitHub delivers git.clone through the REST API, audit log streaming and exports only.
  2. Within 24 hours the same actor deletes the same repo: repo.destroy.
  3. Raise the priority when the same actor did this for several repositories, and when programmatic_access_type shows that a token was used.

Eventsgit.clonerepo.download_ziprepo.destroy

LimitsA developer who clones a repository to archive it elsewhere before deleting it matches as well, so ask for the change record. GitHub keeps Git events for seven days and does not show them in the web interface, so the first step needs a stream or the API. The 24 hours are a starting point.

Deletion or transfer by a non-owner after the policy was loosened

Detection hypothesisSequence of eventsNeeds your own lists

Where deletion and transfer are limited to organization owners, a repository administrator has to get the policy changed first. A policy change that allows members to delete or transfer repositories, followed by a deletion or an outgoing transfer, shows the control being removed and then used.

  1. The policy is loosened: members_can_delete_repos.enable or members_can_delete_repos.clear. Keep actor, business and the time.
  2. Within 7 days a repository in an organization of that enterprise is deleted or transferred: repo.destroy, repo.transfer_start or repo.transfer_outgoing.
  3. Alert when the actor of the second event is not on your list of organization owners.

Eventsmembers_can_delete_repos.enablemembers_can_delete_repos.clearrepo.destroyrepo.transfer_outgoing

LimitsThe list of organization owners is yours to maintain. The audit actions named here cover the enterprise policy. GitHub's event reference names no separate action for the organization setting, so a change made there is not covered. The 7 days are a starting point.

Triage

  • Identify who acted (actor), the repository (repo) and its visibility (visibility).
  • For a transfer, find out where the repository went. GitHub lists a new_nwo field for repo.transfer_outgoing without describing it, so read it on the event and confirm the new owner by opening the old repository address, which GitHub redirects to the new location.
  • Check whether the receiving account is one of your organizations. Transfers between organizations of the same enterprise are ordinary reorganization.
  • For deletions, count how many repositories the same actor deleted and over what time, and check under Deleted repositories in the organization settings whether they can still be restored.
  • Check whether a token did it (programmatic_access_type, hashed_token), and whether the account received admin access or the owner role shortly before.

Response

Once the attack is confirmed:

  1. Restore deleted repositories from the Deleted repositories page of the organization settings. GitHub allows this within 90 days unless the repository was part of a fork network that is not empty, and restoring does not bring back team permissions.
  2. For a transfer that was not intended, ask the receiving account to transfer the repository back. Where that account is hostile the repository is out of your reach, so treat its content, its secrets and its deploy keys as disclosed.
  3. Rotate the Actions secrets and deploy keys of a transferred repository and every credential that was stored in its code or history.
  4. Secure the account that acted. Revoke the token it used, or reset the credentials and end the sessions of a person's account, and remove the owner role or admin access it should not have.
  5. Set the deletion and transfer policy back to owners only if it was loosened, and restore the affected repositories from your own copies where GitHub cannot.

Mitigation

  • Limit repository deletion and transfer to organization owners, with the organization setting or with the enterprise policy that enforces it for all organizations.
  • Keep the number of organization owners small and protect those accounts with phishing-resistant two-factor authentication.
  • Lower the base permission of the organization, so that members do not hold admin access to every repository.
  • Keep copies of your repositories outside GitHub, so that a deletion or a transfer does not take the only copy.
  • Alert on every outgoing transfer and on several deletions by one account in a short time.

Frequently asked questions

Can a deleted repository be recovered?

Often, for a limited time. GitHub states that a deleted repository can be restored within 90 days, unless it was part of a fork network that is not currently empty, and that it can take up to an hour before a deleted repository is available for restoration. Organization owners restore repositories of the organization. Team permissions are not restored, and a deleted organization cannot be restored by GitHub at all.

Who can transfer or delete a repository that belongs to an organization?

Organization owners, and members with admin access to the repository when the policy allows it. The organization setting "Allow members to delete or transfer repositories for this organization" and the enterprise policy for repository deletion and transfer can limit both actions to organization owners. One setting covers both, so a member who may delete a repository may also transfer it.

What leaves the organization when a repository is transferred?

GitHub states that issues, pull requests, the wiki, stars and watchers are transferred with the repository, and that webhooks, services, secrets and deploy keys remain associated with it after the transfer. The new owner can administer all of it at once. The old address redirects to the new location until someone creates a repository at the old name.

Is there an incident report that shows this step in an audit log?

No public incident report describes a malicious repository transfer or deletion at the audit event level. The page is built on what GitHub documents these actions to do, and on the fact that one policy and one permission cover both of them.

References

We respect your privacy

We use cookies to keep this site secure and working properly. With your permission, we also use optional cookies to understand usage and improve the experience. Cookie Policy

You can change your choice at any time.