{"id":"CVE-2024-52308","summary":"Connecting to a malicious Codespaces via GH CLI could allow command execution on the user's computer","details":"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.","aliases":["GHSA-p2h2-3vg9-4p87","GO-2024-3269"],"modified":"2026-04-10T05:16:25.489239Z","published":"2024-11-14T22:55:38.693Z","related":["CGA-qhx9-vc73-x5fp","openSUSE-SU-2024:14509-1","openSUSE-SU-2024:14513-1","openSUSE-SU-2025:0021-1"],"database_specific":{"cwe_ids":["CWE-77"],"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/52xxx/CVE-2024-52308.json","cna_assigner":"GitHub_M"},"references":[{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/52xxx/CVE-2024-52308.json"},{"type":"ADVISORY","url":"https://github.com/cli/cli/security/advisories/GHSA-p2h2-3vg9-4p87"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-52308"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://github.com/cli/cli","events":[{"introduced":"0"},{"fixed":"cd3f2ad064fbeca17d330e321fef0591eaa0fea5"}]}],"versions":["v0.10.0","v0.10.1","v0.11.0","v0.11.1","v0.12.0","v0.4.0","v0.5.0","v0.5.1","v0.5.2","v0.5.3","v0.5.4","v0.5.5","v0.5.6","v0.5.7","v0.6.0","v0.6.1","v0.6.2","v0.6.3","v0.6.4","v0.7.0","v0.8.0","v0.9.0","v1.0.0","v1.1.0","v1.10.0","v1.10.1","v1.10.2","v1.10.3","v1.11.0","v1.12.0","v1.12.1","v1.13.0","v1.14.0","v1.2.0","v1.2.1","v1.3.0","v1.4.0","v1.5.0","v1.6.0","v1.6.1","v1.6.2","v1.7.0","v1.8.0","v1.8.1","v1.9.0","v1.9.1","v1.9.2","v2.0.0","v2.1.0","v2.10.0","v2.10.1","v2.11.0","v2.11.1","v2.11.2","v2.11.3","v2.12.0","v2.12.1","v2.13.0","v2.14.0","v2.14.1","v2.14.2","v2.14.3","v2.14.4","v2.14.5","v2.14.6","v2.14.7","v2.15.0","v2.16.0","v2.16.1","v2.17.0","v2.18.0","v2.18.1","v2.19.0","v2.2.0","v2.20.0","v2.20.1","v2.20.2","v2.21.0","v2.21.1","v2.21.2","v2.22.0","v2.22.1","v2.23.0","v2.24.0","v2.24.1","v2.24.2","v2.24.3","v2.25.0","v2.25.1","v2.26.0","v2.26.1","v2.27.0","v2.3.0","v2.30.0","v2.31.0","v2.32.0","v2.32.1","v2.33.0","v2.34.0","v2.35.0","v2.36.0","v2.37.0","v2.38.0","v2.39.0","v2.39.1","v2.39.2","v2.4.0","v2.40.0","v2.40.1","v2.41.0","v2.42.0","v2.42.1","v2.43.0","v2.43.1","v2.44.0","v2.44.1","v2.45.0","v2.46.0","v2.47.0","v2.48.0","v2.49.0","v2.49.1","v2.49.2","v2.5.0","v2.5.1","v2.5.2","v2.50.0","v2.51.0","v2.52.0","v2.53.0","v2.54.0","v2.55.0","v2.56.0","v2.57.0","v2.58.0","v2.59.0","v2.6.0","v2.60.0","v2.60.1","v2.61.0","v2.7.0","v2.8.0","v2.9.0"],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-52308.json"}}],"schema_version":"1.7.5","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:H"}]}