CVE-2024-52308: GitHub CLI Remote Code Execution Vulnerability via Malicious Codespaces

github.com/cli/cli/v2 Updated 02 Oct 2025

Summary

14/11/2024
Yes i
High
8.0

CVE-2024-52308: Connecting to a malicious Codespaces via GH CLI could allow command execution on the user's computer. Affects github.com/cli/cli/v2 versions < 2.62.0. Fixed in 2.62.0. How to fix ↓

Also tracked for

The same CVE-2024-52308 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

GitHub CLI is a command-line tool that allows developers to interact with GitHub repositories and manage workflows directly from the terminal. It provides functionalities such as creating issues, managing pull requests, and accessing Codespaces. However, its reliance on SSH connections to remote Codespaces makes it susceptible to vulnerabilities, particularly when users connect to untrusted or malicious environments.

Vulnerability Detail

A security vulnerability exists in GitHub CLI that could enable remote code execution (RCE) when users connect to a compromised Codespace SSH server using the 'gh codespace ssh' or 'gh codespace logs' commands. The issue arises from improper handling of SSH connection details, allowing a malicious devcontainer to inject harmful SSH arguments. For instance, if a remote username is crafted to include '-oProxyCommand="echo hacked" #', it can lead to arbitrary command execution on the user's machine. This vulnerability has a CVSS score of 8.0, indicating a high severity level, and could potentially compromise user data and system integrity.

How To Fix

Latest published version: v2.103.0 as of 23 Oct 2026

go get github.com/cli/cli/v2@v2.103.0

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

2.62.0

This is the first release that contains the fix.

go get github.com/cli/cli/v2@v2.62.0

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

Exercise caution when using custom devcontainer images. Prefer using default or pre-built devcontainers from trusted sources to minimize the risk of connecting to malicious environments.

Conclusion

The CVE-2024-52308 vulnerability in GitHub CLI poses a significant risk of remote code execution when connecting to malicious Codespaces. Users are strongly advised to upgrade to version 2.62.0 or later and to exercise caution with custom devcontainer images to protect their systems.

See every vulnerability recorded for github.com/cli/cli/v2 →

Share this vulnerability

FAQ

CVE-2024-52308 is a vulnerability in GitHub CLI that allows remote code execution when connecting to a malicious Codespace.

Versions of GitHub CLI prior to 2.62.0 are affected by this vulnerability. You can check your version by running 'gh --version' in your terminal.

If an immediate upgrade is not possible, avoid connecting to untrusted Codespaces and use only verified devcontainer images.

Exploitation of this vulnerability could allow an attacker to execute arbitrary commands on your workstation, potentially compromising your data and system security.

You can use Vulert to monitor and alert for open-source vulnerabilities in your software. It provides real-time alerts without requiring code access or installation.

Related vulnerabilities

Recent vulnerabilities recorded for github.com/cli/cli/v2.

How To Fix

Latest published version: v2.103.0 as of 23 Oct 2026

go get github.com/cli/cli/v2@v2.103.0

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

2.62.0

This is the first release that contains the fix.

go get github.com/cli/cli/v2@v2.62.0

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback