Severity:

CRITICAL RISK

(9.0)

Open Redirect / Token Leakage in GitHub Enterprise Server

CVE-2026-0573

Analyzed

Vulnerability type

Category:

Open Redirect / Token Leakage

CWE:

CWE-601

Impact:

Privilege Escalation and Potential Remote Code Execution via Token Exfiltration

Severity:

CRITICAL RISK

(9.0)

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 open redirect vulnerability in GitHub Enterprise Server's repository_pages API allowed attacker-controlled URLs to receive HTTP requests that still included privileged authorization headers.

When artifact URLs followed untrusted redirects, the server preserved a high-privilege JWT, enabling an authenticated attacker with redirect control to exfiltrate the token and potentially achieve remote code execution.

Affected context

This vulnerability occurs in GitHub Enterprise Server when the repository_pages API fetches artifact URLs and automatically follows HTTP redirects.

In affected configurations, redirect targets were not adequately constrained to trusted domains, and the HTTP client preserved authorization headers across redirects.

The issue is relevant where:

  • Repository Pages artifacts are fetched via URLs that can be influenced by users
  • Legacy or misconfigured redirects can point to attacker-controlled domains
  • High-privilege JWTs (such as Actions.ManageOrgs) are attached to outgoing artifact fetch requests

Exploit preconditions

  • Attack surface: Internal to the GitHub Enterprise Server instance, exposed via the repository_pages API behavior when fetching artifacts.
  • Required access: Authenticated access to the target GitHub Enterprise Server instance, with the ability to trigger artifact fetches that follow redirects.
  • Redirect control: Ability to exploit or configure a legacy redirect so that an artifact URL ultimately points to an attacker-controlled domain.
  • Trigger point: An artifact fetch initiated by repository_pages that follows an HTTP redirect chain while retaining the authorization header.
  • Why exploitation is possible: The HTTP client used by the API did not strip or constrain authorization headers on cross-origin redirects, allowing JWT-bearing requests to be sent to untrusted domains.

Why this happens

The core issue stems from improper handling of HTTP redirects combined with sensitive authorization headers.

When following redirects, the repository_pages API reused the same HTTP authorization header, including a privileged JWT, even when the redirect target pointed to a different, potentially attacker-controlled origin.

This aligns with CWE-601: URL Redirection to Untrusted Site, in which unvalidated or insufficiently constrained redirects lead users or server-side requests to attacker-owned domains.

In this case, the insecure pattern is a server-side HTTP client that:

  • Accepts redirect responses without restricting the final destination to a trusted host or scheme
  • Preserves sensitive headers across redirect boundaries instead of stripping or re-evaluating them

This combination turns an open redirect into a token exfiltration channel rather than a simple navigation flaw.

Potential impact

  • Theft of a privileged Actions.ManageOrgs JWT via attacker-controlled redirect endpoints
  • Privilege escalation inside the GitHub Enterprise Server environment using the stolen JWT
  • Potential remote code execution through abuse of high-privilege Actions or organization management capabilities
  • Unauthorized changes to repositories, organizations, or CI/CD pipelines
  • Lateral movement and further compromise of source code, secrets, and build artifacts

General mitigation guidance

Effective mitigation centers on constraining redirects and protecting sensitive headers:

  • Restrict redirect handling so that server-side HTTP clients only follow redirects to a vetted set of trusted domains or exact hostnames.
  • Implement strict validation of redirect targets (scheme, host, and port) before following them; deny or log any redirects to untrusted origins.
  • Strip or re-compute sensitive headers (such as Authorization, cookies, or custom auth tokens) on any redirect that crosses origin or domain boundaries.
  • Use context-scoped, least-privilege tokens for server-to-server requests, minimizing the blast radius if a token is exposed.
  • Architect internal APIs so that artifact resolution uses internal, authenticated endpoints rather than arbitrary external URLs where possible.
  • Prefer secure-by-default HTTP client libraries or wrappers that disable automatic redirect following or enforce header-dropping policies across redirects.

How teams detect issues like this

Detection typically combines code-level analysis and behavioral monitoring:

  • Static analysis and code review:
  • Search for HTTP client usages that enable automatic redirect following (e.g., followRedirects = true, or equivalent).
  • Flag patterns where Authorization headers are attached to requests whose URLs are derived from user-controlled or indirectly controlled inputs.
  • Review redirect validation logic to ensure hosts, schemes, and ports are explicitly whitelisted before being followed.
  • Security testing:
  • Implement automated tests that simulate redirects from internal endpoints to external domains and verify that sensitive headers are removed.
  • Use dynamic application security testing (DAST) to probe redirect behavior of internal API clients for header leakage.
  • Runtime monitoring:
  • Monitor outbound HTTP requests from the GitHub Enterprise Server instance for calls that include high-privilege tokens to unexpected domains.
  • Create alerts when requests with Authorization headers target domains outside the approved list.
  • Automated code review tools and SAST platforms can be configured to detect unvalidated redirects and header persistence across redirects as policy violations.

Sources

SourceLink
docs.github.comdocs.github.com/en/enterprise-server@3.14/admin/release-notes#3.14.22
docs.github.comdocs.github.com/en/enterprise-server@3.15/admin/release-notes#3.15.17
docs.github.comdocs.github.com/en/enterprise-server@3.16/admin/release-notes#3.16.13
docs.github.comdocs.github.com/en/enterprise-server@3.17/admin/release-notes#3.17.10
docs.github.comdocs.github.com/en/enterprise-server@3.18/admin/release-notes#3.18.4
docs.github.comdocs.github.com/en/enterprise-server@3.19/admin/release-notes#3.19.2

Frequently asked

questions

Not directly. An attacker must have authenticated access to the target GitHub Enterprise Server instance and the ability to influence or exploit redirects. However, once those conditions are met, the token exfiltration can be leveraged for high-impact actions.

The attacker needs a valid account on the GitHub Enterprise Server instance and a way to cause repository_pages to follow a redirect chain that ends at an attacker-controlled domain. Direct administrative access is not required, but the resulting stolen token can grant elevated privileges.

The most robust pattern is to strictly validate redirect destinations and to strip sensitive headers on any redirect to a different origin. In practice, this means using allowlists for redirect targets, disabling automatic redirect following where it is not essential, and ensuring authorization headers are applied only to clearly trusted endpoints.

Treat redirects and outbound HTTP calls as high-risk interfaces. Design internal clients to:

  • Avoid following redirects to untrusted domains by default
  • Enforce clear trust boundaries and origin checks before sending tokens
  • Use narrowly scoped, least-privilege tokens for each operation
  • Subject redirect-handling logic to dedicated security review and automated tests that verify header-stripping and origin constraints.
Find out what's already
exploitable in your codebase.