CVE-2024-3924: Text generation Code Injection Vulnerability Exists Vulnerability
MODERATECVE-2024-3924 is a MODERATE (CVSS 4.4) code injection vulnerability exists vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Text generation libraries in the PyPI ecosystem. The issue involves code injection vulnerability exists in the huggingface/text-generation-inference repository. Remediation is available by upgrading affected packages to version 2.0.0.
CVE-2024-3924 at a Glance
Security Impact
CVSS: 4.4
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:N).
How to Fix CVE-2024-3924
To remediate this vulnerability, upgrade all affected Text generation dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install text-generation>=2.0.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show text-generation
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2024-3924, inspect your installed packages using pip:
pip show text-generation
Analyze the terminal output to locate any version of Text generation in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.0), your application is affected.
Note: The pip show text-generation command checks currently installed packages in your active Python environment.
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 Text generation, 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
CVE-2024-3924 Affected Text generation Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
text-generation
|
PyPI |
< 2.0.0
|
2.0.0
|
References
Frequently Asked Questions
What is CVE-2024-3924?
Which Text generation versions are affected?
What version fixes CVE-2024-3924?
Is text-generation affected?
What is the CVSS score of CVE-2024-3924?
What CWE is associated with CVE-2024-3924?
How can I check PyPI dependencies for CVE-2024-3924?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-qq99-p57r-g3v7",
"modified" : "2024-06-02T22:30:17Z",
"published" : "2024-06-02T22:30:17Z",
"aliases" : [ "CVE-2024-3924" ],
"summary" : "code injection vulnerability exists in the huggingface/text-generation-inference repository",
"details" : "A code injection vulnerability exists in the huggingface/text-generation-inference repository, specifically within the `autodocs.yml` workflow file. The vulnerability arises from the insecure handling of the `github.head_ref` user input, which is used to dynamically construct a command for installing a software package. An attacker can exploit this by forking the repository, creating a branch with a malicious payload as the name, and then opening a pull request to the base repository. Successful exploitation could lead to arbitrary code execution within the context of the GitHub Actions runner. This issue affects versions up to and including v2.0.0 and was fixed in version 2.0.0.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.0/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "text-generation"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.0.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-3924"
}, {
"type" : "WEB",
"url" : "https://github.com/huggingface/text-generation-inference/commit/88702d876383f7200eccf67e28ba00500dc804bb"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/huggingface/text-generation-inference"
}, {
"type" : "WEB",
"url" : "https://huntr.com/bounties/8af92fc2-0103-4d29-bb28-c3893154c422"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-94" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-06-02T22:30:17Z",
"nvd_published_at" : "2024-05-30T15:15:49Z"
}
}