1. Resources
  2. Identity Threats
  3. GitHub

GitHub Organization and Repository Reconnaissance

Also known as: GitHub enumeration, GitHub org recon, GitHub repository enumeration, GitHub member enumeration

Anyone can read a GitHub organization's public footprint, and any member or stolen token can map its members, teams, repositories, roles and installed apps through the API.

Platform
GitHub
Impact
Low
Last updated
Attack difficulty
Low
Detection difficulty
High
Privileges required: No account
None for public data. Any organization member, outside collaborator or stolen token for the internal view. Owner for policy settings and app installations.
What the attacker gains
A map of members, owners, teams, repositories, roles, outside collaborators and installed apps that shows which identity to attack next.
Threat groups
APT29Storm-0501Contagious InterviewHAFNIUMLAPSUS$ShinyHuntersGroups that MITRE ATT&CK records using T1087.004, T1069.003, T1526, T1593.003.

How it works

Every attack on a GitHub organization starts with the same question: which identity can reach which repository. GitHub answers most of it through documented REST endpoints, and the answer grows with the caller's standing.

  • Anonymous or any GitHub account. The organization's public profile, its public repositories, and the members who made their membership public. A public repository snapshot also carries commit author names and e-mail addresses, workflow files and the fork network.
  • A member, an outside collaborator, or a token stolen from one. GET /orgs/{org}/members returns both concealed and public members when the caller is a member. The caller also sees the teams visible to them, the repositories their role reaches, and their own permission on each repository.
  • An organization owner. The full organization settings (whether two-factor authentication is required, the base repository permission), the members without two-factor authentication, and every GitHub App installation with its repository selection and permissions.

Access to a repository can come from several routes at once: organization membership and the organization's base permission, a team grant, a direct collaborator grant, an outside collaborator grant, a GitHub App installation, or public visibility. Repository roles are read, triage, write, maintain and admin, and organizations can add custom roles. Reconnaissance is the work of resolving those routes into one list of who can write where. That list is the organization's identity attack surface.

The same calls are what administrators and inventory tools make every day, which is why this activity is hard to tell from normal use.

Prerequisites

  • For the public view: nothing. An unauthenticated client can call the public endpoints.
  • For the internal view: any credential that belongs to a member or outside collaborator. A session, a personal access token, an SSH key, or an OAuth or GitHub App token. A classic token needs read:org to read membership and teams and repo to list collaborators.
  • For policy settings, two-factor status and app installations: an organization owner.
  • An organization where the base permission gives every member read access, where membership is public, or where tokens carry broad scopes, returns far more to a low-privileged caller.

Attack steps

For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.

The examples use the organization example-org. gh api sends an authenticated request with the token GitHub CLI holds, or the one in GH_TOKEN.

1. Read the public footprint

# Public profile, without credentials
curl -s https://api.github.com/orgs/example-org

# Members who made their membership public
gh api orgs/example-org/public_members --paginate --jq '.[].login'

# Public repositories: forks, last push and default branch
gh repo list example-org --visibility public --limit 1000 \
  --json nameWithOwner,isFork,pushedAt,defaultBranchRef

Public repositories are also where leaked secrets are found, so most operators run a secret scanner over this list next.

2. Classify the credential

With a token in hand, find out what it is before using it. The response headers of any API call list a classic token's scopes:

curl -sI -H "Authorization: Bearer $GH_TOKEN" https://api.github.com/user
# X-OAuth-Scopes: read:org, repo
# X-Accepted-OAuth-Scopes: the scopes the endpoint checks for

# Whose token it is, and which organizations it belongs to
gh api user --jq '.login'
gh api user/orgs --jq '.[].login'

GET /user/orgs needs read:org or user on a classic token. A fine-grained token gets an empty list from it, because a fine-grained token is bound to one resource owner.

3. Map members, owners and teams

# All members (concealed ones too, when the caller is a member)
gh api orgs/example-org/members --paginate --jq '.[].login'

# Organization owners
gh api -X GET orgs/example-org/members -f role=admin --paginate --jq '.[].login'

# Teams visible to the caller, and the repositories of one team
gh api orgs/example-org/teams --paginate --jq '.[].slug'
gh api orgs/example-org/teams/platform-admins/repos --paginate \
  --jq '.[] | [.full_name, .role_name] | @tsv'

# Outside collaborators
gh api orgs/example-org/outside_collaborators --paginate --jq '.[].login'

4. Map repositories and the caller's own rights

# Every repository the caller can see, with visibility, fork flag and own permissions
gh api -X GET orgs/example-org/repos -f type=all --paginate \
  --jq '.[] | [.full_name, .visibility, .fork, .default_branch, (.permissions | tostring)] | @tsv'

# Who else can reach one repository, and with which role (needs write access or higher)
gh api repos/example-org/example-repo/collaborators --paginate \
  --jq '.[] | [.login, .role_name] | @tsv'

# Only the outside collaborators of that repository
gh api -X GET repos/example-org/example-repo/collaborators -f affiliation=outside \
  --jq '.[] | [.login, .role_name] | @tsv'

The permissions object on each repository (admin, maintain, push, triage, pull) is the caller's own access. role_name on a collaborator is the highest role after all grants are combined; the endpoint does not say whether it came from the organization, a team or a direct grant.

5. With an owner identity: policy and apps

# Organization-wide settings
gh api orgs/example-org \
  --jq '{two_factor_requirement_enabled, default_repository_permission, members_can_create_repositories}'

# Members without two-factor authentication
gh api -X GET orgs/example-org/members -f filter=2fa_disabled --paginate --jq '.[].login'

# Installed GitHub Apps, their repository selection and permissions
gh api orgs/example-org/installations --paginate \
  --jq '.installations[] | [.app_slug, .repository_selection, (.permissions | tostring)] | @tsv'

An app installed on all repositories with write permissions is an identity as powerful as an owner for code, and it is not a person.

Impact

Reconnaissance changes nothing by itself. Its product is a target list:

  • owners and members without two-factor authentication, for phishing and password attacks
  • outside collaborators and former contractors who still hold a repository role
  • repositories where a low-value identity has write, maintain or admin, which is overprivileged access
  • apps installed on all repositories, whose keys and tokens are worth stealing
  • public repositories and forks to scan for credentials

When the base permission is read or higher, the attacker can also clone every repository the organization owns, which is where source code theft and secret harvesting start.

OPSEC and artifacts

  • Staying on public endpoints. Unauthenticated reads of public data are not tied to any organization identity, and coverage of authenticated events says nothing about anonymous readers. Nothing in the organization's logs records them.
  • Using the API instead of the web interface. Read-only API calls are not written to the ordinary organization audit log, which records changes: org.add_member means a member was added, not that someone listed members. The trace exists only where an enterprise owner enabled API request streaming, as api.request events with route, request_method, url_path, status_code, the actor, the user agent and the hashed token.
  • Keeping the request rate low. Paging slowly through members and repositories avoids a visible burst in the stream. The requests are still recorded one by one when streaming is on.
  • Not cloning. Listing repositories leaves less than cloning them. Each clone writes a git.clone Git event, and each archive download a repo.download_zip event. Git events are kept for seven days and never appear in the web interface.
  • Matching the tooling. A request with the user agent of GitHub CLI from a developer's usual network looks like the developer. The same token used from a new address or with a script's user agent is the anomaly defenders can find.

Detection

Detection depends on collecting the right surface first.

  • API request events. On GitHub Enterprise Cloud, enable API request streaming in the enterprise audit log settings. GitHub limits it to security relevant endpoints. In the stream, look for one actor or one hashed_token paging through /orgs/{org}/members, /orgs/{org}/teams, /orgs/{org}/repos and /repos/{owner}/{repo}/collaborators in a short time, for 403 and 404 responses that show a token probing for its limits, and for tokens used from a new address or user agent.
  • Git events. Enumeration is usually followed by collection. The bulk clone and export rules count the repositories one actor cloned (git.clone) or downloaded as an archive (repo.download_zip).
  • Changes that widen what reconnaissance returns. A change of the base permission (org.update_default_repository_permission), a repository made public, a new member (org.add_member) or a new outside collaborator.

Git events are not shown in the web interface. Request them through the audit log API:

# Clones in the organization, from the audit log API (Git events are kept for seven days)
gh api -X GET orgs/example-org/audit-log -f phrase='action:git.clone' -f include=git --paginate \
  --jq '.[] | [.actor, .repo, .transport_protocol_name, .programmatic_access_type] | @tsv'

To follow one credential through the log, hash the token and search for it:

echo -n "$TOKEN" | openssl dgst -sha256 -binary | base64
hashed_token:"VALUE"

Mitigation

  • Set the base permission to no access and grant repositories through teams, following least privilege. A member or stolen token then sees only the repositories its teams reach.
  • Restrict tokens. Block or limit classic personal access tokens, and require approval for fine-grained tokens, so a stolen token is bound to named repositories. The personal access token security guide covers the policy and the inventory.
  • Require two-factor authentication and SAML single sign-on, so that a password alone does not open the internal view, and a classic token must be authorized for the organization before it works.
  • Review outside collaborators and app installations on a schedule. Change installations from all repositories to selected repositories.
  • Keep internal names out of public repositories. Workflow files, commit e-mail addresses and documentation in public repositories describe the private side.
  • Collect the logs that show reads. Stream the audit log with Git events and API request events to storage you control, because the organization audit log covers 180 days and Git events only seven.

Detection rules for this attack

Log events to collect

FAQ

What can an attacker learn about a GitHub organization without an account?

The organization's public profile, its public repositories and their forks, and the members who chose to make their membership public. Public repositories also expose commit authors, workflow files and contributor names. Private repositories, concealed members and teams need an authenticated identity inside the organization.

Does GitHub log read-only API calls such as listing members or repositories?

Not in the ordinary organization audit log, which records changes such as a member being added. GitHub Enterprise Cloud can stream API request events for security relevant endpoints when an enterprise owner enables the option, and Git events such as clones are kept for seven days and are only available through the API, streaming and exports.

Why does a stolen token make reconnaissance so much more useful?

A member sees concealed members, the teams visible to them, and every repository their role reaches. With the organization's base permission set to read, that is every repository in the organization. The token's own scopes and repository permissions then show which of those repositories it can change.

References

Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.

Does this attack work in your environment?

Forestall maps every identity and the attack paths between them across Active Directory, Entra ID and cloud, read-only and agentless.