GHSA-jwcm-9g39-pmcw

Suggest an improvement
Source
https://github.com/advisories/GHSA-jwcm-9g39-pmcw
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2024/11/GHSA-jwcm-9g39-pmcw/GHSA-jwcm-9g39-pmcw.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-jwcm-9g39-pmcw
Aliases
Published
2024-11-27T21:43:05Z
Modified
2024-12-02T20:29:42.253910Z
Severity
  • 6.5 (Medium) CVSS_V3 - CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:L CVSS Calculator
Summary
Recursive repository cloning can leak authentication tokens to non-GitHub submodule hosts
Details

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 when CODESPACES 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

  1. Upgrade gh to 2.63.0
  2. Revoke authentication tokens used with the GitHub CLI:
  3. Review your personal security log and any relevant audit logs for actions associated with your account or enterprise
Database specific
{
    "nvd_published_at": "2024-11-27T22:15:05Z",
    "cwe_ids": [
        "CWE-200"
    ],
    "severity": "MODERATE",
    "github_reviewed": true,
    "github_reviewed_at": "2024-11-27T21:43:05Z"
}
References

Affected packages

Go / github.com/cli/cli/v2

Package

Name
github.com/cli/cli/v2
View open source insights on deps.dev
Purl
pkg:golang/github.com/cli/cli/v2

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
2.63.0

Database specific

{
    "last_known_affected_version_range": "<= 2.62.0"
}