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-2022-30781

CVE-2022-30781: Gitea XSS Vulnerability

CVE-2022-30781 is a cross-site scripting flaw in Gitea that occurs due to improper escaping of git fetch remote. This post covers the technical details, affected versions, security impact, and mitigation.

Updated: May 16, 2026

CVE-2022-30781 Overview

CVE-2022-30781 affects Gitea versions before 1.16.7. The application fails to escape the remote parameter passed to git fetch, allowing an authenticated attacker to inject arbitrary command-line options. This improper output neutralization [CWE-116] enables remote code execution on the Gitea server. The flaw impacts integrity but not confidentiality or availability according to the CVSS vector. Public exploits for this issue have been published on Packet Storm Security, and the EPSS percentile of 99.158 indicates a high probability of exploitation activity relative to other CVEs.

Critical Impact

Attackers can execute arbitrary code on the Gitea server by submitting a crafted remote URL that is passed unescaped to git fetch.

Affected Products

  • Gitea versions prior to 1.16.7
  • Self-hosted Gitea instances exposing repository mirroring or fetch functionality
  • Container and binary deployments of Gitea on any supported platform

Discovery Timeline

  • 2022-05-16 - CVE-2022-30781 published to the National Vulnerability Database
  • 2022-05 - Gitea 1.16.7 released with the fix in pull requests #19487 and #19490
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2022-30781

Vulnerability Analysis

The vulnerability resides in how Gitea constructs git fetch commands when interacting with remote repositories. The remote URL value supplied through Gitea is concatenated into the git command line without proper escaping or argument separation. Because git supports option arguments that begin with a dash, a remote string crafted to look like an option (rather than a URL) is interpreted by git as a flag. Several git options accept file paths or external helper specifications that can execute code. The result is a command injection chain that runs under the Gitea service account on the host. The fix introduces explicit argument termination and validation of remote inputs before they reach the git subprocess.

Root Cause

The root cause is improper output neutralization for downstream components [CWE-116]. Gitea trusted the structure of the remote string when assembling the git invocation, and it did not insert -- to terminate option parsing or sanitize values beginning with -. Any caller that could set a remote could therefore smuggle git options into the executed process.

Attack Vector

The attack vector is network-based and requires the attacker to reach a Gitea workflow that triggers git fetch against an attacker-controlled remote. Mirror configuration, repository migration, and pull-mirror refresh paths have been cited in public proof-of-concept exploits. Once the malicious remote is fetched, the injected git option causes git to execute attacker-supplied logic, yielding code execution on the Gitea host. Detailed exploitation steps are documented in the Packet Storm Gitea 1.16.6 Remote Code Execution advisory and the Packet Storm Gitea Git Fetch Remote Code Execution advisory.

No verified exploit code is reproduced here. Refer to the linked advisories for technical proof-of-concept details.

Detection Methods for CVE-2022-30781

Indicators of Compromise

  • Repository mirror or remote configurations where the remote URL begins with a dash character (for example, values starting with --upload-pack= or -u).
  • Unexpected child processes spawned by the Gitea binary, particularly shells, interpreters, or network utilities launched from git fetch operations.
  • Outbound network connections from the Gitea host to unfamiliar destinations correlated with mirror refresh events.

Detection Strategies

  • Review the Gitea database mirror and repository tables for remote URLs containing leading hyphens or shell metacharacters.
  • Inspect Gitea application logs for failed or anomalous fetch operations, especially against externally provided remotes.
  • Correlate Gitea process telemetry with git subprocess command lines to identify option injection patterns.

Monitoring Recommendations

  • Enable process command-line auditing on the Gitea host and alert when git is invoked with suspicious option values traced back to the Gitea parent process.
  • Forward Gitea access and action logs to a centralized SIEM and create rules that flag repository migration and mirror creation events from low-trust accounts.
  • Baseline outbound traffic from the Gitea server and alert on deviations during mirror sync windows.

How to Mitigate CVE-2022-30781

Immediate Actions Required

  • Upgrade Gitea to version 1.16.7 or later as published in the Gitea 1.16.7 release announcement.
  • Audit existing repositories and mirrors for malicious remote URLs and remove or rewrite any values beginning with a dash.
  • Restrict repository creation, migration, and mirror configuration to trusted users until the patch is applied.

Patch Information

The issue is fixed in Gitea 1.16.7. The relevant code changes are in GitHub Pull Request #19487 and GitHub Pull Request #19490, which add input validation and explicit argument separation when invoking git. Administrators should apply binary, container, or package upgrades depending on the deployment method.

Workarounds

  • Disable repository migration and mirroring features for non-administrative users if patching cannot be performed immediately.
  • Place Gitea behind an authenticated reverse proxy and limit network egress from the Gitea host to known git endpoints.
  • Run the Gitea service under a least-privileged account with no shell access to limit the impact of successful injection.
bash
# Verify the running Gitea version is patched
gitea --version
# Expected output: Gitea version 1.16.7 or newer

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

  • Vulnerability Details
  • TypeXSS

  • Vendor/TechGitea

  • SeverityHIGH

  • CVSS Score7.5

  • EPSS Probability80.73%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityNone
  • CWE References
  • CWE-116
  • Technical References
  • Packet Storm RCE Exploit

  • Packet Storm RCE Exploit
  • Vendor Resources
  • Gitea Release Announcement

  • GitHub Pull Request #19487

  • GitHub Pull Request #19490
  • Related CVEs
  • CVE-2024-6886: Gitea Open Source Git Server XSS Flaw

  • CVE-2026-20912: Gitea Auth Bypass Vulnerability

  • CVE-2026-20904: Gitea Auth Bypass Vulnerability

  • CVE-2026-20897: Gitea Auth Bypass 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