{"answers":{"affected":"6 open source packages ship an affected version, including github.com/cli/cli and github.com/cli/cli/v2. It affects 1 product.","exploited":"There is no known exploitation of CVE-2024-52308 in the wild and no public exploit code.","fix":"Upgrade github.com/cli/cli to 2.62.0 or later.","what":"CVE-2024-52308 is a high-severity command injection vulnerability in cli, published on 14 Nov 2024. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link."},"fix_prompt":"Check this codebase for CVE-2024-52308 and fix it if it is affected.\n\nWhat it is: CVE-2024-52308 is a high-severity command injection vulnerability in cli, published on 14 Nov 2024. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.\nExploitation: There is no known exploitation of CVE-2024-52308 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- github.com/cli/cli (Go): affected all versions; no fix listed\n- github.com/cli/cli (Go): affected all versions; fixed in 2.62.0\n- github.com/cli/cli (Go): affected all versions; fixed in 2.62.0\n- github.com/cli/cli/v2 (Go): affected all versions; fixed in 2.62.0\n- github.com/cli/cli/v2 (Go): affected all versions; fixed in 2.62.0\n- github.com/cli/cli/v2 (Go): affected all versions; fixed in 2.62.0\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2024-52308/ (Markdown: https://insights.sbomify.com/CVE-2024-52308/index.md)","id":"CVE-2024-52308","markdown":"https://insights.sbomify.com/CVE-2024-52308/index.md","name":"CVE-2024-52308","record":{"aliases":["AZL-53217","DEBIAN-CVE-2024-52308","GHSA-p2h2-3vg9-4p87","GO-2024-3269","ROOT-OS-DEBIAN-12-CVE-2024-52308","UBUNTU-CVE-2024-52308","USN-7130-1","openSUSE-SU-2024:14509-1","openSUSE-SU-2025:0021-1"],"analysis":{"component_type":"developer_tool","fix_type":"upgrade","impacts":["code_execution"],"network_reachable":"yes","non_default_config":false,"product_category":"GitHub CLI","requires_auth":"low_privilege","summary":"A malicious Codespaces SSH server can inject arguments to execute arbitrary commands on the user's workstation via GitHub CLI.","user_interaction":"required","vuln_class":"command_injection"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[{"product":"cli","vendor":"github"}],"cvss":{"score":8,"severity":"high","source":"cna","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:H","version":"3.1"},"cwes":[{"id":"CWE-77","name":"Improper Neutralization of Special Elements used in a Command"}],"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.","ecosystems":["Go","SUSE:Package Hub 15 SP6","openSUSE:Leap 15.6","openSUSE:Tumbleweed"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"none_known"},"has_fix":true,"headline":"Connecting to a malicious Codespaces via GH CLI could allow command execution on the user's computer","id":"CVE-2024-52308","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"Go","product":null,"products":[],"type":"command_injection","year":"2024"},"n_packages":9,"n_references":1,"next":{"headline":"SFTPGo allows administrators to restrict command execution from the EventManager","id":"CVE-2024-52309"},"packages":[{"ecosystem":"Go","fixed":[],"introduced":["0"],"last_affected":[],"package":"github.com/cli/cli","purl":"pkg:golang/github.com/cli/cli","source":"GO-2024-3269"},{"ecosystem":"Go","fixed":["2.62.0"],"introduced":["0"],"last_affected":[],"package":"github.com/cli/cli","purl":null,"source":"GHSA-p2h2-3vg9-4p87"},{"ecosystem":"Go","fixed":["2.62.0"],"introduced":["0"],"last_affected":[],"package":"github.com/cli/cli","purl":"pkg:golang/github.com/cli/cli","source":"GHSA-p2h2-3vg9-4p87"},{"ecosystem":"Go","fixed":["2.62.0"],"introduced":["0"],"last_affected":[],"package":"github.com/cli/cli/v2","purl":null,"source":"GHSA-p2h2-3vg9-4p87"},{"ecosystem":"Go","fixed":["2.62.0"],"introduced":["0"],"last_affected":[],"package":"github.com/cli/cli/v2","purl":"pkg:golang/github.com/cli/cli/v2","source":"GHSA-p2h2-3vg9-4p87"},{"ecosystem":"Go","fixed":["2.62.0"],"introduced":["0"],"last_affected":[],"package":"github.com/cli/cli/v2","purl":"pkg:golang/github.com/cli/cli/v2","source":"GO-2024-3269"},{"ecosystem":"SUSE:Package Hub 15 SP6","fixed":["2.65.0-bp156.2.17.1"],"introduced":["0"],"last_affected":[],"package":"gh","purl":"pkg:rpm/suse/gh\u0026distro=SUSE%20Package%20Hub%2015%20SP6","source":"openSUSE-SU-2025:0021-1"},{"ecosystem":"openSUSE:Leap 15.6","fixed":["2.65.0-bp156.2.17.1"],"introduced":["0"],"last_affected":[],"package":"gh","purl":"pkg:rpm/opensuse/gh\u0026distro=openSUSE%20Leap%2015.6","source":"openSUSE-SU-2025:0021-1"},{"ecosystem":"openSUSE:Tumbleweed","fixed":["2.62.0-1.1"],"introduced":["0"],"last_affected":[],"package":"gh","purl":"pkg:rpm/opensuse/gh\u0026distro=openSUSE%20Tumbleweed","source":"openSUSE-SU-2024:14509-1"}],"prev":{"headline":"authentik allows a timing attack due to missing constant time comparison for metrics view","id":"CVE-2024-52307"},"products":["cli"],"published":"2024-11-14","related":[{"cvss_score":7.4,"headline":"GitHub CLI tokens leak via `gh attestation` commands","id":"CVE-2026-48501","kev_date_added":null,"published":"2026-05-29"},{"cvss_score":3.5,"headline":"gh: GitHub Actions log output in `gh run view` allows terminal escape sequence injection","id":"CVE-2026-45803","kev_date_added":null,"published":"2026-05-15"}],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"CC BY 4.0","name":"Go Vulnerability Database","prefix":"GO"},{"class":"attribution","licence":"CC BY 4.0","name":"SUSE","prefix":"openSUSE"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":"no","exploitation":"none","technical_impact":"total"},"state":"PUBLISHED","updated":"2024-11-15","vendors":["cli"]},"summary":"A malicious Codespaces SSH server can inject arguments to execute arbitrary commands on the user's workstation via GitHub CLI.","url":"https://insights.sbomify.com/CVE-2024-52308/"}