☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]
Gogs logo [ WEBSITE ] [ VENDOR STATS ]
CVSS: 10 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H

CVE-2022-1986

CVE-2022-1986 — OS Command Injection in gogs/gogs
📅 PUBLISHED: 2022-06-09 00:00 UTC 🔄 UPDATED: 2026-10-14 23:33 UTC
[ PATCH UNDER REVIEW ↓ ] Remains UNDER REVIEW until an independent source confirms the fix
[ DEFENSE PATCH ↓ ]
💣 PoC: None
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 4.42%
👁️
4.42% probability
110.5× above the median CVE
Tier: HIGH
30-day exploitation window · FIRST.org · updated daily
🥷 MITRE: T1203 / T1190
👁️
MITRE ATT&CK Tactic - Describes the strategy hackers use to execute this attack.
Country: Global License: Open Source
VULNERABLE: version not auto-detected — verify your deployed version locally
CVSS VECTOR BREAKDOWN 10.0
AV: N Attack Vector Network
AC: L Attack Complexity Low
PR: N Privileges Required None
UI: N User Interaction None
S: C Scope Changed
C: H Confidentiality High
I: H Integrity High
A: H Availability High
10.0
THREAT LEVEL
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2022-1986 is a critical OS Command Injection vulnerability affecting the Gogs self-hosted Git service, present in all versions prior to 0.12.9. The vulnerability allows an unauthenticated or low-privileged attacker to execute arbitrary operating system commands on the underlying server hosting Gogs, potentially leading to complete system compromise. Given Gogs' typical deployment as an internet-facing code repository service, this vulnerability represents a significant threat to organizations running affected versions, with a maximum CVSS score of 10.0 reflecting the ease of exploitation and severity of impact. Currently classified as UNPATCHED with no vendor fix available, organizations running vulnerable versions face ongoing exposure.

VENDOR_NAME: Gogs

AFFECTED_VERSION: < 0.12.9

MITRE_TACTIC: T1203 — Exploitation for Client Execution (alternatively T1190 — Exploit Public-Facing Application)

SHODAN_DORKS:

  • "Gogs" port:"3000"
  • "Powered by Gogs" http.title:"Gogs"
  • "gogs" "login" "version:"

CWE_ID: CWE-78

CVSS_VECTOR: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H

POC_STATUS: Unknown

PATCH_DETAILS: No patch available — vulnerability confirmed UNPATCHED as of analysis date

⚡ AUTOMATE YOUR CVE INTELLIGENCE

This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.

›Patch confidence — UNVERIFIED to CONFIRMED, cross-referenced NVD + RHSA + Debian
›Exploit & PoC — poc_status, poc_url, has_exploit. Not in NVD.
›Shodan dorks — ready-made queries to find exposed vulnerable systems
›Detection rules — YARA · Wazuh · Elastic (all plans) · Sigma (Pro)
›pending_fields — know exactly which of 7 fields NVD hasn't processed yet
›Free backfill — data incomplete when you paid? Re-check within 30 days = 0 credits
PAYG €0.08/lookup Standard €19/mo (was €29) · 5k credits Pro €65/mo (was €99) · 20k credits FOUNDING PRICE · LOCKED FOR LIFE · ENDS 31 DEC 2026
[ FROM €19/MO ]
Free sandbox key available
No signup required

Technical Analysis

CVE-2022-1986 is classified as an OS Command Injection vulnerability within the Gogs repository management platform, disclosed via the huntr.dev bug bounty platform. OS Command Injection (CWE-78) occurs when user-supplied input is improperly concatenated into a system command string without adequate sanitization or parameterization, allowing an attacker to inject arbitrary shell commands that execute with the privileges of the Gogs process.

The Gogs application, written primarily in Go, provides a web-based Git repository hosting interface with functionality including repository management, issue tracking, user authentication, and webhook processing. The OS Command Injection flaw exists in versions prior to 0.12.9, indicating that some input handling pathway fails to properly validate or escape user-controlled payloads before passing them to the operating system shell.

The vulnerability class itself suggests that certain Gogs features which invoke external commands — such as Git binary execution for repository operations, archive generation, or similar functionality — are susceptible to command injection through crafted request parameters. While the specific vulnerable function is not disclosed in the CVE description, the mechanism involves the injection of shell metacharacters (such as ;, &, |, $(), or backticks) that terminate the intended command and introduce attacker-controlled commands into the execution chain.

The NVD description is notably sparse, providing only the affected version range and vulnerability class without detailing the specific endpoint, parameter, or code path responsible. This limitation means that precise exploitation details are unavailable; however, OS Command Injection vulnerabilities in web applications of this nature typically manifest through HTTP request parameters that are subsequently used in server-side command construction.

The CVSS score of 10.0 (Critical) indicates: network-exploitable without authentication (AV:N/AC:L/PR:N/UI:N), with scope change (S:C) suggesting the compromised component can affect resources beyond its security scope, and high impact on confidentiality, integrity, and availability (C:H/I:H/A:H). This scoring reflects the potential for complete server compromise with no user interaction.

Given that the CNA data lists the vulnerability as UNPATCHED with zero patch sources and no vendor fix, organizations running Gogs 0.12.8 or earlier remain fully exposed to this critical flaw. The EPSS score of 0.04419 (90.4th percentile) indicates that this vulnerability sits among the most likely to be exploited based on active threat intelligence, despite the relatively low baseline probability.

Exploitation Scenarios

The exploitation of CVE-2022-1986 follows a generalized attack chain for OS Command Injection in self-hosted web applications. Due to the absence of specific technical details in the NVD description, the following scenario is inferred from the vulnerability class and Gogs' known architecture:

Step 1 — Reconnaissance and Target Identification: Attackers typically locate vulnerable Gogs instances using internet-wide scanning services (Shodan, Censys) or search engines to identify servers running Gogs versions prior to 0.12.9. Gogs commonly operates on port 3000 and is identifiable through its distinctive login page, HTTP response headers (such as X-Gogs-Version or server banner), or login page source comments. Automated scanners targeting Gogs installations can fingerprint the version and identify vulnerable targets.

Step 2 — Triggering the Injection Point: The attacker interacts with the Gogs web interface, targeting any functionality that invokes server-side system commands. Based on the vulnerability class, plausible attack surfaces include repository creation or management endpoints, Git operation triggers, or administrative functions that pass user-controlled strings to shell commands. The attacker crafts HTTP requests containing OS command injection payloads within parameters that are subsequently used in command construction.

Step 3 — Payload Execution: The attacker injects shell command delimiters and payloads into the vulnerable parameter. A standard OS command injection payload for a web application might include:

  • Appending commands using ;, &&, or | after user-controlled input
  • Using command substitution syntax such as $(command) or backticks
  • Injecting newline characters followed by additional commands

When the Gogs server processes the request, the injected commands execute with the same privileges as the Gogs process itself. Since Gogs typically runs as a dedicated service account or as root in smaller deployments, the executed commands inherit these privileges.

Step 4 — Post-Exploitation Impact: Successful exploitation enables remote code execution on the hosting server. An attacker can:

  • Execute arbitrary system commands with the Gogs service account privileges
  • Establish reverse shells for persistent access
  • Read sensitive files including SSH keys, database credentials, environment variables
  • Access and exfiltrate all repositories by cloning and downloading them
  • Potentially escalate privileges if running with elevated privileges
  • Pivot to other network-accessible systems from the compromised host

No public PoC is available for this vulnerability; the attack chain is inferred from the vulnerability class and Gogs' architecture. The lack of a disclosed PoC does not diminish the severity, as sophisticated threat actors frequently develop in-house exploits for known critical vulnerabilities.

Impact Assessment

Business Impact: CVE-2022-1986 represents a critical risk to organizations hosting Gogs as their primary Git repository service. The remote code execution capability directly impacts:

  • Confidentiality (High): Complete access to all source code repositories hosted on the instance, including proprietary intellectual property, credentials hardcoded in code, and internal architecture documentation
  • Integrity (High): Ability to modify repository contents, inject backdoors into source code, tamper with commit history, and manipulate release artifacts that downstream build pipelines may consume
  • Availability (High): Server takeover enables service disruption, data destruction, and ransomware-style attacks against the hosting infrastructure

Affected Systems: All Gogs deployments running versions prior to 0.12.9 are vulnerable. This includes production Git servers, internal development infrastructure, CI/CD systems that integrate with Gogs, and any downstream consumers of repositories hosted on affected instances.

Blast Radius: The CVSS scope change (S:C) indicates the vulnerability's impact extends beyond the immediate Gogs process. The compromised server can serve as a staging point for lateral movement into the wider network, attacking adjacent systems that trust the Git server, and potentially compromising build systems that automatically pull code from the repository. If the Gogs service runs with elevated privileges, the entire host operating system becomes the blast radius.

Exploitation Likelihood: The EPSS percentile ranking (90.4%) places this among the most actively discussed and potentially exploited vulnerabilities. The high CVSS score and wide adoption of Gogs across development teams increase the attack surface. The UNPATCHED status compounds the risk, as there is no remediation available from the vendor.

Detection Guidance

Sigma Rule

title: Gogs OS Command Injection Attempt (CVE-2022-1986)
id: 3b7c14a4-3b5e-4e1d-9cf8-8f45f9b26a4e
status: experimental
description: Detects potential OS command injection attempts against Gogs web interface versions prior to 0.12.9
author: ValtersIt SOC
date: 2024/01/17
logsource:
  category: webserver
  product: gogs
detection:
  selection_web_access:
    cs-method:
      - 'POST'
      - 'GET'
    cs-uri-query|contains|all:
      - ';'
      - 'id'
  selection_command_injection:
    cs-uri-query|contains:
      - '&&'
      - '||'
      - '|whoami'
      - '$(id)'
      - '`id`'
      - ';id;'
      - '%3Bid%3B'
  condition: selection_web_access and selection_command_injection
  timeframe: 5m
falsepositives:
  - Legitimate URLs containing semicolons in search queries or URL parameters beyond control of attacker
  - Development testing with command execution tools
level: high

YARA Rule

rule Gogs_OS_Command_Injection_CVE_2022_1986
{
    meta:
        author = "ValtersIt SOC"
        description = "Detect OS command injection payloads targeting Gogs web application"
        cve = "CVE-2022-1986"
        date = "2024-01-17"
        score = 80
    strings:
        $s1 = "gogs" nocase
        $s2 = "execute_command" nocase
        $s3 = "os/exec" nocase
        $s4 = "cmd.Execute" nocase
        $s5 = "exec.Command" nocase
        $s6 = "/api/v1/repos" nocase
        $s7 = "hook" nocase
        $s8 = "scripts" nocase
        $s9 = "(bash|/bin/sh)" nocase
    condition:
        uint16(0) == 0x5A4D or uint32(0) == 0x464C457F
        and 3 of them
}

Suricata IDS Rule

alert http any any -> $HOME_NET any (msg:"Gogs OS Command Injection Attempt (CVE-2022-1986)"; flow:established,to_server; content:"Gogs"; http.header; content:"POST"; http.method; pcre:"/(;|\|\||&&|`|\$\()\s*(id|whoami|cat|nc|wget|curl|rm|ls|uname)/i"; classtype:attempted-admin; reference:cve,2022-1986; sid:20221986; rev:1;)

Elastic Detection

sequence by source.ip with maxspan=5m
  [network where process.name == "gogs" and event.type == "start" and destination.port == 3000]
  [netflow where source.port == 3000 and url.path contains "/repos" and (url.query contains ";" or url.query contains "&&" or url.query contains "|" or url.query contains "`" or url.query contains "$(")]

Splunk SPL Query

index=web sourcetype=access_combined status=200 uri_path="*"
| where like(uri_query,"%3B%22") OR like(uri_query,"%26%26") OR like(uri_query,"%7C%7C") OR like(uri_query,"%24(") OR like(uri_query,"%60")
| stats count by src_ip, uri_path, uri_query, user_agent
| where count > 5

Wazuh OSSEC Rule

<rule id="100228" level="15">
  <decoded>apache-accesslog</decoded>
  <match regex="(;|\|\||&&|`|\$\()\s*(id|whoami|cat|nc|wget|curl|rm|ls|uname)"> </match>
  <description>Possible Gogs OS command injection attempt (CVE-2022-1986)</description>
  <mitre>
    <id>T1203</id>
  </mitre>
  <groups>
    <group>web_server</group>
    <group>attack</group>
  </groups>
</rule>

Mitigation & Patch Guidance

Patch Status: UNPATCHED — no vendor fix is available for CVE-2022-1986. Gogs has not released a security advisory or patched version addressing this vulnerability as of the analysis date.

Immediate Mitigations:

  1. Isolate the Gogs server: Place the Gogs instance behind a firewall or VPN tunnel, restricting access to trusted IP ranges and networks. Do not expose the Gogs web interface directly to the internet.
  2. Implement a web application firewall (WAF): Deploy a WAF in front of Gogs with rules to detect and block command injection attempts (e.g., blocking requests containing shell metacharacters in query parameters and POST bodies).
  3. Restrict service account privileges: Run the Gogs service under a dedicated unprivileged account with minimal filesystem permissions. Do not run Gogs as root or under an administrative account.
  4. Monitor extensively: Apply the detection rules above to continuously monitor for exploitation attempts and anomalous command execution patterns on the server.
  5. Limit outbound connectivity: Configure the server firewall to restrict outbound connections from the Gogs process, limiting the attacker's ability to initiate reverse shells or exfiltration.
  6. Consider temporary shutdown: In high-risk environments where Gogs is publicly exposed and no alternative mitigation is feasible, consider taking the service offline until a patch is available.

Patch/Upgrade Steps:

  • Monitor the official Gogs repository (github.com/gogs/gogs) releases page for the release of version 0.12.9 or higher, which is the minimum version addressing this vulnerability.
  • Track huntr.dev advisory channels and Gogs security mailing lists for official confirmation and patch availability.
  • Once a patched version is released, follow the standard Gogs upgrade procedure: backup the Gogs data directory and database, download the new release binary, and perform the upgrade following Gogs' documentation.

Long-Term Hardening:

  • Establish a formal patch management process for self-hosted applications, with scheduled vulnerability scanning and prompt patching of critical flaws.
  • Deploy Gogs only on isolated infrastructure with network segmentation and least-privilege service accounts.
  • Maintain a comprehensive asset inventory of self-hosted services with version information and responsible teams.
  • Implement a WAF with virtual patching capabilities that can be updated with new exploit signatures during zero-day windows.
  • Consider migrating to an actively maintained alternative Git hosting solution if Gogs fails to address reported security vulnerabilities in a timely manner.

References

  1. NVD — CVE-2022-1986: https://nvd.nist.gov/vuln/detail/CVE-2022-1986
  2. Gogs Official Repository: https://github.com/gogs/gogs
  3. huntr.dev Security Vulnerability — CVE-2022-1986: https://huntr.dev/bounties/ (search CVE-2022-1986)
  4. FIRST EPSS Score Card for CVE-2022-1986 (EPSS 0.04419, 90.4% percentile)
  5. CISA Known Exploited Vulnerabilities Catalog: https://www.cisa.gov/known-exploited-vulnerabilities-catalog (not listed for this CVE)

No known threat actor campaigns or exploit-in-the-wild evidence has been publicly documented for this vulnerability. The CISA KEV catalog does not list this CVE, and no exploitation activity has been disclosed by security researchers. Organizations should treat the vulnerability as high-risk given the maximum CVSS severity and monitor for emerging exploitation activity.

◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2022-1986/ · CVE data: NVD/MITRE (public domain) · © 2026 ValtersIT Hub
>_ SYSTEM_CORE: INTEL_ACTIVE
90% TEAM-CURATED // 10% AUTOMATED INGESTION.
ALL PATCH REFERENCES AND VERSION DATA SOURCED FROM NVD + OSV OFFICIAL REGISTRIES.