GitHub Outside Collaborator Added to Repository
editGitHub Outside Collaborator Added to Repository
editIdentifies 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.
Rule type: esql
Rule indices: None
Severity: medium
Risk score: 47
Runs every: 5m
Searches indices from: now-9m (Date Math format, see also Additional look-back time)
Maximum alerts per execution: 100
References:
- https://docs.github.com/en/organizations/managing-user-access-to-your-organizations-repositories/managing-outside-collaborators/adding-outside-collaborators-to-repositories-in-your-organization
- https://docs.github.com/en/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/audit-log-events-for-your-organization
Tags:
- Domain: Cloud
- Domain: SaaS
- Platform: GitHub
- Use Case: Threat Detection
- Tactic: Persistence
- 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 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.nameandgithub.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.repoandgithub.permissionto understand which repository was shared and at what level, prioritizing write or admin grants on private repositories. -
Check
github.programmatic_access_typeandgithub.hashed_tokento 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.pushevents 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_tokenif 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.
Rule query
editfrom logs-github.audit-* metadata _id, _index, _version
| where
data_stream.dataset == "github.audit"
and event.action == "org.add_outside_collaborator"
| keep
_id,
_index,
_version,
@timestamp,
event.action,
user.name,
github.org,
github.repo,
github.actor_ip,
github.hashed_token,
github.programmatic_access_type,
github.user_agent,
github.permission
Framework: MITRE ATT&CKTM
-
Tactic:
- Name: Persistence
- ID: TA0003
- Reference URL: https://attack.mitre.org/tactics/TA0003/
-
Technique:
- Name: Account Manipulation
- ID: T1098
- Reference URL: https://attack.mitre.org/techniques/T1098/
-
Sub-technique:
- Name: Additional Cloud Roles
- ID: T1098.003
- Reference URL: https://attack.mitre.org/techniques/T1098/003/