CVE-2024-53858
Medium · 6.5CVSS
6.5
EPSS
0.3%
Published
Nov 27, 2024
CISA due date
—
Cloudanix analysis
A command-line tool for working with GitHub code repositories could accidentally send login credentials to outside servers when handling code that includes parts from other locations, potentially allowing unauthorized access to accounts.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- High
- Impact
- Data Exposure
- Component
- Application
- Class
- Credential Exposure
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The gh CLI passes GitHub authentication tokens sourced from GITHUB_ENTERPRISE_TOKEN, GH_ENTERPRISE_TOKEN, or GITHUB_TOKEN (when CODESPACES is set) to git credential.helper for any host encountered during submodule operations in gh repo clone, gh repo fork, and gh pr checkout, causing tokens intended for GitHub to be sent to non-GitHub hosts.
Why it matters to the business
Exposure of authentication tokens can allow unauthorized repository access, data exfiltration, or code changes; the issue affects organizations relying on the gh CLI for repository operations involving external submodules, increasing risk of credential compromise across developer workflows.
How an attack unfolds
An attacker hosts a malicious submodule on an external server and embeds a reference in a repository; when a victim uses affected gh commands to clone, fork, or checkout a pull request, gh configures git to retrieve tokens via credential.helper and forwards valid tokens to the attacker's host.
How to fix it
Upgrade the GitHub CLI to version 2.63.0 or later (commit 1fe14c956d057e6abda50a76d8820a6e668ba70a). After upgrading, revoke any tokens that may have been exposed, review personal security logs and relevant audit logs, and avoid using the listed commands with external submodules until patched.
How to confirm the fix worked
Verify gh version is 2.63.0 or newer; test cloning a repository with an external submodule and confirm no tokens are sent to non-GitHub hosts via credential.helper; inspect environment variables and audit logs for prior usage of GITHUB_ENTERPRISE_TOKEN or GITHUB_TOKEN with external hosts.
Typical attack path
- Create or compromise a repository containing a git submodule hosted on an attacker-controlled non-GitHub server
- Publish or share the repository to induce cloning via gh repo clone, gh repo fork, or gh pr checkout
- Trigger the vulnerable gh command on a system with valid GitHub tokens in environment variables or secure storage
- Intercept the authentication token forwarded by git to the external host
How to detect it
Examine personal security logs and enterprise audit logs for actions associated with repository cloning, forking, or checkout involving external hosts; search for environment variable usage of GITHUB_ENTERPRISE_TOKEN, GH_ENTERPRISE_TOKEN, or GITHUB_TOKEN during git operations with non-GitHub hosts.
- GITHUB_ENTERPRISE_TOKEN used with external git host
- GH_ENTERPRISE_TOKEN sent via credential.helper
- GITHUB_TOKEN forwarded during submodule clone from non-github.com host
What your security team should do
- Upgrade all instances of the GitHub CLI to 2.63.0 or later immediately
- Revoke and rotate any tokens used with the gh CLI
- Review personal security logs and enterprise audit logs for suspicious clone or authentication events
- Restrict use of gh commands with repositories containing external submodules until validation is complete
The record
The gh cli is GitHub’s official command line tool. A security vulnerability has been identified in the GitHub CLI that could leak authentication tokens when cloning repositories containing `git` submodules hosted outside of GitHub.com and ghe.com. This vulnerability stems from several `gh` commands used to clone a repository with submodules from a non-GitHub host including `gh repo clone`, `gh repo fork`, and `gh pr checkout`. These GitHub CLI commands invoke git with instructions to retrieve authentication tokens using the `credential.helper` configuration variable for any host encountered. Prior to version `2.63.0`, hosts other than GitHub.com and ghe.com are treated as GitHub Enterprise Server hosts and have tokens sourced from the following environment variables before falling back to host-specific tokens stored within system-specific secured storage: 1. `GITHUB_ENTERPRISE_TOKEN`, 2. `GH_ENTERPRISE_TOKEN` and 3. `GITHUB_TOKEN` when the `CODESPACES` environment variable is set. The result being `git` sending authentication tokens when cloning submodules. In version `2.63.0`, these GitHub CLI commands will limit the hosts for which `gh` acts as a credential helper to source authentication tokens. Additionally, `GITHUB_TOKEN` will only be used for GitHub.com and ghe.com. Users are advised to upgrade. Additionally users are advised to revoke authentication tokens used with the GitHub CLI and to review their personal security log and any relevant audit logs for actions associated with their account or enterprise
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Go | github.com/cli/cli | 0 | No fix |
| Go | github.com/cli/cli/v2 | 0 | 2.63.0 |
| Chainguard | gh | 0 | 2.63.0-r0 |
| Chainguard | gh-doc | 0 | 2.63.0-r0 |
| Debian:12 | gh | 0 | No fix |
| Debian:13 | gh | 0 | No fix |
| Ubuntu:22.04:LTS | gh | 0 | No fix |
| Ubuntu:24.04:LTS | gh | 0 | No fix |
| Ubuntu:24.10 | gh | 0 | No fix |
| Ubuntu:25.04 | gh | 0 | No fix |
| Ubuntu:25.10 | gh | 0 | No fix |
| Ubuntu:Pro:24.04:LTS | gh | 0 | No fix |
| Ubuntu:Pro:24.04:LTS | gh | 0 | 2.45.0-1ubuntu0.3+esm2 |
| Wolfi | gh | 0 | 2.63.0-r0 |
| Wolfi | gh-doc | 0 | 2.63.0-r0 |
| openSUSE:Tumbleweed | govulncheck-vulndb | 0 | 0.0.20241209T183251-1.1 |
Related vulnerabilities
- CVE-2024-54132 The GitHub CLI is GitHub’s official command line tool. Also affects github.com/cli/cli
- CVE-2024-52308 Connecting to a malicious Codespaces via GH CLI could allow command execution on the… Also affects github.com/cli/cli
- CVE-2025-15558 Docker CLI for Windows searches for plugin binaries in C:\ProgramData\Docker\cli-plugins… Also affects gh
- CVE-2026-24686 go-tuf is a Go implementation of The Update Framework (TUF). Also affects gh
- CVE-2026-24137 sigstore framework is a common go library shared across sigstore services and clients. Also affects gh
- CVE-2026-24117 Rekor is a software supply chain transparency log. Also affects gh
- CVE-2026-23831 Rekor is a software supply chain transparency log. Also affects gh
- CVE-2026-23991 go-tuf is a Go implementation of The Update Framework (TUF). Also affects gh