{"id":"CVE-2024-52308","published":"2024-11-14T22:55:38Z","modified":"2024-11-15T19:33:42Z","title":"Connecting to a malicious Codespaces via GH CLI could allow command execution on the user's computer","vendor":"cli","product":"cli","tier":"tail","description":{"text":"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.\n\nDevelopers 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.\n\nThis 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.\n\nIn `2.62.0`, the remote username information is being validated before being used.","provenance":"source","from":"CVE.org"},"cvss":{"score":8,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00906,"percentile":0.60723,"provenance":"source"},"cwes":[{"id":"CWE-77","name":"Improper Neutralization of Special Elements used in a Command"}],"references":[{"url":"https://github.com/cli/cli/security/advisories/GHSA-p2h2-3vg9-4p87","tags":["x_refsource_CONFIRM"]}],"priority":{"score":17.7,"factors":[{"name":"EPSS percentile","points":12.14},{"name":"CVSS severity","points":5.6}]},"vendorSlug":"cli","affectedVersions":[{"vendor":"cli","product":"cli","versions":["<= 2.61.0"]}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"total","timestamp":"2024-11-15T19:31:52.795141Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"Go","package":"github.com/cli/cli/v2","vulnerableRanges":["<2.62.0"],"patched":["2.62.0"],"from":["GHSA-p2h2-3vg9-4p87","GO-2024-3269"],"provenance":"source"},{"ecosystem":"Go","package":"github.com/cli/cli","vulnerableRanges":["<2.62.0","all versions"],"patched":["2.62.0"],"from":["GHSA-p2h2-3vg9-4p87","GO-2024-3269"],"provenance":"source"}],"summary":{"text":"The GitHub CLI (cli/cli) version 2.6.1 and earlier mishandles SSH connection details returned for a codespace, so the remote username is passed unsanitised into ssh arguments during gh codespace ssh and gh codespace logs. An attacker who controls a malicious devcontainer with a modified SSH server, and who can get a user to connect to that codespace, can supply a crafted username containing an injected -oProxyCommand option to run arbitrary commands on the user's workstation, which requires user interaction to initiate the connection.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T20:36:07Z"},"euvd":{"id":"EUVD-2024-3287","exploited":false,"provenance":"source"},"lineage":{"packageHistory":[{"cve":"CVE-2024-52308","published":"2024-11-14","fixed":"2.62.0","kev":false},{"cve":"CVE-2024-53858","published":"2024-11-27","fixed":"2.63.0","kev":false,"link":{"from":"CVE-2024-52308","to":"CVE-2024-53858","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"Go:github.com/cli/cli/v2","fromFixed":"2.62.0","toFixed":"2.63.0","daysApart":13}]}},{"cve":"CVE-2024-54132","published":"2024-12-04","fixed":"2.63.1","kev":false},{"cve":"CVE-2025-25204","published":"2025-02-14","fixed":"2.67.0","kev":false}],"package":"Go:github.com/cli/cli/v2"}}