CVE-2024-39930: Gogs.io/gogs Gogs Has An Argument Injection Vulnerability

CRITICAL
Advisory Identifier: GHSA-vm62-9jw3-c8w3
CVSS 9.9
CWE-88
Published
Advisory Summary

CVE-2024-39930 is a CRITICAL (CVSS 9.9) gogs has an argument injection vulnerability (CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')) affecting Gogs.io/gogs libraries in the Go ecosystem. The issue involves gogs has an argument injection in the built-in ssh server. Remediation is available by upgrading affected packages to version 0.13.1.

CVE-2024-39930 at a Glance

CVE Identifier CVE-2024-39930
GHSA Identifier GHSA-vm62-9jw3-c8w3
Severity CRITICAL
CVSS v3.1 Base Score 9.9
CWE Classification CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument 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-39930

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-39930, 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-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection'), where the product constructs a string for a command to be executed by a separate component in another control sphere, but it does not properly delimit the intended arguments, options, or switches within that command string. 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 When the built-in SSH server is enabled (`[server] START_SSH_SERVER = true`), unprivileged user accounts with at least one SSH key can execute arbitrary commands on the Gogs instance with the privileges of the user specified by `RUN_USER` in the configuration. It allows attackers to access and alter any users' code hosted on the same instance. ### Patches The `env` command sent to the internal SSH server has been changed to be a passthrough (https://github.com/gogs/gogs/pull/7868), i.e. the feature is effectively removed. Users should upgrade to 0.13.1 or the latest 0.14.0+dev. ### Workarounds [Disable the use of built-in SSH server](https://github.com/gogs/gogs/blob/7adac94f1e93cc5c3545ea31688662dcef9cd737/conf/app.ini#L76-L77) on operating systems other than Windows. ### References https://www.cve.org/CVERecord?id=CVE-2024-39930

CVE-2024-39930 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-39930?
CVE-2024-39930 is a security vulnerability in Gogs.io/gogs involving Gogs has an argument Injection in the built-in SSH server under CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument 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-39930?
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-39930?
CVE-2024-39930 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-39930?
CVE-2024-39930 is classified under CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection') (The product constructs a string for a command to be executed by a separate component in another control sphere, but it does not properly delimit the intended arguments, options, or switches within that command string.).
How can I check Go dependencies for CVE-2024-39930?
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-vm62-9jw3-c8w3",
  "modified" : "2024-12-23T20:38:34Z",
  "published" : "2024-12-23T20:38:34Z",
  "aliases" : [ "CVE-2024-39930" ],
  "summary" : "Gogs has an argument Injection in the built-in SSH server",
  "details" : "### Impact\n\nWhen the built-in SSH server is enabled (`[server] START_SSH_SERVER = true`), unprivileged user accounts with at least one SSH key can execute arbitrary commands on the Gogs instance with the privileges of the user specified by `RUN_USER` in the configuration. It allows attackers to access and alter any users' code hosted on the same instance.\n\n### Patches\n\nThe `env` command sent to the internal SSH server has been changed to be a passthrough (https://github.com/gogs/gogs/pull/7868), i.e. the feature is effectively removed. Users should upgrade to 0.13.1 or the latest 0.14.0+dev.\n\n### Workarounds\n\n[Disable the use of built-in SSH server](https://github.com/gogs/gogs/blob/7adac94f1e93cc5c3545ea31688662dcef9cd737/conf/app.ini#L76-L77) on operating systems other than Windows.\n\n### References\n\nhttps://www.cve.org/CVERecord?id=CVE-2024-39930\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-vm62-9jw3-c8w3"
  }, {
    "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"
  }, {
    "type" : "WEB",
    "url" : "https://www.vicarius.io/vsociety/posts/argument-injection-in-gogs-ssh-server-cve-2024-39930"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-88" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-12-23T20:38:34Z",
    "nvd_published_at" : null
  }
}