CVE-2024-39932: Gogs.io/gogs Gogs Allows Argument Injection During Vulnerability

CRITICAL
Advisory Identifier: GHSA-9pp6-wq8c-3w2c
CVSS 9.9
CWE-94
Published
Advisory Summary

CVE-2024-39932 is a CRITICAL (CVSS 9.9) gogs allows argument injection during vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Gogs.io/gogs libraries in the Go ecosystem. The issue involves gogs allows argument injection during the previewing of changes. Remediation is available by upgrading affected packages to version 0.13.1.

CVE-2024-39932 at a Glance

CVE Identifier CVE-2024-39932
GHSA Identifier GHSA-9pp6-wq8c-3w2c
Severity CRITICAL
CVSS v3.1 Base Score 9.9
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Gogs.io/gogs
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 9.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AC:L/AV:N/A:H/C:H/I:H/PR:L/S:C/UI:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2024-39932

To remediate this vulnerability, upgrade all affected Gogs.io/gogs dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

gogs.io/gogs fixed: 0.13.1
Upgrade gogs.io/gogs to 0.13.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for gogs.io/gogs

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-39932, inspect your project dependencies for Gogs.io/gogs:

inspect dependencies for gogs.io/gogs

Analyze the terminal output to locate any version of Gogs.io/gogs in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.13.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Gogs.io/gogs, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact Unprivileged user accounts can write to arbitrary files on the filesystem. We could demonstrate its exploitation to force a re-installation of the instance, granting administrator rights. It allows accessing and altering any user's code hosted on the same instance. ### Patches Unintended Git options has been ignored for diff preview (https://github.com/gogs/gogs/pull/7871). Users should upgrade to 0.13.1 or the latest 0.14.0+dev. ### Workarounds No viable workaround available, please only grant access to trusted users to your Gogs instance on affected versions. ### References https://www.cve.org/CVERecord?id=CVE-2024-39932

CVE-2024-39932 Affected Gogs.io/gogs Versions

1 component(s)
Fixed Versions:
0.13.1
Product / Package Ecosystem Affected Versions Fixed Version
gogs.io/gogs
Go
< 0.13.1
0.13.1

References

Frequently Asked Questions

What is CVE-2024-39932?
CVE-2024-39932 is a security vulnerability in Gogs.io/gogs involving Gogs allows argument injection during the previewing of changes under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Gogs.io/gogs versions are affected?
Affected versions include releases prior to 0.13.1 across affected packages: gogs.io/gogs.
What version fixes CVE-2024-39932?
Upgrading to 0.13.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is gogs.io/gogs affected?
Yes, gogs.io/gogs is affected in releases prior to 0.13.1. Upgrade your dependency to 0.13.1 or later.
What is the CVSS score of CVE-2024-39932?
CVE-2024-39932 has a CVSS v3.1 base score of 9.9 (CRITICAL) with vector string CVSS:3.1/AC:L/AV:N/A:H/C:H/I:H/PR:L/S:C/UI:N.
What CWE is associated with CVE-2024-39932?
CVE-2024-39932 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check Go dependencies for CVE-2024-39932?
Run the dependency tree command: 'inspect dependencies for gogs.io/gogs'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-9pp6-wq8c-3w2c",
  "modified" : "2024-12-23T20:38:27Z",
  "published" : "2024-12-23T20:38:27Z",
  "aliases" : [ "CVE-2024-39932" ],
  "summary" : "Gogs allows argument injection during the previewing of changes",
  "details" : "### Impact\n\nUnprivileged user accounts can write to arbitrary files on the filesystem. We could demonstrate its exploitation to force a re-installation of the instance, granting administrator rights. It allows accessing and altering any user's code hosted on the same instance.\n\n### Patches\n\nUnintended Git options has been ignored for diff preview (https://github.com/gogs/gogs/pull/7871). Users should upgrade to 0.13.1 or the latest 0.14.0+dev.\n\n### Workarounds\n\nNo viable workaround available, please only grant access to trusted users to your Gogs instance on affected versions.\n\n### References\n\nhttps://www.cve.org/CVERecord?id=CVE-2024-39932\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AC:L/AV:N/A:H/C:H/I:H/PR:L/S:C/UI:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "gogs.io/gogs"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.13.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.13.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/gogs/gogs/security/advisories/GHSA-9pp6-wq8c-3w2c"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-39932"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/gogs/gogs"
  }, {
    "type" : "WEB",
    "url" : "https://www.sonarsource.com/blog/securing-developer-tools-unpatched-code-vulnerabilities-in-gogs-1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-12-23T20:38:27Z",
    "nvd_published_at" : null
  }
}