{"id":"CVE-2026-59831","aliases":["CVE-2026-59831","GHSA-8cg3-r6g9-fpg2"],"related":[],"kind":"vulnerability","state":"published","title":"GitHub CLI `gh codespace jupyter` could allow remote code execution when connecting to a malicious Codespace","summary":"GitHub CLI (gh) is GitHub’s official command line tool. From 2.10.0 through 2.95.0, connecting to a malicious Codespace with gh codespace jupyter can allow command execution because the command opens a JupyterLab URL supplied by a process inside the Codespace without validating that it is a loopback HTTP or HTTPS address, allowing a crafted vscode:// or vscode-insiders:// URL to be handed to VS Code. This issue is fixed in version 2.96.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"GitHub CLI (gh) is GitHub’s official command line tool. From 2.10.0 through 2.95.0, connecting to a malicious Codespace with gh codespace jupyter can allow command execution because the command opens a JupyterLab URL supplied by a process inside the Codespace without validating that it is a loopback HTTP or HTTPS address, allowing a crafted vscode:// or vscode-insiders:// URL to be handed to VS Code. This issue is fixed in version 2.96.0.","source":"cvelist"},{"lang":"en","text":"### 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.","format":"markdown","source":"ghsa"}],"published":"2026-07-09T22:11:05.418Z","modified":"2026-11-24T22:45:04.181Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:N","score":4.4,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:N","score":4.4,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:N","score":4.4,"rating":"MEDIUM"}],"cwes":["CWE-20","CWE-829"],"affected":[{"ranges":[{"version":">= 2.10.0, < 2.96.0","status":"affected"}],"vendor":"cli","product":"cli","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"2.10.0","status":"affected","fixed":"2.96.0"}],"ecosystem":"Go","package":"github.com/cli/cli/v2","purl":"pkg:golang/github.com/cli/cli/v2","source":"ghsa"}],"references":[{"url":"https://github.com/cli/cli/security/advisories/GHSA-8cg3-r6g9-fpg2","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/cli/cli/commit/b300f2ec7ec9dc9addc39b2ad88c54097ded7ca0","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/cli/cli/releases/tag/v2.96.0","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-59831","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/cli/cli","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-07-14T01:20:49.738Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-59831","url":"https://www.cve.org/CVERecord?id=CVE-2026-59831","licence":"CVE Terms of Use","modified":"2026-07-14T01:20:59.985Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-8cg3-r6g9-fpg2","url":"https://github.com/advisories/GHSA-8cg3-r6g9-fpg2","licence":"CC-BY-4.0","modified":"2026-11-24T22:45:04.181Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-59831","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-59831","licence":"Public domain","modified":"2026-07-14T02:16:57.493Z"}],"updatedAt":"2026-11-25T22:59:27.576Z","epss":{"score":0.00259,"percentile":0.18811,"date":"2026-12-01T12:00:22.000Z"}}