Vulnerabilities in pkg:pypi/haystack-ai
PACKAGECVE-2024-41950 is a HIGH (CVSS 7.5) remote code execution vulnerability (CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine) affecting Haystack ai libraries in the PyPI ecosystem. The issue involves insecure jinja2 templates rendered in haystack components can lead to rce. Remediation is available by upgrading affected packages to version 2.3.1.
pkg:pypi/haystack-ai
Vulnerability advisories affecting package pkg:pypi/haystack-ai. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-hx9v-6r9f-w677 | CVE-2024-41950 | HIGH | Insecure Jinja2 templates rendered in Haystack Components can lead to RCE |
CVE-2024-41950 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2024-41950
To remediate this vulnerability, upgrade all affected Haystack ai 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 haystack-ai>=2.3.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show haystack-ai
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2024-41950, inspect your installed packages using pip:
pip show haystack-ai
Analyze the terminal output to locate any version of Haystack ai in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.3.1), your application is affected.
Note: The pip show haystack-ai command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine, where the product uses a template engine to insert or process externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements or syntax that can be interpreted as template expressions or other code directives when processed by the engine. In Haystack ai, 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-41950 Affected Haystack ai Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
haystack-ai
|
PyPI |
< 2.3.1
|
2.3.1
|
References
Frequently Asked Questions
What is CVE-2024-41950?
Which Haystack ai versions are affected?
What version fixes CVE-2024-41950?
Is haystack-ai affected?
What is the CVSS score of CVE-2024-41950?
What CWE is associated with CVE-2024-41950?
How can I check PyPI dependencies for CVE-2024-41950?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-hx9v-6r9f-w677",
"modified" : "2024-07-31T18:50:41Z",
"published" : "2024-07-31T18:50:41Z",
"aliases" : [ "CVE-2024-41950" ],
"summary" : "Insecure Jinja2 templates rendered in Haystack Components can lead to RCE",
"details" : "### Impact\n\nHaystack clients that let their users create and run Pipelines from scratch are vulnerable to remote code executions.\n\nCertain Components in Haystack use Jinja2 templates, if anyone can create and render that template on the client machine they run any code.\n\n### Patches\n\nThe problem has been fixed with PRs deepset-ai/haystack#8095 and deepset-ai/haystack#8096.\n\nBoth have been released with Haystack `2.3.1`.\n\n### Workarounds\n\nPrevent users from running the affected Components, or only let users use preselected templates.\n\n### References\n\nThe list of impacted Components can be found in the release notes for `2.3.1`.\nhttps://github.com/deepset-ai/haystack/releases/tag/v2.3.1",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "haystack-ai"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.3.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/deepset-ai/haystack/security/advisories/GHSA-hx9v-6r9f-w677"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-41950"
}, {
"type" : "WEB",
"url" : "https://github.com/deepset-ai/haystack/pull/8095"
}, {
"type" : "WEB",
"url" : "https://github.com/deepset-ai/haystack/pull/8096"
}, {
"type" : "WEB",
"url" : "https://github.com/deepset-ai/haystack/commit/3fed1366c448b02189851bf08166c1f6477a02b0"
}, {
"type" : "WEB",
"url" : "https://github.com/deepset-ai/haystack/commit/6c25a5c73e83aa32c3241ba84a5cbb3ac0e8a89e"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/deepset-ai/haystack"
}, {
"type" : "WEB",
"url" : "https://github.com/deepset-ai/haystack/releases/tag/v2.3.1"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1336" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-07-31T18:50:41Z",
"nvd_published_at" : "2024-07-31T16:15:04Z"
}
}