GitHub CLI trusted a Codespace URL that could launch VS Code
The gh codespace jupyter command is designed to make a remote JupyterLab server feel local. The CLI asks the Codespace for a server URL and opens that address in the user's browser. A malicious Codespace could return a vscode:// URL instead. GitHub CLI opened the value without checking that it was a loopback JupyterLab address, allowing the operating system to hand the link to VS Code.
That behavior is CVE-2026-59831. The GitHub Security Advisory lists affected GitHub CLI versions from 2.10.0 and patches the issue in 2.96.0. The condition is straightforward: a developer connects to an untrusted Codespace and accepts the VS Code URL or workspace-trust prompt.
The vulnerable boundary is the URL scheme
JupyterLab normally runs on a loopback HTTP or HTTPS address inside the developer environment. The exact host and port can vary, so the CLI relied on the remote process to return a useful value. The missing check was not a malformed command-line argument. It was the absence of a policy for which URL schemes and destinations the CLI would pass to the desktop.
VS Code URI handlers are powerful because they are designed to open a local application and act on a workspace or extension workflow. A link that arrives from a remote development environment is untrusted input. If the receiving application treats it as a trusted request, one user click can cross the boundary from a hosted Codespace into the developer's workstation.
The attack path begins with a repository
The attacker must control or influence a Codespace that the victim opens. That can happen through a malicious repository, a compromised development container, or a project that asks a developer to test a contributed workflow. The advisory also says the attack is a variant of an earlier issue where SSH and log commands received URL validation but the Jupyter path did not.
The victim's workstation often holds source code, SSH keys, cloud credentials, browser sessions, and access to internal networks. This is why a moderate CVSS score should not be read as a minor inconvenience. The exploit requires user interaction, but the affected user is a developer operating with production-level authority in many organizations.
Upgrade and reduce link-handler ambiguity
Upgrade GitHub CLI to 2.96.0 or later. Confirm the binary in use is the patched one, not an older copy installed by a package manager, a language runtime, or a CI image. Run gh --version on developer workstations and record where the binary comes from.
Prefer Codespaces created from trusted sources and approved devcontainers. Treat an unexpected browser or VS Code prompt as a security event. If the organization has a managed VS Code policy, review which URI handlers are allowed and whether a user can silently approve a remote workspace. A prompt is a control only when users understand what it is asking.
The upgrade remains necessary even with a stricter Codespace policy. The malicious URL can arrive over an otherwise legitimate HTTPS connection to the Codespace, and the final transition happens through the local operating system. Restricting untrusted Codespaces reduces exposure without fixing the client's input validation.
Detection and response
Start with the GitHub CLI version inventory and a list of users who ran gh codespace jupyter against external or newly created Codespaces. Review VS Code extension installation events, recently opened folders, terminal process creation, and outbound connections around the same time. A URL prompt may leave little application-specific evidence, so operating-system and endpoint logs matter.
If a user accepted a suspicious link, isolate the workstation, preserve browser and VS Code logs, revoke active cloud and source-control sessions, and rotate credentials that were available to the user. Review whether the workspace trust decision granted extension execution. Do not assume that closing the Codespace removed anything installed on the laptop.
For developers, the safer rule is simple: a remote environment should not be able to choose an arbitrary local protocol handler. GitHub CLI now enforces loopback HTTP and HTTPS for this command. Organizations should verify that the fix is present before another developer connects to an unreviewed Codespace.
References
- GitHub, GHSA-8cg3-r6g9-fpg2
- GitHub, GitHub CLI v2.96.0 release
- CVE Program, CVE-2026-59831
- NVD, CVE-2026-59831
Top comments (0)