CVE-2024-53859 go-gh `auth.TokenForHost` violates GitHub host security boundary within a codespace
Attackers can leak GitHub authentication tokens to unintended hosts within a codespace, potentially leading to account takeover.
- 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-53859?
CVE-2024-53859 is a medium-severity vulnerability in cli go-gh, 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
go-gh is a Go module for interacting with the `gh` utility and the GitHub API from the command line. A security vulnerability has been identified in `go-gh` that could leak authentication tokens intended for GitHub hosts to non-GitHub hosts when within a codespace. `go-gh` sources authentication tokens from different environment variables depending on the host involved: 1. `GITHUB_TOKEN`, `GH_TOKEN` for GitHub.com and ghe.com and 2. `GITHUB_ENTERPRISE_TOKEN`, `GH_ENTERPRISE_TOKEN` for GitHub Enterprise Server. Prior to version `2.11.1`, `auth.TokenForHost` could source a token from the `GITHUB_TOKEN` environment variable for a host other than GitHub.com or ghe.com when within a codespace. In version `2.11.1`, `auth.TokenForHost` will only source a token from the `GITHUB_TOKEN` environment variable for GitHub.com or ghe.com hosts. Successful exploitation could send authentication token to an unintended host. This issue has been addressed in version 2.11.1 and all users are advised to upgrade. Users are also advised to regenerate authentication tokens 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-53859?
6 open source packages ship an affected version, including github.com/cli/go-gh and github.com/cli/go-gh/v2. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
github.com/cli/go-gh Go | All versions | None |
github.com/cli/go-gh Go | All versions | None |
github.com/cli/go-gh Go | All versions | None |
github.com/cli/go-gh/v2 Go | All versions | 2.11.1 |
github.com/cli/go-gh/v2 Go | All versions | 2.11.1 |
github.com/cli/go-gh/v2 Go | All versions | 2.11.1 |
Products include Cli Go-Gh.
How do I fix CVE-2024-53859?
Upgrade to a fixed version.
Is CVE-2024-53859 being exploited?
There is no known exploitation of CVE-2024-53859 in the wild and no public exploit code.
Other vulnerabilities in cli go-gh
Sources
Also known as AZL-53453, DEBIAN-CVE-2024-53859, GHSA-55v3-xh23-96gh, GO-2024-3295, UBUNTU-CVE-2024-53859, USN-7362-1.