Skip to content
OpenAdvisories
Medium · 6.5 CVE-2024-53859 EUVD-2024-3396GHSA-55v3-xh23-96ghGO-2024-3295

go-gh `auth.TokenForHost` violates GitHub host security boundary within a codespace

Published Nov 27, 2024 · Updated Dec 3, 2024 · Assigned by GitHub_M

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.

Affected products

VendorProductAffectedFixed
cli go-gh < 2.11.1 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 golang-github-cli-go-gh-v2 No fix yet —
Debian 13 golang-github-cli-go-gh-v2 No fix yet —
ReleasePackageFixed inAdvisory
Ubuntu 26.10 golang-github-cli-go-gh-v2 No fix yet —
Ubuntu 26.04 LTS golang-github-cli-go-gh-v2 No fix yet —
Ubuntu 25.10 golang-github-cli-go-gh-v2 No fix yet —
Show 1 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu Pro 24.04 LTS golang-github-cli-go-gh-v2 2.6.0-1ubuntu0.24.04.1~esm1 USN-7362-1
ReleasePackageFixed inAdvisory
openSUSE Tumbleweed govulncheck-vulndb 0.0.20241213T205935-1.1 openSUSE-SU-2024:14599-1

Azure Linux

ReleasePackageFixed inAdvisory
Azure Linux 3 gh 2.62.0-5 —

Wolfi

ReleasePackageFixed inAdvisory
Wolfi rolling gh 2.63.0-r0 —
Wolfi rolling wolfictl 0.26.0-r1 —

Affected packages

EcosystemPackageAffectedFixedRecord
Go github.com/cli/go-gh all versions — GHSA-55v3-xh23-96gh
Go github.com/cli/go-gh/v2 < 2.11.1 2.11.1 GHSA-55v3-xh23-96gh

Advisories 2

References