4.4medium
GitHub CLI `gh codespace jupyter` could allow remote code execution when connecting to a malicious Codespace
- Severity
- 4.4medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.26% (higher than 18% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-8cg3-r6g9-fpg2
Description
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| cli cli | >= 2.10.0, < 2.96.0 | CVE List |
| github.com/cli/cli/v2 (Go) | from 2.10.0 before 2.96.0 | GitHub Advisory Database |
All scores
| GitHub_M | 4.4medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:N |
| GitHub | 4.4medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:N |
Classification
What each source says
CVE List
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.
GitHub Advisory Database
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. 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:
- A user runs
gh codespace jupyter -c <name>, expecting a normalhttps://JupyterLab page. - 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.
- A malicious Codespace returns a
vscode://link in place of the expected JupyterLab address. The operating system passes the link to VS Code. - 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
- Upgrade
ghtov2.96.0. - Exercise caution when using
gh codespace jupyterwith untrusted Codespaces. Prefer Codespaces created from trusted sources, and prefer default or pre-built devcontainers.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-59831 changed 2026-07-14 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-8cg3-r6g9-fpg2 changed 2026-11-24 | CC-BY-4.0 |
| NVD | CVE-2026-59831 changed 2026-07-14 | Public domain |