{"cve":"CVE-2024-52308","nvd":{"published":"2024-11-14T23:15:05.727","modified":"2026-06-17T08:06:59.113","status":"Analyzed","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://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.","cvss_v4":null,"cvss_v3":{"version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H","score":9.6},"cwes":["CWE-77"],"references":["https://github.com/cli/cli/security/advisories/GHSA-p2h2-3vg9-4p87"],"products":["github:cli"],"source":"nvd","synced_at":"2026-10-19T21:57:07.693694550+00:00"},"epss":{"cve":"CVE-2024-52308","score":0.00906,"percentile":0.59871,"date":"2026-10-31"},"kev":null,"osv":[{"id":"GHSA-p2h2-3vg9-4p87","url":"https://osv.dev/vulnerability/GHSA-p2h2-3vg9-4p87","summary":"Connecting to a malicious Codespaces via GH CLI could allow command execution on the user's computer","modified":"2026-09-10T03:50:20.953491755Z","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"]},{"ecosystem":"Go","name":"github.com/cli/cli","purl":"pkg:golang/github.com/cli/cli","ranges":["<2.62.0"],"fixed":["2.62.0"]}]},{"id":"GO-2024-3269","url":"https://osv.dev/vulnerability/GO-2024-3269","summary":"Connecting to a malicious Codespaces via GH CLI could allow command execution on the user's computer in github.com/cli/cli","modified":"2026-02-04T04:11:55.504706Z","packages":[{"ecosystem":"Go","name":"github.com/cli/cli","purl":"pkg:golang/github.com/cli/cli","ranges":["all versions"],"fixed":[]},{"ecosystem":"Go","name":"github.com/cli/cli/v2","purl":"pkg:golang/github.com/cli/cli/v2","ranges":["<2.62.0"],"fixed":["2.62.0"]}]}],"attribution":["This product uses the NVD API but is not endorsed or certified by the NVD.","EPSS scores: FIRST Exploit Prediction Scoring System, https://www.first.org/epss","Known exploited vulnerabilities: CISA Known Exploited Vulnerabilities Catalog, https://www.cisa.gov/known-exploited-vulnerabilities-catalog","Package advisories: OSV (https://osv.dev), from the GitHub Advisory Database, PyPA, Go, RustSec and other ecosystem databases, under CC-BY 4.0 or CC0","CVE records: the CVE Program's CVE List (https://www.cve.org), under its terms of use (https://www.cve.org/Legal/TermsOfUse). CVE is a registered trademark of The MITRE Corporation; this product is not affiliated with the CVE Program."]}