CVE-2024-53858 Recursive repository cloning can leak authentication tokens to non-GitHub submodule hosts in the gh cli

Medium 6.5 Published Updated

The GitHub CLI leaks authentication tokens to non-GitHub submodule hosts during recursive cloning, potentially allowing attackers to steal credentials.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Local or same network only
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2024-53858?

CVE-2024-53858 is a medium-severity vulnerability in cli, published on 27 Nov 2024. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

Official description

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

Weakness: CWE-200

Which versions are affected by CVE-2024-53858?

4 open source packages ship an affected version, including github.com/cli/cli/v2 and github.com/cli/cli.

PackageAffectedFixed in
github.com/cli/cli/v2 GoAll versions2.63.0
github.com/cli/cli/v2 GoAll versions2.63.0
github.com/cli/cli/v2 GoAll versions2.63.0
github.com/cli/cli GoAll versionsNone

How do I fix CVE-2024-53858?

Upgrade github.com/cli/cli/v2 to 2.63.0 or later.

Is CVE-2024-53858 being exploited?

There is no known exploitation of CVE-2024-53858 in the wild and no public exploit code.

Sources

Also known as AZL-53477, AZL-53759, DEBIAN-CVE-2024-53858, GHSA-jwcm-9g39-pmcw, GO-2024-3296, UBUNTU-CVE-2024-53858.

Is CVE-2024-53858 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free