A Leader in the 2026 Gartner® Magic Quadrant™ for Endpoint Protection. Six years running.Six years. Gartner® Magic Quadrant™ Leader.Find Out Why
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-39930

CVE-2024-39930: Gogs Built-in SSH Server RCE Vulnerability

CVE-2024-39930 is a remote code execution vulnerability in Gogs built-in SSH server that allows authenticated attackers to execute arbitrary code via argument injection. This article covers technical details, affected versions, and mitigation.

Published: May 26, 2026

CVE-2024-39930 Overview

CVE-2024-39930 is an argument injection vulnerability in the built-in Secure Shell (SSH) server of Gogs through version 0.13.0. The flaw resides in internal/ssh/ssh.go and allows authenticated attackers to achieve remote code execution on the host running Gogs. Exploitation requires opening an SSH connection to the built-in server and sending a crafted --split-string env request. Windows installations are not affected because the underlying env binary behavior differs. The vulnerability is classified under CWE-88: Argument Injection.

Critical Impact

Authenticated attackers can execute arbitrary commands on the Gogs server, leading to full source code repository compromise and potential lateral movement.

Affected Products

  • Gogs versions up to and including 0.13.0 on Linux
  • Gogs deployments on macOS and BSD-based systems
  • Gogs instances with the built-in SSH server enabled

Discovery Timeline

  • 2024-07-04 - CVE-2024-39930 published to the National Vulnerability Database (NVD)
  • 2025-04-11 - Last updated in NVD database

Technical Details for CVE-2024-39930

Vulnerability Analysis

The vulnerability stems from unsafe handling of user-controlled input passed to the env command within the Gogs built-in SSH server. When a client connects over SSH and issues a command, Gogs invokes env to set up the execution environment for Git operations. Because input is not sanitized for argument-prefixed values, an attacker can supply the --split-string (also known as -S) option, which GNU env accepts to split a single argument into multiple tokens. This effectively allows an attacker to inject a new command path and arguments that env will execute instead of the intended Git handler.

An Exploit-DB entry exists for this issue, and the EPSS probability places it in the top tier of likely-exploited vulnerabilities. Successful exploitation runs commands with the privileges of the Gogs service account, exposing repositories, configuration files, and secrets stored on disk.

Root Cause

The root cause is missing validation of SSH command arguments before they are passed to env. The internal/ssh/ssh.go handler trusts client-supplied tokens and forwards them to the system env binary without filtering option-like strings beginning with --. GNU env on Linux supports --split-string, which alters the program-to-execute semantics and enables argument injection [CWE-88].

Attack Vector

An attacker first authenticates to the Gogs SSH server using a valid account, which can be obtained through open registration on many self-hosted instances. After establishing the SSH session, the attacker issues a request whose command string begins with --split-string= followed by an arbitrary binary path and arguments. Gogs passes this string to env, which interprets the flag and executes the attacker-specified command. Windows installations rely on a different env implementation and are not affected.

No synthetic exploitation code is reproduced here. Technical write-ups are available in the SonarSource analysis of Gogs vulnerabilities and the Vicarius analysis of CVE-2024-39930.

Detection Methods for CVE-2024-39930

Indicators of Compromise

  • SSH session logs on the Gogs host containing command strings that begin with --split-string or -S tokens
  • Unexpected child processes of the Gogs process executing shells, interpreters, or network utilities such as bash, python, curl, or nc
  • New or modified SSH keys, webhooks, or deploy keys created shortly after suspicious SSH activity
  • Outbound network connections from the Gogs service account to untrusted destinations

Detection Strategies

  • Inspect Gogs SSH access logs for command payloads containing --split-string, --block-signal, or other GNU env long options
  • Correlate Git SSH authentication events with subsequent process executions that are not git-upload-pack or git-receive-pack
  • Monitor for env invocations on the Gogs host whose first positional argument begins with --

Monitoring Recommendations

  • Forward Gogs application logs, sshd logs, and host process telemetry to a centralized analytics platform for correlation
  • Establish a baseline of expected child processes spawned by the Gogs service and alert on deviations
  • Track repository configuration changes and administrative actions performed immediately after SSH sessions originating from unfamiliar source addresses

How to Mitigate CVE-2024-39930

Immediate Actions Required

  • Upgrade Gogs to a fixed release as published in the Gogs release notes on GitHub
  • Disable the built-in SSH server in app.ini if an upgrade cannot be applied immediately and route Git-over-SSH through the host sshd
  • Disable open user registration to limit the pool of authenticated attackers
  • Rotate SSH host keys, deploy keys, and any secrets stored within repositories if compromise is suspected

Patch Information

Gogs maintainers track fixes through the project release channel. Review the Gogs GitHub releases page for the latest version and changelog entries referencing the SSH argument injection fix. Apply the upgrade to all production and staging Gogs instances, and verify the running version after deployment.

Workarounds

  • Set [server] START_SSH_SERVER = false in app.ini and rely on the system sshd with the git shell
  • Restrict network access to the Gogs SSH listener using firewall rules or a reverse proxy that enforces source IP allowlists
  • Enforce manual admin approval for new accounts to prevent anonymous attackers from gaining authenticated access
bash
# Configuration example: disable the built-in SSH server in Gogs app.ini
[server]
START_SSH_SERVER = false
SSH_PORT         = 22
DISABLE_SSH      = false

[service]
DISABLE_REGISTRATION         = true
REQUIRE_SIGNIN_VIEW          = true
REGISTER_EMAIL_CONFIRM       = true

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

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechGogs

  • SeverityCRITICAL

  • CVSS Score9.9

  • EPSS Probability11.88%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-88
  • Technical References
  • GitHub Gogs Release Notes

  • SonarSource Blog Post on Gogs

  • Vicarius Analysis of CVE-2024-39930
  • Related CVEs
  • CVE-2026-26194: Gogs Git Service RCE Vulnerability

  • CVE-2025-64111: Gogs Git Service RCE Vulnerability

  • CVE-2025-8110: Gogs RCE Vulnerability via Symlink Handling

  • CVE-2024-56731: Gogs Remote Code Execution Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today 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