GHSA-cg6r-mpgc-h9mm: Low severity go/github.com/cli/cli/v2 vulnerability
Summary
A security vulnerability has been identified in GitHub CLI where gh auth status could potentially print a portion of the authentication token in plaintext, depending on the lexical structure of the token.
Affected users: - Authenticated users who ran gh auth status (without the --show-token flag) with a token type whose format contains an underscore after the prefix. This includes fine-grained personal access tokens (githubpat) and GitHub App installation/user access tokens (ghs, ghu, e.g., ghs<APPID><JWT>), including the Actions GITHUBTOKEN. Classic tokens such as gho and ghp have an underscore-free body and are not affected.
Details
The vulnerability stems from the way GitHub CLI masks the authentication token when reporting authentication state:
1. A user runs gh auth status without --show-token, expecting the token to be fully masked. 2. The masking logic redacts only the characters that follow the last underscore in the token, instead of redacting everything after the token prefix. 3. The partially masked token is written to the command output, where it can be captured or shared.
Because gh auth status is a diagnostic command commonly run interactively and inside automated environments, the leaked token characters can end up in CI/CD job logs, terminal scrollback, screen recordings, screenshots, or pasted output shared in bug reports and support requests.
In v2.97.0, GitHub CLI fully masks the token in gh auth status output, preserving only the known token prefix and redacting the remainder unless --show-token is explicitly provided.
Impact
Running gh auth status in a context where the output is captured, logged, or shared could leak a portion of an affected token. The affected token types are fine-grained personal access tokens (githubpat) and GitHub App installation/user access tokens (ghs, ghu, e.g., ghs<APPID><JWT>), including the Actions GITHUBTOKEN. Installation and Actions tokens are short-lived, which narrows the window in which a recovered token could be reused. See GitHub credential types.
Remediation and Mitigation
1. Upgrade gh to v2.97.0. 2. Rotate any affected token whose masked gh auth status output may have been captured or shared: - Fine-grained personal access tokens (githubpat): regenerate the token from your account settings. See Managing your personal access tokens. - GitHub App installation/user access tokens (ghs, ghu, e.g., ghs<APPID><JWT>): these are short-lived and rotate automatically (See GitHub credential types). If you believe a token was captured while still valid, you can revoke it immediately using the Revoke an installation access token REST endpoint (DELETE /installation/token). To cut off a third-party app's access more broadly, suspend or uninstall the app from the web UI. See Reviewing and modifying installed GitHub Apps. - Actions GITHUBTOKEN: this token is automatically invalidated when the job finishes, so no manual revocation is normally required. See GitHub credential types. 3. Until you can upgrade, avoid running gh auth status in contexts where the output is captured or shared, and manually redact the token line before sharing any output.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
go/github.com/cli/cli/v2to a version that resolves this vulnerability.Fixed in 2.97.0 - Upgrade
Upgrade
GitHub CLI (gh)to a version that resolves this vulnerability.Fixed in v2.97.0 - Compensating control
Until GitHub CLI is upgraded, avoid running gh auth status where output is captured or shared, and manually redact the token line before sharing output.
- Compensating control
To cut off a third-party app's access more broadly, suspend or uninstall the app from the GitHub web UI.
- Operational
Regenerate affected fine-grained personal access tokens (github_pat_*). If a GitHub App installation access token (ghs_*) was captured while still valid, revoke it using DELETE /installation/token; GitHub App installation/user access tokens (ghs_*/ghu_*) rotate automatically, and Actions GITHUB_TOKEN tokens are automatically invalidated when the job finishes.
Event History
Frequently Asked Questions
Which token types can have data exposed in command output?
Fine-grained personal access tokens beginning with github_pat_, GitHub App installation tokens beginning with ghs_, and GitHub App user access tokens beginning with ghu_ are affected when their format includes an underscore after the prefix. This includes the Actions GITHUB_TOKEN.
Are classic personal access tokens affected?
Classic tokens beginning with gho_ or ghp_ are not affected because their token bodies do not contain underscores.
Under what conditions can token content be disclosed?
An authenticated user must run gh auth status without --show-token while using an affected token type. The command's output must then be captured, logged, or shared for the partially revealed token content to be exposed.
How can I determine whether prior output may contain exposed token material?
Review previously captured or shared output from gh auth status for affected token types. The vulnerable masking behavior redacts only characters after the final underscore, so content before that underscore may be present in plaintext.