Read the docs
TI-2024-34983 Aliases CVE-2024-52308GHSA-p2h2-3vg9-4p87

Connecting to a malicious Codespaces via GH CLI could allow command execution on the user's computer

Priority MEDIUM 45CWE-77Published · Updated

Key facts

Attack vector
Network
Privileges required
None
User interaction
Required
Attack complexity
Low
Impact type
Code execution
Confidentiality · integrity · availability
High · High · High
Fix status
Fixed

Attack profile from CVSS 3.1 · NVD. Fix status from CNA and GitHub. Impact type from CWE-77.

Summary

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. Developers 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. This 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. In `2.62.0`, the remote username information is being validated before being used.

Why it matters now

Exploitation None reported CISA SSVC · not in CISA KEV
EPSS 0.00906 60th percentileScored 2026-11-07
Fix Fixed github.com/cli/cli/v2 (Go): 2.62.0github.com/cli/cli (Go): 2.62.0

SSVC decision points

CISA ADP · SSVC 2.0.3

Exploitation
None
Automatable
No
Technical impact
Total

The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.

Affected products

VendorProductAffected versionsFixed inStatusSource
clicliup to 2.61.0—No fix listedCNA
—github.com/cli/cli/v2 (Go)before 2.62.02.62.0Patch availableGHSA-p2h2-3vg9-4p87
—github.com/cli/cli (Go)before 2.62.02.62.0Patch availableGHSA-p2h2-3vg9-4p87
  • cli Vendorcli Affected up to 2.61.0 Fixed in — No fix listed CNA
  • github.com/cli/cli/v2 (Go) Vendor— Affected before 2.62.0 Fixed in 2.62.0 Patch available GHSA-p2h2-3vg9-4p87
  • github.com/cli/cli (Go) Vendor— Affected before 2.62.0 Fixed in 2.62.0 Patch available GHSA-p2h2-3vg9-4p87

CPE configurations NVD · 1

CPEVersionsRoleVendor
cpe:2.3:a:github:cli:*:*:*:*:*:*:*:*before 2.62.0VulnerableGitHub
  • cpe:2.3:a:github:cli:*:*:*:*:*:*:*:* Versions before 2.62.0 Vulnerable ·GitHub

Remediation

  • Fix · GHSA-p2h2-3vg9-4p87 github.com/cli/cli/v2 (Go) Fixed in 2.62.0 Advisory →
  • Fix · GHSA-p2h2-3vg9-4p87 github.com/cli/cli (Go) Fixed in 2.62.0 Advisory →

Timeline

  1. 2026-10-02 Threatist record created from CVE-2024-52308
  2. 2026-10-03 Alias added: GHSA-p2h2-3vg9-4p87

References

  • TI-2025-18873 `gh attestation verify` returns incorrect exit code during verification if no attestations are present CVSS 3.1MEDIUM 6.3
  • TI-2026-33538 gh: GitHub Actions log output in `gh run view` allows terminal escape sequence injection CVSS 3.1LOW 3.5
  • TI-2026-35862 GitHub CLI tokens leak via `gh attestation` commands CVSS 3.1CRITICAL 9.1
  • TI-2024-36052 go-gh `auth.TokenForHost` violates GitHub host security boundary within a codespace CVSS 3.1HIGH 7.5
  • TI-2024-36051 Recursive repository cloning can leak authentication tokens to non-GitHub submodule hosts in the gh cli CVSS 3.1MEDIUM 6.5
  • TI-2024-36248 GitHub CLI allows downloading malicious GitHub Actions workflow artifact to result in path traversal vulnerability CVSS 4.0MEDIUM 6.3
See all 13 →

Sources