Severity:

CRITICAL RISK

(9.6)

Improper Authorization / Broken Access Control

CVE-2026-5845

Analyzed

Vulnerability type

Category:

Improper Authorization / Broken Access Control

CWE:

CWE-639

Impact:

Unauthorized Access to Private Repositories and Write Operations

Severity:

CRITICAL RISK

(9.6)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

An improper authorization vulnerability in GitHub Enterprise Server's scoped user-to-server (ghu_) token handling can allow an authenticated attacker to access private repositories outside the intended installation scope, including performing write operations.

Under specific revocation and fallback conditions, a revoked or deleted installation could be treated as a global context, enabling unauthorized access and potential reuse of a victim's scoped token.

Affected context

This vulnerability arises in GitHub Enterprise Server environments that:

  • Use scoped user-to-server (ghu_) tokens for app or automation integrations
  • Rely on installation-bound scopes to restrict repository access
  • Experience installation revocation or deletion events where token usage continues briefly

The issue manifests when the authorization system falls back to a broader, effectively global installation context after an installation is revoked or deleted, causing scoped tokens to be evaluated against an unintended access boundary.

Exploit preconditions

  • Attack surface: GitHub Enterprise Server API and Git operations where ghu_ tokens are accepted (including SSH push when attribution and token binding apply).
  • Required access: An authenticated attacker capable of interacting with the GitHub Enterprise Server instance and participating in flows where scoped ghu_ tokens are issued or observed.
  • Trigger point: Authorization checks performed for ghu_ tokens after an associated installation has been revoked or deleted, causing a fallback to a global-like context.
  • Why exploitation is possible: The authorization layer fails to strictly enforce installation scoping once the original installation context is removed, treating certain requests as if they were globally scoped and enabling access to private repositories outside the intended scope.

Why this happens

The underlying issue stems from improper access control logic associated with scoped user-to-server tokens and their installation context.

Instead of failing closed or strictly denying access when an installation is revoked or deleted, the system performs an authorization fallback that interprets the token in a broader, effectively global context.

This maps to CWE-639: Authorization Bypass Through User-Controlled Key, where identifiers or context keys (in this case, installation and token scope) are not correctly enforced, allowing a token bound to a narrow scope to be used for broader access.

The combination of this fallback behavior, token revocation timing, and SSH push attribution workflows makes it possible for an attacker to obtain or reuse a token with more privileges than intended.

Potential impact

  • Unauthorized read access to private repositories outside the original installation scope
  • Unauthorized write or push operations to private repositories, potentially modifying source code
  • Contamination of codebases with malicious changes (backdoors, data exfiltration logic, or sabotage)
  • Exposure of proprietary source code, secrets stored in repositories, or internal tooling definitions
  • Lateral movement across projects via tampering with automation, CI/CD configs, or dependency definitions

General mitigation guidance

Effective mitigation focuses on ensuring strict, non-fallback access control and defensive token lifecycle management:

  • Enforce a fail-closed model where any token linked to a revoked or deleted installation is treated as invalid, without attempting to reinterpret it in a broader context.
  • Ensure that authorization checks always bind ghu_ tokens to a concrete, existing installation context and repository set, rejecting any request if that context cannot be resolved.
  • Implement rigorous token lifecycle policies, including immediate invalidation and revocation propagation, to minimize timing gaps where a token can be reused.
  • Reduce token privilege by default (least privilege), granting the minimum repository access necessary, and prefer narrowly scoped tokens for automation.
  • Strengthen controls around SSH push attribution and token linkage so that identity and scope cannot be repurposed or inferred in ways that broaden access.
  • Apply defense-in-depth with monitoring, approvals, and branch protections so that a single token misuse cannot easily result in undetected code compromise.

How teams detect issues like this

Organizations can look for this class of authorization flaws and their symptoms through a combination of code-centric and operational techniques:

  • Static analysis & code review:
  • Inspect authorization modules for fallback logic that changes or widens scope when the primary installation or context is missing.
  • Flag any patterns where a missing or revoked installation is handled by defaulting to a global or less restrictive policy instead of failing closed.
  • Review token validation code to ensure tokens are always tied to existing, strictly-defined scopes (e.g., explicit repository lists or organization IDs).
  • Policy enforcement:
  • Enforce internal secure coding guidelines that prohibit permissive fallbacks in access control and require explicit handling of revoked contexts.
  • Integrate automated security checks into CI/CD that look for dangerous patterns such as "on failure, allow" or "if not found, treat as global."
  • Runtime monitoring & logging:
  • Monitor audit logs for ghu_ token usage accessing repositories not normally associated with a given installation or integration.
  • Alert on anomalous write operations from tokens that historically performed only read or narrowly scoped actions.
  • Track token revocation events and subsequent activity to identify any suspicious continued use or scope changes.

Sources

SourceLink
docs.github.comdocs.github.com/en/enterprise-server@3.14/admin/release-notes#3.14.26
docs.github.comdocs.github.com/en/enterprise-server@3.15/admin/release-notes#3.15.21
docs.github.comdocs.github.com/en/enterprise-server@3.16/admin/release-notes#3.16.17
docs.github.comdocs.github.com/en/enterprise-server@3.17/admin/release-notes#3.17.14
docs.github.comdocs.github.com/en/enterprise-server@3.18/admin/release-notes#3.18.8
docs.github.comdocs.github.com/en/enterprise-server@3.19/admin/release-notes#3.19.5
docs.github.comdocs.github.com/en/enterprise-server@3.20/admin/release-notes#3.20.1

Frequently asked

questions

It can be exploited remotely in the sense that an attacker can interact with the GitHub Enterprise Server instance over the network, but they must already be an authenticated user and able to participate in workflows involving scoped ghu_ tokens and installations.

The attacker needs valid credentials to the GitHub Enterprise Server environment and the ability to trigger or take advantage of installation revocation and token flows.

They do not need direct administrative access to the server, but they do need sufficient access to obtain or leverage a victim-scoped token in the affected context.

The most robust fix is to make authorization strictly context-bound and fail-closed:

any token whose installation is revoked, deleted, or cannot be resolved must be treated as invalid, with no fallback to broader or global access.

Every authorization decision must confirm that the token's scope, installation, and target repository set match the requested operation exactly.

Preventive strategies include designing access control with explicit scope binding, avoiding permissive fallbacks, and enforcing least privilege for tokens and apps.

Regular security reviews of authentication and authorization flows, combined with automated tests that cover revocation, deletion, and edge-case scenarios, help catch logic flaws early.

Additionally, strong observability around token usage and repository access patterns can surface abnormal behavior before it causes significant damage.

Find out what's already
exploitable in your codebase.