CVE-2024-2029: Github.com/go skynet/LocalAI LocalAI Command Injection Vulnerability

CRITICAL
Advisory Identifier: GHSA-wx43-g55g-2jf4
CVSS 9.8
CWE-78
Published
Advisory Summary

CVE-2024-2029 is a CRITICAL (CVSS 9.8) localai command injection vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Github.com/go skynet/LocalAI libraries in the Go ecosystem. The issue involves localai command injection in audiotowav. Remediation is available by upgrading affected packages to version 2.10.0.

CVE-2024-2029 at a Glance

CVE Identifier CVE-2024-2029
GHSA Identifier GHSA-wx43-g55g-2jf4
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Github.com/go skynet/LocalAI
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 9.8

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

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

How to Fix CVE-2024-2029

To remediate this vulnerability, upgrade all affected Github.com/go skynet/LocalAI 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/go-skynet/LocalAI fixed: 2.10.0
Upgrade github.com/go-skynet/LocalAI to 2.10.0
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/go-skynet/LocalAI

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-2029, inspect your project dependencies for Github.com/go skynet/LocalAI:

inspect dependencies for github.com/go-skynet/LocalAI

Analyze the terminal output to locate any version of Github.com/go skynet/LocalAI in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.10.0), 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/go skynet/LocalAI, 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

A command injection vulnerability exists in the `TranscriptEndpoint` of mudler/localai, specifically within the `audioToWav` function used for converting audio files to WAV format for transcription. The vulnerability arises due to the lack of sanitization of user-supplied filenames before passing them to ffmpeg via a shell command, allowing an attacker to execute arbitrary commands on the host system. Successful exploitation could lead to unauthorized access, data breaches, or other detrimental impacts, depending on the privileges of the process executing the code.

CVE-2024-2029 Affected Github.com/go skynet/LocalAI Versions

1 component(s)
Fixed Versions:
2.10.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/go-skynet/LocalAI
Go
< 2.10.0
2.10.0

References

Frequently Asked Questions

What is CVE-2024-2029?
CVE-2024-2029 is a security vulnerability in Github.com/go skynet/LocalAI involving LocalAI Command Injection in audioToWav under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Github.com/go skynet/LocalAI versions are affected?
Affected versions include releases prior to 2.10.0 across affected packages: github.com/go-skynet/LocalAI.
What version fixes CVE-2024-2029?
Upgrading to 2.10.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/go-skynet/LocalAI affected?
Yes, github.com/go-skynet/LocalAI is affected in releases prior to 2.10.0. Upgrade your dependency to 2.10.0 or later.
What is the CVSS score of CVE-2024-2029?
CVE-2024-2029 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2024-2029?
CVE-2024-2029 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-2029?
Run the dependency tree command: 'inspect dependencies for github.com/go-skynet/LocalAI'. 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-wx43-g55g-2jf4",
  "modified" : "2024-07-08T21:04:48Z",
  "published" : "2024-04-10T18:30:48Z",
  "aliases" : [ "CVE-2024-2029" ],
  "summary" : "LocalAI Command Injection in audioToWav",
  "details" : "A command injection vulnerability exists in the `TranscriptEndpoint` of mudler/localai, specifically within the `audioToWav` function used for converting audio files to WAV format for transcription. The vulnerability arises due to the lack of sanitization of user-supplied filenames before passing them to ffmpeg via a shell command, allowing an attacker to execute arbitrary commands on the host system. Successful exploitation could lead to unauthorized access, data breaches, or other detrimental impacts, depending on the privileges of the process executing the code.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/go-skynet/LocalAI"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.10.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-2029"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mudler/localai/commit/31a4c9c9d3abc58de2bdc5305419181c8b33eb1c"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mudler/LocalAI"
  }, {
    "type" : "WEB",
    "url" : "https://huntr.com/bounties/e092528a-ce3b-4e66-9b98-3f56d6b276b0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-04-10T22:16:45Z",
    "nvd_published_at" : "2024-04-10T17:15:53Z"
  }
}