CVE-2024-52308

Improper Neutralization of Special Elements used in a Command ('Command Injection') (CWE-77)

Published: Nov 14, 2024

010
CVSS 8EPSS 0.04%High
CVE info copied to clipboard

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-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/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#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:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:H

Timeline

Vendor Advisory

GitHub Advisories released a security advisory.

Nov 14, 2024 at 4:13 PM
CVSS

A CVSS base score of 8 has been assigned.

Nov 14, 2024 at 5:40 PM / github_advisories
First Article

Feedly found the first article mentioning CVE-2024-52308. See article

Nov 14, 2024 at 5:45 PM / GitHub Advisory Database
CVSS Estimate

Feedly estimated the CVSS score as HIGH

Nov 14, 2024 at 5:45 PM
CVE Assignment

NVD published the first details for CVE-2024-52308

Nov 14, 2024 at 11:15 PM
EPSS

EPSS Score was set to: 0.04% (Percentile: 10.2%)

Nov 15, 2024 at 10:24 AM
Detection in Vulnerability Scanners

Detection for the vulnerability has been added to Qualys (6312801)

Nov 16, 2024 at 7:53 AM
Detection in Vulnerability Scanners

Detection for the vulnerability has been added to Qualys (6246956)

Nov 16, 2024 at 7:53 AM
Static CVE Timeline Graph

Affected Systems

Github/github
+null more

Patches

Github Advisory
+null more

Attack Patterns

CAPEC-136: LDAP Injection
+null more

Vendor Advisory

[GHSA-p2h2-3vg9-4p87] Connecting to a malicious Codespaces via GH CLI could allow command execution on the user's computer
GitHub CLI retrieves SSH connection details, such as remote username, which is used in executing ssh commands for gh codespace ssh or gh codespace logs commands. 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" #.

News

Connecting to a malicious Codespaces via GH CLI could allow command execution on the user's computer
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.
# GitHub : CVE-2024-52308: GitHub CLI # Vulnerability Could Allow Remote Code Execution: https:// securityonline.info/cve-2024-5 2308-github-cli-vulnerability-could-allow-remote-code-execution/
CVE-2024-52308: GitHub CLI Vulnerability Could Allow Remote Code Execution
A critical security vulnerability (CVE-2024-52308) in the GitHub Command Line Interface (CLI) has been identified, potentially enabling remote code execution (RCE) on users’ workstations. According to GitHub, “ Successful exploitation could lead to arbitrary code execution on the user’s workstation, potentially compromising the user’s data and system .”
CVE-2024-52308 | cli up to 2.61.0 command injection (GHSA-p2h2-3vg9-4p87)
A vulnerability was found in cli up to 2.61.0 . It has been rated as critical . Affected by this issue is some unknown functionality. The manipulation leads to command injection. This vulnerability is handled as CVE-2024-52308 . The attack may be launched remotely. There is no exploit available. It is recommended to upgrade the affected component.
NA - CVE-2024-52308 - The GitHub CLI version 2.6.1 and earlier are...
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...
See 9 more articles and social media posts

CVSS V3.1

Attack Vector:Network
Attack Complexity:High
Privileges Required:Low
User Interaction:Required
Scope:Changed
Confidentiality:High
Integrity:High
Availability Impact:High

Categories

Be the first to know about critical vulnerabilities

Collect, analyze, and share vulnerability reports faster using AI