Join the Cyber Forum: Threat Intel on May 12, 2026 to learn how AI is reshaping threat defense.Join the Virtual Cyber Forum: Threat IntelRegister Now
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2024-52308

CVE-2024-52308: GitHub CLI RCE Vulnerability

CVE-2024-52308 is a remote code execution vulnerability in GitHub CLI versions 2.6.1 and earlier via malicious codespace SSH servers. This article covers the technical details, affected versions, impact, and mitigation.

Published: March 31, 2026

CVE-2024-52308 Overview

The GitHub CLI version 2.6.1 and earlier contains a critical remote code execution vulnerability that can be exploited through a malicious codespace SSH server. When developers use the gh codespace ssh or gh codespace logs commands, the CLI retrieves SSH connection details including the remote username from the codespace's devcontainer. A malicious third-party devcontainer with a modified SSH server can inject malicious SSH arguments within these connection details, leading to arbitrary code execution on the user's workstation.

Critical Impact

Attackers can achieve remote code execution on developer workstations by hosting malicious devcontainers that inject commands through crafted SSH usernames, potentially compromising development environments and source code.

Affected Products

  • GitHub CLI versions prior to 2.62.0
  • GitHub CLI version 2.6.1 and earlier
  • Systems using gh codespace ssh or gh codespace logs commands

Discovery Timeline

  • 2024-11-14 - CVE CVE-2024-52308 published to NVD
  • 2024-11-20 - Last updated in NVD database

Technical Details for CVE-2024-52308

Vulnerability Analysis

This vulnerability represents a Command Injection flaw (CWE-77) in the GitHub CLI's handling of SSH connection details from codespace environments. When developers connect to remote codespaces, they rely on an SSH server running within the devcontainer, typically provided through GitHub's default devcontainer image. The GitHub CLI retrieves SSH connection parameters, including the remote username, and passes these directly to the system's ssh command without proper validation.

The core issue stems from the lack of input sanitization when constructing SSH commands. The remote username retrieved from the codespace is incorporated directly into the command-line arguments passed to the SSH binary. An attacker who controls the devcontainer can craft a malicious username containing SSH options and shell metacharacters that alter the behavior of the SSH command execution.

Root Cause

The root cause lies in the GitHub CLI's trust of user-controlled data from the remote codespace environment. Specifically, the SSH connection details including the username are retrieved via RPC calls to the codespace and then used directly in constructing shell commands. The code paths in internal/codespaces/rpc/invoker.go and pkg/cmd/codespace/ssh.go did not validate or sanitize the remote username before incorporating it into SSH command arguments.

Attack Vector

The attack exploits the command injection vulnerability by embedding malicious SSH options within the remote username field. An attacker creates a malicious devcontainer with a modified SSH server that returns a crafted username such as -oProxyCommand="echo hacked" #. When the victim connects using gh codespace ssh or views logs with gh codespace logs:

  1. The GitHub CLI retrieves the malicious username from the codespace
  2. The CLI constructs an SSH command incorporating the username
  3. The -oProxyCommand flag causes SSH to execute the attacker's command
  4. The # shell comment character causes subsequent legitimate SSH arguments to be ignored
  5. Arbitrary code executes on the victim's local workstation with their privileges

This attack requires user interaction—the victim must connect to the malicious codespace—but requires no privileges on the victim's system beyond what the user already has.

Detection Methods for CVE-2024-52308

Indicators of Compromise

  • Unexpected SSH connections from GitHub CLI with unusual -o options in process command lines
  • Processes spawned as children of SSH connections initiated by gh codespace commands
  • Suspicious outbound network connections from processes spawned during codespace SSH sessions
  • Log entries showing gh codespace ssh or gh codespace logs commands with malformed usernames

Detection Strategies

  • Monitor process creation events for SSH commands containing -oProxyCommand or other injection patterns
  • Audit GitHub CLI version across development environments to identify vulnerable installations
  • Implement endpoint detection rules for unusual process trees originating from gh CLI executions
  • Review devcontainer configurations in repositories for suspicious SSH server modifications

Monitoring Recommendations

  • Enable command-line auditing on developer workstations to capture SSH command arguments
  • Configure SentinelOne Singularity to alert on suspicious SSH command patterns and process injection behaviors
  • Monitor for unexpected child processes of SSH sessions initiated through the GitHub CLI
  • Implement repository scanning to detect potentially malicious devcontainer configurations

How to Mitigate CVE-2024-52308

Immediate Actions Required

  • Upgrade GitHub CLI to version 2.62.0 or later immediately across all development environments
  • Audit recent gh codespace ssh and gh codespace logs usage for connections to untrusted repositories
  • Review and verify devcontainer configurations in any third-party repositories before connecting
  • Temporarily avoid using gh codespace ssh or gh codespace logs with untrusted codespaces until patched

Patch Information

The vulnerability has been patched in GitHub CLI version 2.62.0. The fix implements proper validation of the remote username information before it is used in SSH command construction, preventing injection of malicious SSH arguments. Users should update their GitHub CLI installation to version 2.62.0 or later. For detailed information, see the GitHub Security Advisory.

Workarounds

  • Only connect to codespaces from trusted repositories with verified devcontainer configurations
  • Manually inspect devcontainer configurations before initiating codespace SSH sessions
  • Use alternative SSH connection methods that do not rely on GitHub CLI's automatic username retrieval
  • Implement network segmentation to limit potential damage from workstation compromise
bash
# Upgrade GitHub CLI to patched version
# On macOS with Homebrew:
brew upgrade gh

# On Linux with apt:
sudo apt update && sudo apt install gh

# Verify installed version is 2.62.0 or later:
gh --version

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechGithub Cli

  • SeverityCRITICAL

  • CVSS Score9.6

  • EPSS Probability4.63%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityHigh
  • AvailabilityHigh
  • CWE References
  • CWE-77
  • Vendor Resources
  • GitHub Security Advisory
  • Related CVEs
  • CVE-2024-53858: GitHub CLI Token Leakage Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English