CVE-2026-59831: Github.com/cli/cli/v2 GitHub CLI Gh Codespace Jupyter Vulnerability

MODERATE
Advisory Identifier: GHSA-8cg3-r6g9-fpg2
CVSS 4.4
CWE-829 CWE-20
Published
Advisory Summary

CVE-2026-59831 is a MODERATE (CVSS 4.4) github cli gh codespace jupyter vulnerability (CWE-829: Inclusion of Functionality from Untrusted Control Sphere) affecting Github.com/cli/cli/v2 libraries in the Go ecosystem. The issue involves github cli gh codespace jupyter may allow code execution via unvalidated urls from malicious codespaces. Remediation is available by upgrading affected packages to version 2.96.0.

CVE-2026-59831 at a Glance

CVE Identifier CVE-2026-59831
GHSA Identifier GHSA-8cg3-r6g9-fpg2
Severity MODERATE
CVSS v3.1 Base Score 4.4
CWE Classification CWE-829: Inclusion of Functionality from Untrusted Control Sphere
Affected Product Github.com/cli/cli/v2
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 4.4

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-59831

To remediate this vulnerability, upgrade all affected Github.com/cli/cli/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/cli/v2 fixed: 2.96.0
Upgrade github.com/cli/cli/v2 to 2.96.0
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/cli/v2

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-59831, inspect your project dependencies for Github.com/cli/cli/v2:

inspect dependencies for github.com/cli/cli/v2

Analyze the terminal output to locate any version of Github.com/cli/cli/v2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.96.0), 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-829: Inclusion of Functionality from Untrusted Control Sphere, where the product imports, requires, or includes executable functionality (such as a library) from a source that is outside of the intended control sphere. In Github.com/cli/cli/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 GitHub CLI that could allow remote code execution when users connect to a malicious Codespace using the `gh codespace jupyter` command. The command opens JupyterLab by launching a URL in the user's browser, but that URL is supplied by a process running inside the Codespace and the CLI opens it without validating it. The browser launcher accepts `vscode://` and `vscode-insiders://` links, so a malicious Codespace can return a crafted `vscode://` URL. The CLI opens the link, the operating system hands it to VS Code, and VS Code acts on it, which can lead to code execution on the user's workstation. This is a variant of [CVE-2024-52308](https://github.com/advisories/GHSA-p2h2-3vg9-4p87). That remediation validated the SSH connection details for `gh codespace ssh` and `gh codespace logs`, but did not cover the equivalent Jupyter code path. ### Details The vulnerability stems from the way GitHub CLI handles the server URL returned when starting a remote JupyterLab server: 1. A user runs `gh codespace jupyter -c <name>`, expecting a normal `https://` JupyterLab page. 2. The CLI retrieves a server URL from a process inside the Codespace and opens it in the user's browser without confirming that it is a web address. 3. A malicious Codespace returns a `vscode://` link in place of the expected JupyterLab address. The operating system passes the link to VS Code. 4. VS Code acts on the link. With a single trust prompt, this can result in code execution on the user's workstation. The CLI trusts the URL provided by the Codespace and opens it as-is, without confirming that it is a loopback JupyterLab web address. The equivalent SSH commands received this validation in the CVE-2024-52308 fix, but the Jupyter command was not covered. In `v2.96.0`, the GitHub CLI validates the Jupyter server URL before opening it, accepting only loopback `http` and `https` addresses. ### Impact Any user who runs `gh codespace jupyter` against an untrusted Codespace. Successful exploitation requires the victim to accept one VS Code "open URL" or Workspace Trust prompt. ## Remediation and Mitigation 1. Upgrade `gh` to `v2.96.0`. 2. Exercise caution when using `gh codespace jupyter` with untrusted Codespaces. Prefer Codespaces created from trusted sources, and prefer default or pre-built devcontainers.

CVE-2026-59831 Affected Github.com/cli/cli/v2 Versions

1 component(s)
Fixed Versions:
2.96.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/cli/cli/v2
Go
≥ 2.10.0
< 2.96.0
2.96.0

References

Frequently Asked Questions

What is CVE-2026-59831?
CVE-2026-59831 is a security vulnerability in Github.com/cli/cli/v2 involving GitHub CLI gh codespace jupyter may allow code execution via unvalidated URLs from malicious Codespaces under CWE-829: Inclusion of Functionality from Untrusted Control Sphere.
Which Github.com/cli/cli/v2 versions are affected?
Affected versions include releases prior to 2.96.0 across affected packages: github.com/cli/cli/v2.
What version fixes CVE-2026-59831?
Upgrading to 2.96.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/cli/cli/v2 affected?
Yes, github.com/cli/cli/v2 is affected in releases prior to 2.96.0. Upgrade your dependency to 2.96.0 or later.
What is the CVSS score of CVE-2026-59831?
CVE-2026-59831 has a CVSS v3.1 base score of 4.4 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2026-59831?
CVE-2026-59831 is classified under CWE-829: Inclusion of Functionality from Untrusted Control Sphere (The product imports, requires, or includes executable functionality (such as a library) from a source that is outside of the intended control sphere.).
How can I check Go dependencies for CVE-2026-59831?
Run the dependency tree command: 'inspect dependencies for github.com/cli/cli/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-8cg3-r6g9-fpg2",
  "modified" : "2026-11-24T22:26:25Z",
  "published" : "2026-11-24T22:26:25Z",
  "aliases" : [ "CVE-2026-59831" ],
  "summary" : "GitHub CLI gh codespace jupyter may allow code execution via unvalidated URLs from malicious Codespaces",
  "details" : "### Summary\n\nA security vulnerability has been identified in GitHub CLI that could allow remote code execution when users connect to a malicious Codespace using the `gh codespace jupyter` command. The command opens JupyterLab by launching a URL in the user's browser, but that URL is supplied by a process running inside the Codespace and the CLI opens it without validating it.\n\nThe browser launcher accepts `vscode://` and `vscode-insiders://` links, so a malicious Codespace can return a crafted `vscode://` URL. The CLI opens the link, the operating system hands it to VS Code, and VS Code acts on it, which can lead to code execution on the user's workstation.\n\nThis is a variant of [CVE-2024-52308](https://github.com/advisories/GHSA-p2h2-3vg9-4p87). That remediation validated the SSH connection details for `gh codespace ssh` and `gh codespace logs`, but did not cover the equivalent Jupyter code path.\n\n### Details\n\nThe vulnerability stems from the way GitHub CLI handles the server URL returned when starting a remote JupyterLab server:\n\n1. A user runs `gh codespace jupyter -c <name>`, expecting a normal `https://` JupyterLab page.\n2. The CLI retrieves a server URL from a process inside the Codespace and opens it in the user's browser without confirming that it is a web address.\n3. A malicious Codespace returns a `vscode://` link in place of the expected JupyterLab address. The operating system passes the link to VS Code.\n4. VS Code acts on the link. With a single trust prompt, this can result in code execution on the user's workstation.\n\nThe CLI trusts the URL provided by the Codespace and opens it as-is, without confirming that it is a loopback JupyterLab web address. The equivalent SSH commands received this validation in the CVE-2024-52308 fix, but the Jupyter command was not covered.\n\nIn `v2.96.0`, the GitHub CLI validates the Jupyter server URL before opening it, accepting only loopback `http` and `https` addresses.\n\n### Impact\n\nAny user who runs `gh codespace jupyter` against an untrusted Codespace.\n\nSuccessful exploitation requires the victim to accept one VS Code \"open URL\" or Workspace Trust prompt.\n\n## Remediation and Mitigation\n\n1. Upgrade `gh` to `v2.96.0`.\n2. Exercise caution when using `gh codespace jupyter` with untrusted Codespaces. Prefer Codespaces created from trusted sources, and prefer default or pre-built devcontainers.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/cli/cli/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.10.0"
      }, {
        "fixed" : "2.96.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/cli/cli/security/advisories/GHSA-8cg3-r6g9-fpg2"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-59831"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cli/cli/commit/b300f2ec7ec9dc9addc39b2ad88c54097ded7ca0"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/cli/cli"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cli/cli/releases/tag/v2.96.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-829" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-11-24T22:26:25Z",
    "nvd_published_at" : "2026-07-09T23:17:05Z"
  }
}