CVE-2025-48938: Github.com/cli/go gh/v2 Prevent GitHub CLI And Extensions Vulnerability

MODERATE
Advisory Identifier: GHSA-g9f5-x53j-h563
CWE-501
Published
Advisory Summary

CVE-2025-48938 is a MODERATE prevent github cli and extensions vulnerability (CWE-501: Trust Boundary Violation) affecting Github.com/cli/go gh/v2 libraries in the Go ecosystem. The issue involves prevent github cli and extensions from executing arbitrary commands from compromised github enterprise server. Remediation is available by upgrading affected packages to version 2.12.1.

CVE-2025-48938 at a Glance

CVE Identifier CVE-2025-48938
GHSA Identifier GHSA-g9f5-x53j-h563
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-501: Trust Boundary Violation
Affected Product Github.com/cli/go gh/v2
Package Ecosystem Go
Published Date
Last Updated

How to Fix CVE-2025-48938

To remediate this vulnerability, upgrade all affected Github.com/cli/go gh/v2 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/cli/go-gh/v2 fixed: 2.12.1
Upgrade github.com/cli/go-gh/v2 to 2.12.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/cli/go-gh/v2

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-48938, inspect your project dependencies for Github.com/cli/go gh/v2:

inspect dependencies for github.com/cli/go-gh/v2

Analyze the terminal output to locate any version of Github.com/cli/go gh/v2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.12.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-501: Trust Boundary Violation, where the product mixes trusted and untrusted data in the same data structure or structured message. In Github.com/cli/go gh/v2, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary A security vulnerability has been identified in `go-gh` where an attacker-controlled GitHub Enterprise Server could result in executing arbitrary commands on a user's machine by replacing HTTP URLs provided by GitHub with local file paths for browsing. ### Details The GitHub CLI and CLI extensions allow users to transition from their terminal for a variety of use cases through the [`Browser` capability in `github.com/cli/go-gh/v2/pkg/browser`](https://github.com/cli/go-gh/blob/61bf393cf4aeea6d00a6251390f5f67f5b67e727/pkg/browser/browser.go): - Using the `-w, --web` flag, GitHub CLI users can view GitHub repositories, issues, pull requests, and more using their web browser - Using the `gh codespace` command set, GitHub CLI users can transition to Visual Studio Code to work with GitHub Codespaces This is done by using URLs provided through API responses from authenticated GitHub hosts when users execute `gh` commands. Prior to `2.12.1`, `Browser.Browse()` would attempt to open the provided URL using a variety of OS-specific approaches regardless of the scheme. An attacker-controlled GitHub Enterprise Server could modify API responses to use a specially tailored local executable path instead of HTTP URLs to resources. This could allow the attacker to execute arbitrary executables on the user's machine. In `2.12.1`, `Browser.Browse()` has been enhanced to allow and disallow a variety of scenarios to avoid opening or executing files on the filesystem without unduly impacting HTTP URLs: 1. URLs with `http://`, `https://`, `vscode://`, `vscode-insiders://` protocols are supported 1. URLs with `file://` protocol are unsupported 1. URLs matching files or directories on the filesystem are unsupported 1. URLs matching executables in the user's path are unsupported URLs without protocols will be browsable if none of these other conditions apply. As we have more information about use cases, maintainers can expand these capabilities for an improved user experience that allows configuring allowed URL schemes and/or prompt the user for an unexpected user case and confirming whether to continue. ### Impact Successful exploitation could cause users of the attacker-controlled GitHub Enterprise Server to execute arbitrary commands. ### Remediation and Mitigation 1. Upgrade `go-gh` to `2.12.1`

CVE-2025-48938 Affected Github.com/cli/go gh/v2 Versions

1 component(s)
Fixed Versions:
2.12.1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/cli/go-gh/v2
Go
< 2.12.1
2.12.1

References

Frequently Asked Questions

What is CVE-2025-48938?
CVE-2025-48938 is a security vulnerability in Github.com/cli/go gh/v2 involving Prevent GitHub CLI and extensions from executing arbitrary commands from compromised GitHub Enterprise Server under CWE-501: Trust Boundary Violation.
Which Github.com/cli/go gh/v2 versions are affected?
Affected versions include releases prior to 2.12.1 across affected packages: github.com/cli/go-gh/v2.
What version fixes CVE-2025-48938?
Upgrading to 2.12.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/cli/go-gh/v2 affected?
Yes, github.com/cli/go-gh/v2 is affected in releases prior to 2.12.1. Upgrade your dependency to 2.12.1 or later.
What CWE is associated with CVE-2025-48938?
CVE-2025-48938 is classified under CWE-501: Trust Boundary Violation (The product mixes trusted and untrusted data in the same data structure or structured message.).
How can I check Go dependencies for CVE-2025-48938?
Run the dependency tree command: 'inspect dependencies for github.com/cli/go-gh/v2'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-g9f5-x53j-h563",
  "modified" : "2025-06-04T21:00:35Z",
  "published" : "2025-05-30T15:30:39Z",
  "aliases" : [ "CVE-2025-48938" ],
  "summary" : "Prevent GitHub CLI and extensions from executing arbitrary commands from compromised GitHub Enterprise Server",
  "details" : "### Summary\n\nA security vulnerability has been identified in `go-gh` where an attacker-controlled GitHub Enterprise Server could result in executing arbitrary commands on a user's machine by replacing HTTP URLs provided by GitHub with local file paths for browsing. \n\n### Details\n\nThe GitHub CLI and CLI extensions allow users to transition from their terminal for a variety of use cases through the [`Browser` capability in `github.com/cli/go-gh/v2/pkg/browser`](https://github.com/cli/go-gh/blob/61bf393cf4aeea6d00a6251390f5f67f5b67e727/pkg/browser/browser.go):\n\n- Using the `-w, --web` flag, GitHub CLI users can view GitHub repositories, issues, pull requests, and more using their web browser\n- Using the `gh codespace` command set, GitHub CLI users can transition to Visual Studio Code to work with GitHub Codespaces\n\nThis is done by using URLs provided through API responses from authenticated GitHub hosts when users execute `gh` commands.\n\nPrior to `2.12.1`, `Browser.Browse()` would attempt to open the provided URL using a variety of OS-specific approaches regardless of the scheme.  An attacker-controlled GitHub Enterprise Server could modify API responses to use a specially tailored local executable path instead of HTTP URLs to resources.  This could allow the attacker to execute arbitrary executables on the user's machine. \n\nIn `2.12.1`, `Browser.Browse()` has been enhanced to allow and disallow a variety of scenarios to avoid opening or executing files on the filesystem without unduly impacting HTTP URLs:\n\n1. URLs with `http://`, `https://`, `vscode://`, `vscode-insiders://` protocols are supported\n1. URLs with `file://` protocol are unsupported\n1. URLs matching files or directories on the filesystem are unsupported\n1. URLs matching executables in the user's path are unsupported\n\nURLs without protocols will be browsable if none of these other conditions apply.\n\nAs we have more information about use cases, maintainers can expand these capabilities for an improved user experience that allows configuring allowed URL schemes and/or prompt the user for an unexpected user case and confirming whether to continue.\n\n### Impact\n\nSuccessful exploitation could cause users of the attacker-controlled GitHub Enterprise Server to execute arbitrary commands.\n\n### Remediation and Mitigation\n\n1. Upgrade `go-gh` to `2.12.1`",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/cli/go-gh/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.12.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/cli/go-gh/security/advisories/GHSA-g9f5-x53j-h563"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-48938"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cli/go-gh/commit/a08820a13f257d6c5b4cb86d37db559ec6d14577"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/cli/go-gh"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-501" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-05-30T15:30:39Z",
    "nvd_published_at" : "2025-05-30T19:15:29Z"
  }
}