# CVE-2026-59831: GitHub CLI `gh codespace jupyter` could allow remote code execution when connecting to a malicious Codespace

> GitHub CLI allows remote code execution when connecting to a malicious Codespace due to insufficient validation of JupyterLab URLs.

- **Severity:** Medium 4.4 (`CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 9 Jul 2026
- **Updated:** 14 Jul 2026
- **Also known as:** AZL-92328, DEBIAN-CVE-2026-59831, GHSA-8cg3-r6g9-fpg2, UBUNTU-CVE-2026-59831

## What is CVE-2026-59831?

CVE-2026-59831 is a medium-severity code injection vulnerability in cli, published on 9 Jul 2026. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.

### Official 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.

Weakness: CWE-829 (Inclusion of Functionality from Untrusted Control Sphere)

## Which versions are affected by CVE-2026-59831?


## How do I fix CVE-2026-59831?

Upgrade to a fixed version.

## Is CVE-2026-59831 being exploited?

There is no known exploitation of CVE-2026-59831 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-59831 and fix it if it is affected.

What it is: CVE-2026-59831 is a medium-severity code injection vulnerability in cli, published on 9 Jul 2026. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2026-59831 in the wild and no public exploit code.

Affected product: cli. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-59831/ (Markdown: https://insights.sbomify.com/CVE-2026-59831/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-59831
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-59831
- OSV: https://osv.dev/vulnerability/CVE-2026-59831

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-59831/
Summaries are generated and may contain mistakes; the official description above is the record.
