GitHub Outside Collaborator Added to Repository

Identifies an outside collaborator being added to a GitHub repository. An outside collaborator is an individual account that is not a member of the organization but is granted direct access to one or more repositories. An attacker who has compromised an account or token can add a collaborator they control to retain access to private source code after the original credential is revoked, bypassing organization SSO and team-based review. This is distinct from adding an organization member (org.add_member), which is covered by a separate rule.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2026/09/22"
  3integration = ["github"]
  4maturity = "production"
  5updated_date = "2026/09/22"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10Identifies an outside collaborator being added to a GitHub repository. An outside collaborator is an individual account
 11that is not a member of the organization but is granted direct access to one or more repositories. An attacker who has
 12compromised an account or token can add a collaborator they control to retain access to private source code after the
 13original credential is revoked, bypassing organization SSO and team-based review. This is distinct from adding an
 14organization member (`org.add_member`), which is covered by a separate rule.
 15"""
 16false_positives = [
 17    """
 18    Onboarding a contractor or vendor as an outside collaborator, or adding a personal account during a documented
 19    inner-source exercise. Confirm the collaborator, repository, and permission with the repo owners.
 20    """,
 21]
 22from = "now-9m"
 23language = "esql"
 24license = "Elastic License v2"
 25name = "GitHub Outside Collaborator Added to Repository"
 26note = """## Triage and analysis
 27
 28> **Disclaimer**:
 29> 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.
 30
 31### Investigating GitHub Outside Collaborator Added to Repository
 32
 33This rule fires on `org.add_outside_collaborator`, logged when an account outside the organization is granted repository access. Outside collaborators are granted direct repository access without being organization members, so they frequently bypass organization SSO and team-based review, making this a convenient persistence mechanism after account or token compromise. Review the actor (`user.name`, `github.actor_ip`), the repository and permission level (`github.repo`, `github.permission`), and the token used (`github.hashed_token`, `github.programmatic_access_type`) to determine whether the grant was authorized. Identify the outside collaborator from the audit event details in the GitHub UI, since the GitHub integration does not currently map the collaborator to a dedicated field. When the action is performed through the GitHub web UI, `github.programmatic_access_type` and `github.hashed_token` may be empty; a fine-grained PAT, classic PAT, or OAuth token on this action is a stronger compromise signal.
 34
 35### Possible investigation steps
 36
 37- Identify the actor using `user.name` and `github.actor_ip`, confirm whether the actor is a repository administrator who normally manages collaborators, and identify the added collaborator from the audit event details.
 38- Review `github.repo` and `github.permission` to understand which repository was shared and at what level, prioritizing write or admin grants on private repositories.
 39- Check `github.programmatic_access_type` and `github.hashed_token` to determine whether the grant was made interactively or with a token; token-backed additions should be treated as higher urgency than a logged-in owner using the UI.
 40- Confirm that the added account does not belong to the organization; outside collaborators bypass organization SSO and team review more often than members, so an unfamiliar external account is higher risk.
 41- Pivot to clones, archive downloads, and `git.push` events by the collaborator or the same hashed token after the add, which indicate the access is already being used.
 42
 43### False positive analysis
 44
 45- Approved contractor or vendor access added as an outside collaborator with a change ticket and an expiry date. Confirm the collaborator, repository, and permission with the repository owners before dismissing.
 46- A maintainer adding their own secondary account for testing in a non-production organization. Validate against the actor and scope exceptions where appropriate.
 47
 48### Response and remediation
 49
 50- If the collaborator was not authorized, remove them from the repository.
 51- Revoke the actor's sessions and the token identified by `github.hashed_token` if the addition was not approved, and require the user to reauthenticate.
 52- Review the repository's permissions and the organization's outside-collaborator policy, tightening who can grant access to external accounts.
 53- Review activity by the collaborator and the actor for clones, archive downloads, or pushes that indicate private code was already accessed.
 54- Engage incident response per your organization's playbooks if account or token compromise is confirmed.
 55"""
 56references = [
 57    "https://docs.github.com/en/organizations/managing-user-access-to-your-organizations-repositories/managing-outside-collaborators/adding-outside-collaborators-to-repositories-in-your-organization",
 58    "https://docs.github.com/en/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/audit-log-events-for-your-organization",
 59]
 60risk_score = 47
 61rule_id = "06e6f38c-436a-4fe3-a29b-3d8d22c42c10"
 62severity = "medium"
 63tags = [
 64    "Domain: Cloud",
 65    "Domain: SaaS",
 66    "Platform: GitHub",
 67    "Use Case: Threat Detection",
 68    "Tactic: Persistence",
 69    "Data Source: Github",
 70    "Data Source: GitHub Audit Logs",
 71    "Rule Type: ES|QL",
 72    "Resources: Investigation Guide",
 73]
 74timestamp_override = "event.ingested"
 75type = "esql"
 76
 77query = '''
 78from logs-github.audit-* metadata _id, _index, _version
 79| where
 80  data_stream.dataset == "github.audit"
 81    and event.action == "org.add_outside_collaborator"
 82| keep
 83    _id,
 84    _index,
 85    _version,
 86    @timestamp,
 87    event.action,
 88    user.name,
 89    github.org,
 90    github.repo,
 91    github.actor_ip,
 92    github.hashed_token,
 93    github.programmatic_access_type,
 94    github.user_agent,
 95    github.permission
 96'''
 97
 98
 99[[rule.threat]]
100framework = "MITRE ATT&CK"
101[[rule.threat.technique]]
102id = "T1098"
103name = "Account Manipulation"
104reference = "https://attack.mitre.org/techniques/T1098/"
105[[rule.threat.technique.subtechnique]]
106id = "T1098.003"
107name = "Additional Cloud Roles"
108reference = "https://attack.mitre.org/techniques/T1098/003/"
109
110
111
112[rule.threat.tactic]
113id = "TA0003"
114name = "Persistence"
115reference = "https://attack.mitre.org/tactics/TA0003/"
116
117[rule.investigation_fields]
118field_names = [
119    "@timestamp",
120    "event.action",
121    "user.name",
122    "github.org",
123    "github.repo",
124    "github.actor_ip",
125    "github.hashed_token",
126    "github.programmatic_access_type",
127    "github.user_agent",
128    "github.permission",
129]

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 Outside Collaborator Added to Repository

This rule fires on org.add_outside_collaborator, logged when an account outside the organization is granted repository access. Outside collaborators are granted direct repository access without being organization members, so they frequently bypass organization SSO and team-based review, making this a convenient persistence mechanism after account or token compromise. Review the actor (user.name, github.actor_ip), the repository and permission level (github.repo, github.permission), and the token used (github.hashed_token, github.programmatic_access_type) to determine whether the grant was authorized. Identify the outside collaborator from the audit event details in the GitHub UI, since the GitHub integration does not currently map the collaborator to a dedicated field. When the action is performed through the GitHub web UI, github.programmatic_access_type and github.hashed_token may be empty; a fine-grained PAT, classic PAT, or OAuth token on this action is a stronger compromise signal.

Possible investigation steps

  • Identify the actor using user.name and github.actor_ip, confirm whether the actor is a repository administrator who normally manages collaborators, and identify the added collaborator from the audit event details.
  • Review github.repo and github.permission to understand which repository was shared and at what level, prioritizing write or admin grants on private repositories.
  • Check github.programmatic_access_type and github.hashed_token to determine whether the grant was made interactively or with a token; token-backed additions should be treated as higher urgency than a logged-in owner using the UI.
  • Confirm that the added account does not belong to the organization; outside collaborators bypass organization SSO and team review more often than members, so an unfamiliar external account is higher risk.
  • Pivot to clones, archive downloads, and git.push events by the collaborator or the same hashed token after the add, which indicate the access is already being used.

False positive analysis

  • Approved contractor or vendor access added as an outside collaborator with a change ticket and an expiry date. Confirm the collaborator, repository, and permission with the repository owners before dismissing.
  • A maintainer adding their own secondary account for testing in a non-production organization. Validate against the actor and scope exceptions where appropriate.

Response and remediation

  • If the collaborator was not authorized, remove them from the repository.
  • Revoke the actor's sessions and the token identified by github.hashed_token if the addition was not approved, and require the user to reauthenticate.
  • Review the repository's permissions and the organization's outside-collaborator policy, tightening who can grant access to external accounts.
  • Review activity by the collaborator and the actor for clones, archive downloads, or pushes that indicate private code was already accessed.
  • Engage incident response per your organization's playbooks if account or token compromise is confirmed.

References

Related rules

to-top