{"schemaVersion":1,"url":"https://cve.openhack.com/cve/CVE-2024-52308","id":"CVE-2024-52308","title":"Connecting to a malicious Codespaces via GH CLI could allow command execution on the user's computer","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.\n\nDevelopers connect to remote codespaces through an SSH server running within the devcontainer, which is generally provided through the [default devcontainer image]( https:/","descriptionLong":"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.","published":"2024-11-14T22:55:38.693Z","updated":"2026-10-28T02:30:31.944052640Z","reserved":"2024-11-06T19:00:26.397Z","status":"Analyzed","rejected":false,"assigner":"GitHub_M","metric":{"version":"3.1","score":8,"vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:H","rating":"high","source":"GitHub_M"},"metrics":[{"version":"3.1","score":8,"vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:H","rating":"high","source":"GitHub_M"},{"version":"3.1","score":8,"vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:H","rating":"high","source":"github.com"},{"version":"3.1","score":9.6,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H","rating":"critical","source":"NVD"},{"version":"3.1","score":8,"vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:H","rating":"high","source":"OSV"},{"version":"3.1","score":8,"vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:H","rating":"high","source":"GitHub"}],"rating":"high","products":["cli"],"affectedProducts":[{"vendor":"cli","product":"cli","defaultStatus":"unaffected","versions":[{"status":"affected","version":"<= 2.61.0"}],"platforms":[]}],"packages":[{"ecosystem":"Go","name":"github.com/cli/cli/v2","purl":"pkg:golang/github.com/cli/cli/v2","ranges":["<2.62.0"],"fixed":["2.62.0"],"advisory":"GHSA-p2h2-3vg9-4p87"},{"ecosystem":"Go","name":"github.com/cli/cli","purl":"pkg:golang/github.com/cli/cli","ranges":["<2.62.0","all versions"],"fixed":["2.62.0"],"advisory":"GHSA-p2h2-3vg9-4p87"}],"cwes":["CWE-77"],"aliases":["GHSA-p2h2-3vg9-4p87","GO-2024-3269"],"references":[{"url":"https://github.com/cli/cli/security/advisories/GHSA-p2h2-3vg9-4p87","tags":["x_refsource_CONFIRM","Vendor Advisory","advisory","web"]},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/52xxx/CVE-2024-52308.json","tags":["advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2024-52308","tags":["advisory"]},{"url":"https://github.com/cli/cli","tags":["package"]},{"url":"https://pkg.go.dev/vuln/GO-2024-3269","tags":["web"]}],"patchReferenced":false,"fixAvailable":true,"exploitReferenced":false,"kev":false,"kevAdded":null,"kevDue":null,"kevEntry":null,"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"total"},"epss":0.00906,"epssPercentile":0.60601,"sources":[{"name":"CVE List","url":"https://www.cve.org/CVERecord?id=CVE-2024-52308","ok":true},{"name":"NVD","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-52308","ok":true,"note":"Analyzed"},{"name":"OSV","url":"https://osv.dev/vulnerability/CVE-2024-52308","ok":true,"note":"2 packages"},{"name":"GitHub Advisory","url":"https://github.com/advisories/GHSA-p2h2-3vg9-4p87","ok":true,"note":"GHSA-p2h2-3vg9-4p87"},{"name":"CISA KEV","url":"https://www.cisa.gov/known-exploited-vulnerabilities-catalog","ok":true,"note":"not listed"},{"name":"EPSS","url":"https://api.first.org/data/v1/epss?cve=CVE-2024-52308","ok":true,"note":"scored 2026-11-19"}],"aiTitle":false,"tech":[],"critical":[],"attention":null}