CVE-2024-52308: cli Command Injection
Vulnerability summary
CVE-2024-52308 is a critical (CVSS 9.6) Command Injection vulnerability in cli. EPSS estimates a 0.85% chance of exploitation in the next 30 days, higher than 57.9% of scored vulnerabilities.
Advisory lineage
Upstream 0 · Downstream 2 · Related 4Timeline
- 14-11-2024PublishedVulnerability first disclosed.
- 15-11-2024Last modifiedVulnerability information updated.
Description
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.
CVSS metrics
7 scores · 7 sources · 1 version- CVE.orgCNA8.0HighCVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:HDiffers
- OSV · UbuntuEcosystem advisory · calculated9.6CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
- OSV · DebianEcosystem advisory · calculated9.6CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
- OSV · WolfiEcosystem advisory · calculated8.0HighCVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:HDiffers
- OSV · GoEcosystem advisory · calculated8.0HighCVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:HDiffers
- OSV · ChainguardEcosystem advisory · calculated8.0HighCVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:HDiffers
EPSS trend
Probability
0.85%
Chance of exploitation in the next 30 days
Percentile
58%
Versus all other CVEs
30-day change
0.00 pp
From 0.85% on 21-09-2026
Known exploited
Compare KEV catalogsNot in any of the 3 tracked catalogs.
Public exploits
0 foundNo public exploits indexed.
Weaknesses
CWE · root causeAffected systems
Opensuse2 products
- gh&distro=openSUSE Leap 15.6< 2.65.0-bp156.2.17.1
- gh&distro=openSUSE Tumbleweed< 2.62.0-1.1
Chainguard1 product
- gh< 2.62.0-r0
Cli1 product
- cli≤ 2.61.0
Debian1 product
- ghAll versions (No fix recorded) | < 2.46.0-2
Github1 product
- cli< 2.62.0
Github.com/cli1 product
- cli< 2.62.0 | All versions (No fix recorded)
Github.com/cli/cli1 product
- v2< 2.62.0
Suse1 product
- gh&distro=SUSE Package Hub 15 SP6< 2.65.0-bp156.2.17.1
Ubuntu1 product
- gh< 2.45.0-1ubuntu0.2+esm1
Wolfi1 product
- gh< 2.62.0-r0
10 vendors · 11 products
References
13 links- github.com/cli/cli/security/advisories/GHSA-p2h2-3vg9-4p87X Refsource CONFIRMREPORTAdvisoryWEBVendor Advisory
- lists.opensuse.org/archives/…Advisory
Show all 13 references
- github.com/cli/cliPACKAGE
- lists.opensuse.org/archives/…Advisory