Ecosyste.ms: Advisories
An open API service providing security vulnerability metadata for many open source software ecosystems.
Security Advisories: GSA_kwCzR0hTQS1qd2NtLTlnMzktcG1jd84ABB4c
Recursive repository cloning can leak authentication tokens to non-GitHub submodule hosts
Summary
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.
Details
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
, 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 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:
GITHUB_ENTERPRISE_TOKEN
GH_ENTERPRISE_TOKEN
GITHUB_TOKEN
whenCODESPACES
environment variable is set
The result being git
sending authentication tokens when cloning submodules.
In 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.
Impact
Successful exploitation could lead to a third-party using leaked authentication tokens to access privileged resources.
Remediation and mitigation
- Upgrade
gh
to2.63.0
- Revoke authentication tokens used with the GitHub CLI:
- Review your personal security log and any relevant audit logs for actions associated with your account or enterprise
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1qd2NtLTlnMzktcG1jd84ABB4c
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Moderate
Classification: General
Published: 13 days ago
Updated: 9 days ago
CVSS Score: 6.5
CVSS vector: CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:L
EPSS Percentage: 0.00043
EPSS Percentile: 0.10511
Identifiers: GHSA-jwcm-9g39-pmcw, CVE-2024-53858
References:
- https://github.com/cli/cli/security/advisories/GHSA-jwcm-9g39-pmcw
- https://nvd.nist.gov/vuln/detail/CVE-2024-53858
- https://git-scm.com/docs/gitcredentials
- https://github.com/advisories/GHSA-jwcm-9g39-pmcw
Blast Radius: 9.1
Affected Packages
go:github.com/cli/cli/v2
Dependent packages: 196Dependent repositories: 25
Downloads:
Affected Version Ranges: <= 2.62.0
Fixed in: 2.63.0
All affected versions: 2.0.0, 2.1.0, 2.2.0, 2.3.0, 2.4.0, 2.5.0, 2.5.1, 2.5.2, 2.6.0, 2.7.0, 2.8.0, 2.9.0, 2.10.0, 2.10.1, 2.11.0, 2.11.1, 2.11.2, 2.11.3, 2.12.0, 2.12.1, 2.13.0, 2.14.0, 2.14.1, 2.14.2, 2.14.3, 2.14.4, 2.14.5, 2.14.6, 2.14.7, 2.15.0, 2.16.0, 2.16.1, 2.17.0, 2.18.0, 2.18.1, 2.19.0, 2.20.0, 2.20.1, 2.20.2, 2.21.0, 2.21.1, 2.21.2, 2.22.0, 2.22.1, 2.23.0, 2.24.0, 2.24.1, 2.24.2, 2.24.3, 2.25.0, 2.25.1, 2.26.0, 2.26.1, 2.27.0, 2.28.0, 2.29.0, 2.30.0, 2.31.0, 2.32.0, 2.32.1, 2.33.0, 2.34.0, 2.35.0, 2.36.0, 2.37.0, 2.38.0, 2.39.0, 2.39.1, 2.39.2, 2.40.0, 2.40.1, 2.41.0, 2.42.0, 2.42.1, 2.43.0, 2.43.1, 2.44.0, 2.44.1, 2.45.0, 2.46.0, 2.47.0, 2.48.0, 2.49.0, 2.49.1, 2.49.2, 2.50.0, 2.51.0, 2.52.0, 2.53.0, 2.54.0, 2.55.0, 2.56.0, 2.57.0, 2.58.0, 2.59.0, 2.60.0, 2.60.1, 2.61.0, 2.62.0
All unaffected versions: 2.63.0, 2.63.1, 2.63.2