Cloudanix VulnDB

CVE-2024-52308

High · 8.0

Connecting to a malicious Codespaces via GH CLI could allow command execution on the user's computer

CVSS

8.0

EPSS

0.9%

Published

Nov 14, 2024

CISA due date

—

Cloudanix analysis

Monitor only SSVC: Track

People using a popular GitHub command-line tool risk having their computer taken over if they connect it to a fake development server.

Exploitation
Requires User Interaction
Attacker needs
User Interaction
Complexity
Moderate
Impact
Remote Code Execution
Component
Application
Class
Command Injection
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

Command injection in GitHub CLI allows remote code execution when `gh codespace ssh` or `gh codespace logs` connect to a malicious Codespace SSH server.

Why it matters to the business

User workstations could be fully compromised, enabling data theft or further attacks; stable low EPSS and absence from KEV indicate limited observed exploitation but high severity for developers using Codespaces.

How an attack unfolds

An attacker hosts a malicious SSH server mimicking a Codespace endpoint; a victim runs the affected gh commands against it; the server returns crafted responses that inject and execute arbitrary commands on the victim's machine.

How to fix it

Upgrade GitHub CLI to the latest patched release; restrict use of codespace commands to verified trusted endpoints and consider disabling the affected subcommands via policy until updated.

How to confirm the fix worked

Confirm the installed gh version is newer than the vulnerable release; run the commands against a known-good Codespace and verify no unexpected processes or command execution occur.

Typical attack path

  1. Attacker deploys malicious Codespace SSH server
  2. Victim is induced to run gh codespace ssh or gh codespace logs against the attacker server
  3. Malicious responses trigger command injection in the CLI
  4. Arbitrary code executes with the privileges of the gh process

How to detect it

Review shell history and process logs for gh codespace invocations connecting to unexpected hosts; monitor for child processes spawned immediately after gh codespace commands.

What your security team should do

  • Prioritize patching GitHub CLI across developer workstations
  • Add gh binary execution to endpoint monitoring
  • Train users to verify Codespace hostnames before connecting
  • Review and restrict use of codespace subcommands in high-risk environments

The record

A security vulnerability has been identified in GitHub CLI that could allow remote code execution (RCE) when users connect to a malicious Codespace SSH server and use the `gh codespace ssh` or `gh codespace logs` commands.

Affected packages

Ecosystem Package Introduced Fixed
Go github.com/cli/cli 0 No fix
Go github.com/cli/cli 0 2.62.0
Go github.com/cli/cli/v2 0 2.62.0
Chainguard gh 0 2.62.0-r0
Chainguard gh-doc 0 2.62.0-r0
Debian:12 gh 0 No fix
Debian:13 gh 0 No fix
SUSE:Package Hub 15 SP6 gh 0 2.65.0-bp156.2.17.1
Ubuntu:24.04:LTS gh 0 No fix
Ubuntu:24.10 gh 0 2.46.0-1ubuntu0.2
Ubuntu:25.04 gh 0 No fix
Ubuntu:25.10 gh 0 No fix
Ubuntu:Pro:24.04:LTS gh 0 2.45.0-1ubuntu0.2+esm1
Wolfi gh 0 2.62.0-r0
Wolfi gh-doc 0 2.62.0-r0
openSUSE:Leap 15.6 gh 0 2.65.0-bp156.2.17.1
openSUSE:Tumbleweed gh 0 2.62.0-1.1
openSUSE:Tumbleweed govulncheck-vulndb 0 0.0.20241119T173509-1.1

Related vulnerabilities