The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
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
    • 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-2022-0415

CVE-2022-0415: Gogs Repository File Upload RCE Vulnerability

CVE-2022-0415 is a remote command execution vulnerability in Gogs affecting repository file uploads. Attackers can execute arbitrary commands on the server. This article covers technical details, affected versions, and mitigations.

Published: February 17, 2026

CVE-2022-0415 Overview

CVE-2022-0415 is a Remote Command Execution (RCE) vulnerability in Gogs, a popular self-hosted Git service. The vulnerability exists in the repository file upload functionality, where insufficient validation of the upload TreePath and file name parameters allows authenticated attackers to execute arbitrary commands on the server. Gogs versions prior to 0.12.6 are affected by this security flaw.

Critical Impact

Authenticated attackers can achieve remote command execution on servers running vulnerable Gogs instances, potentially leading to complete system compromise, data exfiltration, and lateral movement within the network.

Affected Products

  • Gogs versions prior to 0.12.6
  • Self-hosted Gogs installations with file upload functionality enabled
  • Any deployment using unpatched gogs:gogs components

Discovery Timeline

  • 2022-03-21 - CVE-2022-0415 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2022-0415

Vulnerability Analysis

This vulnerability stems from improper input validation (CWE-20) and unrestricted file upload capabilities (CWE-434) in the Gogs repository editor module. The application fails to properly sanitize the TreePath parameter and file names during the repository file upload process, allowing attackers to bypass security controls and execute arbitrary commands.

The attack can be performed remotely over the network by any authenticated user with repository access. No user interaction is required beyond the initial authentication, and successful exploitation results in complete compromise of confidentiality, integrity, and availability of the affected system.

Root Cause

The root cause lies in the internal/db/repo_editor.go file where the upload TreePath and file name parameters are not properly validated before being processed. The absence of path traversal checks and file type restrictions enables attackers to upload malicious files to arbitrary locations or craft specially formatted paths that result in command execution.

Attack Vector

The vulnerability is exploitable over the network by authenticated users. An attacker with valid credentials can:

  1. Authenticate to the Gogs instance with any repository access
  2. Navigate to the file upload functionality within a repository
  3. Craft a malicious TreePath or file name parameter
  4. Upload a file that triggers command execution on the server

The security patch introduced in commit 0fef3c9082269e9a4e817274942a5d7c50617284 addresses this by implementing proper path validation using the pathutil package:

go
 	"strings"
 	"time"
 
+	"github.com/pkg/errors"
 	gouuid "github.com/satori/go.uuid"
 	"github.com/unknwon/com"
 
 	"github.com/gogs/git-module"
 
 	"gogs.io/gogs/internal/conf"
 	"gogs.io/gogs/internal/cryptoutil"
-	"gogs.io/gogs/internal/db/errors"
+	dberrors "gogs.io/gogs/internal/db/errors"
 	"gogs.io/gogs/internal/gitutil"
 	"gogs.io/gogs/internal/osutil"
+	"gogs.io/gogs/internal/pathutil"
 	"gogs.io/gogs/internal/process"
 	"gogs.io/gogs/internal/tool"
)

Source: GitHub Commit Details

Detection Methods for CVE-2022-0415

Indicators of Compromise

  • Unusual file upload requests to Gogs repositories with suspicious TreePath parameters containing path traversal sequences (e.g., ../, ..%2f)
  • Unexpected files appearing in system directories outside the repository structure
  • Abnormal process execution spawned by the Gogs service process
  • Web server logs showing malformed upload requests with encoded special characters

Detection Strategies

  • Monitor Gogs application logs for file upload operations with unusual path patterns or encoded characters
  • Implement web application firewall (WAF) rules to detect path traversal attempts in upload parameters
  • Deploy endpoint detection and response (EDR) solutions to identify command execution from Gogs processes
  • Review audit logs for authenticated users performing suspicious upload activities

Monitoring Recommendations

  • Enable verbose logging for the Gogs application to capture all file upload operations
  • Configure alerting on process creation events originating from the Gogs service account
  • Monitor network traffic for outbound connections initiated by the Gogs server that could indicate post-exploitation activity
  • Implement file integrity monitoring on critical system directories

How to Mitigate CVE-2022-0415

Immediate Actions Required

  • Upgrade Gogs to version 0.12.6 or later immediately
  • Review Gogs access logs for signs of exploitation attempts
  • Audit user accounts with repository access for any unauthorized activity
  • Consider temporarily disabling file upload functionality if immediate patching is not possible

Patch Information

The vulnerability has been addressed in Gogs version 0.12.6. The security fix was implemented in commit 0fef3c9082269e9a4e817274942a5d7c50617284, which adds proper validation of the upload TreePath and file name parameters using the pathutil package. Organizations should update to this version or later to remediate the vulnerability. For detailed patch information, refer to the GitHub Commit Details and the Huntr Bounty Report.

Workarounds

  • Restrict repository file upload permissions to only trusted administrators until the patch can be applied
  • Implement network segmentation to limit the blast radius if the Gogs server is compromised
  • Deploy a reverse proxy with strict input validation rules to filter malicious upload requests
  • Consider running Gogs in a containerized environment with restricted capabilities to limit post-exploitation impact
bash
# Example: Restrict file upload permissions via Gogs configuration
# Edit app.ini to limit upload capabilities
[repository.upload]
ENABLED = false  # Disable file uploads until patched
# Or restrict to specific file types
ALLOWED_TYPES = .md,.txt,.json

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

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechGogs

  • SeverityHIGH

  • CVSS Score8.8

  • EPSS Probability90.30%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-20

  • CWE-434
  • Vendor Resources
  • GitHub Commit Details

  • Huntr Bounty Report
  • 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
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