CVE-2024-41956: Github.com/charmbracelet/soft serve Soft-serve Vulnerable To Arbitrary Code Vulnerability

HIGH
Advisory Identifier: GHSA-m445-w3xr-vp2f
CVSS 8.1
CWE-78
Published
Advisory Summary

CVE-2024-41956 is a HIGH (CVSS 8.1) soft-serve vulnerable to arbitrary code vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Github.com/charmbracelet/soft serve libraries in the Go ecosystem. The issue involves soft-serve vulnerable to arbitrary code execution by crafting git-lfs requests. Remediation is available by upgrading affected packages to version 0.7.5.

CVE-2024-41956 at a Glance

CVE Identifier CVE-2024-41956
GHSA Identifier GHSA-m445-w3xr-vp2f
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Github.com/charmbracelet/soft serve
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 8.1

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

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

How to Fix CVE-2024-41956

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

github.com/charmbracelet/soft-serve fixed: 0.7.5
Upgrade github.com/charmbracelet/soft-serve to 0.7.5
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 github.com/charmbracelet/soft-serve

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-41956, inspect your project dependencies for Github.com/charmbracelet/soft serve:

inspect dependencies for github.com/charmbracelet/soft-serve

Analyze the terminal output to locate any version of Github.com/charmbracelet/soft serve in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.7.5), 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-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Github.com/charmbracelet/soft serve, 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 Any servers using soft-serve server and git ### Patches >0.7.5 ### Workarounds None. ### References n/a. --- It is possible for a user who can commit files to a repository hosted by Soft Serve to execute arbitrary code via environment manipulation and Git. The issue is that Soft Serve passes all environment variables given by the client to git subprocesses. This includes environment variables that control program execution, such as `LD_PRELOAD`. This can be exploited to execute arbitrary code by, for example, uploading a malicious shared object file to Soft Serve via Git LFS (uploading it via LFS ensures that it is not compressed on disk and easier to work with). The file will be stored under its SHA256 hash, so it has a predictable name. This file can then be referenced in `LD_PRELOAD` via a Soft Serve SSH session that causes git to be invoked. For example: ```bash LD_PRELOAD=/.../data/lfs/1/objects/a2/b5/a2b585befededf5f95363d06d83655229e393b1b45f76d9f989a336668665a2f ssh server git-upload-pack repo ``` The example LFS file patches a shared library function called by git to execute a shell.

CVE-2024-41956 Affected Github.com/charmbracelet/soft serve Versions

1 component(s)
Fixed Versions:
0.7.5
Product / Package Ecosystem Affected Versions Fixed Version
github.com/charmbracelet/soft-serve
Go
< 0.7.5
0.7.5

References

Frequently Asked Questions

What is CVE-2024-41956?
CVE-2024-41956 is a security vulnerability in Github.com/charmbracelet/soft serve involving soft-serve vulnerable to arbitrary code execution by crafting git-lfs requests under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Github.com/charmbracelet/soft serve versions are affected?
Affected versions include releases prior to 0.7.5 across affected packages: github.com/charmbracelet/soft-serve.
What version fixes CVE-2024-41956?
Upgrading to 0.7.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/charmbracelet/soft-serve affected?
Yes, github.com/charmbracelet/soft-serve is affected in releases prior to 0.7.5. Upgrade your dependency to 0.7.5 or later.
What is the CVSS score of CVE-2024-41956?
CVE-2024-41956 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2024-41956?
CVE-2024-41956 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check Go dependencies for CVE-2024-41956?
Run the dependency tree command: 'inspect dependencies for github.com/charmbracelet/soft-serve'. 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-m445-w3xr-vp2f",
  "modified" : "2024-08-07T19:26:34Z",
  "published" : "2024-08-02T12:51:12Z",
  "aliases" : [ "CVE-2024-41956" ],
  "summary" : "soft-serve vulnerable to arbitrary code execution by crafting git-lfs requests",
  "details" : "### Impact\nAny servers using soft-serve server and git\n\n### Patches\n>0.7.5\n\n### Workarounds\nNone.\n\n### References\nn/a.\n\n---\n\nIt is possible for a user who can commit files to a repository hosted by Soft Serve to execute arbitrary code via environment manipulation and Git.\n\nThe issue is that Soft Serve passes all environment variables given by the client to git subprocesses. This includes environment variables that control program execution, such as `LD_PRELOAD`.\n\nThis can be exploited to execute arbitrary code by, for example, uploading a malicious shared object file to Soft Serve via Git LFS (uploading it via LFS ensures that it is not compressed on disk and easier to work with). The file will be stored under its SHA256 hash, so it has a predictable name.\n\nThis file can then be referenced in `LD_PRELOAD` via a Soft Serve SSH session that causes git to be invoked. For example:\n\n```bash\nLD_PRELOAD=/.../data/lfs/1/objects/a2/b5/a2b585befededf5f95363d06d83655229e393b1b45f76d9f989a336668665a2f ssh server git-upload-pack repo\n```\n\nThe example LFS file patches a shared library function called by git to execute a shell.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/charmbracelet/soft-serve"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.7.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/charmbracelet/soft-serve/security/advisories/GHSA-m445-w3xr-vp2f"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-41956"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/charmbracelet/soft-serve/commit/4daebdd422a6ba8c04162d023f8be355a8fe3184"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/charmbracelet/soft-serve"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2024-3019"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-08-02T12:51:12Z",
    "nvd_published_at" : "2024-08-01T22:15:29Z"
  }
}