Skip to content
Fencer Vulns
high 8.0

CVE-2024-52308 json

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

published 2024-11-14 23 mo ago modified 2026-09-10 1 mo ago also EUVD-2024-3287 , GHSA-p2h2-3vg9-4p87 , GO-2024-3269

cvss
8.0
version 3.1, CNA
cisa kev
Not listed
not in CISA's catalog
epss
0.9%
EPSS 0.9% chance of exploitation in 30 days, percentile 60%
public exploits
0
none known

Summary

The GitHub CLI version 2.6.1 and earlier are vulnerable to remote code execution through a malicious codespace SSH server when using `gh codespace ssh` or `gh codespace logs` commands. This has been patched in the cli v2.62.0.

Developers connect to remote codespaces through an SSH server running within the devcontainer, which is generally provided through the [default devcontainer image]( https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/adding-a-dev-container-... https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/adding-a-dev-container-configuration/introduction-to-dev-containers#using-the-default-dev-container-configuration) . GitHub CLI [retrieves SSH connection details]( https://github.com/cli/cli/blob/30066b0042d0c5928d959e288144300cb28196c9/internal/codespaces/rpc/inv... https://github.com/cli/cli/blob/30066b0042d0c5928d959e288144300cb28196c9/internal/codespaces/rpc/invoker.go#L230-L244 ), such as remote username, which is used in [executing `ssh` commands]( https://github.com/cli/cli/blob/e356c69a6f0125cfaac782c35acf77314f18908d/pkg/cmd/codespace/ssh.go#L2... https://github.com/cli/cli/blob/e356c69a6f0125cfaac782c35acf77314f18908d/pkg/cmd/codespace/ssh.go#L263 ) for `gh codespace ssh` or `gh codespace logs` commands.

This exploit occurs when a malicious third-party devcontainer contains a modified SSH server that injects `ssh` arguments within the SSH connection details. `gh codespace ssh` and `gh codespace logs` commands could execute arbitrary code on the user's workstation if the remote username contains something like `-oProxyCommand="echo hacked" #`. The `-oProxyCommand` flag causes `ssh` to execute the provided command while `#` shell comment causes any other `ssh` arguments to be ignored.

In `2.62.0`, the remote username information is being validated before being used.

Patch / fix

  • go github.com/cli/cli/v2 2.62.0
  • go github.com/cli/cli 2.62.0
  • github cli 2.62.0
  • gh Debian 13 2.46.0-2

debian advisories DEBIAN-CVE-2024-52308

  • gh Ubuntu Pro 24.04 LTS 2.45.0-1ubuntu0.2+esm1

ubuntu advisories UBUNTU-CVE-2024-52308

Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0

  • gh openSUSE Leap 16.0 2.96.0-bp160.1.1
  • gh Package Hub 15 SP6, openSUSE Leap 15.6 2.65.0-bp156.2.17.1
  • govulncheck-vulndb openSUSE Tumbleweed 0.0.20241119T173509-1.1
  • gh openSUSE Tumbleweed 2.62.0-1.1

opensuse advisories openSUSE-SU-2026:21310-1openSUSE-SU-2025:0021-1openSUSE-SU-2024:14513-1openSUSE-SU-2024:14509-1

  • gh Azure Linux 3.0 2.62.0-1

azure linux advisories AZL-53217

Azure Linux vulnerability data, Copyright (c) Microsoft Corporation, from https://github.com/microsoft/AzureLinuxVulnerabilityData via OSV, under the MIT licence; changed: normalised to fixed package versions per release. MIT

CISA SSVC

Exploitation
none
Automatable
no
Technical impact
total
Assessed
23 mo ago

Exploit prediction

0.91% chance of exploitation in the next 30 days, higher than 60% of all scored CVEs (FIRST EPSS, 2026-11-08).

CVSS scores

assigned by version score vector
CNA 3.1 8.0 CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:H
GitHub 3.1 8.0 CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:H
NVD 3.1 9.6 CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H

Affected packages

ecosystem package affected fixed in
go github.com/cli/cli/v2
<2.62.0
2.62.0
go github.com/cli/cli
<2.62.0
all versions
2.62.0

Affected products

  • cli cli
  • github cli

Classification

Weakness
  • CWE-77 Improper Neutralization of Special Elements used in a Command

References

Sources

Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.

CPEs and fixed versions use Anchore's correction of NVD's data: Added CPE configurations because not yet analyzed by NVD.