CVE-2024-1455: Langchain core LangChain's XMLOutputParser Vulnerable To XML Vulnerability
MODERATECVE-2024-1455 is a MODERATE (CVSS 5.9) langchain's xmloutputparser vulnerable to xml vulnerability (CWE-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion')) affecting Langchain core libraries in the PyPI ecosystem. The issue involves langchain's xmloutputparser vulnerable to xml entity expansion. Remediation is available by upgrading affected packages to version 0.1.35.
CVE-2024-1455 at a Glance
Security Impact
CVSS: 5.9
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2024-1455
To remediate this vulnerability, upgrade all affected Langchain core 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 langchain-core>=0.1.35
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show langchain-core
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2024-1455, inspect your installed packages using pip:
pip show langchain-core
Analyze the terminal output to locate any version of Langchain core in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.1.35), your application is affected.
Note: The pip show langchain-core command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion'), where the product uses xml documents and allows their structure to be defined with a document type definition (dtd), but it does not properly control the number of recursive definitions of entities. In Langchain core, 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-1455 Affected Langchain core Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
langchain-core
|
PyPI |
< 0.1.35
|
0.1.35
|
References
Frequently Asked Questions
What is CVE-2024-1455?
Which Langchain core versions are affected?
What version fixes CVE-2024-1455?
Is langchain-core affected?
What is the CVSS score of CVE-2024-1455?
What CWE is associated with CVE-2024-1455?
How can I check PyPI dependencies for CVE-2024-1455?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-q84m-rmw3-4382",
"modified" : "2024-03-27T17:46:43Z",
"published" : "2024-03-26T15:30:50Z",
"aliases" : [ "CVE-2024-1455" ],
"summary" : "LangChain's XMLOutputParser vulnerable to XML Entity Expansion",
"details" : "The XMLOutputParser in LangChain uses the etree module from the XML parser in the standard python library which has some XML vulnerabilities; see: https://docs.python.org/3/library/xml.html\n\nThis primarily affects users that combine an LLM (or agent) with the `XMLOutputParser` and expose the component via an endpoint on a web-service. \n\nThis would allow a malicious party to attempt to manipulate the LLM to produce a malicious payload for the parser that would compromise the availability of the service.\n\nA successful attack is predicated on:\n\n1. Usage of XMLOutputParser\n2. Passing of malicious input into the XMLOutputParser either directly or by trying to manipulate an LLM to do so on the users behalf\n3. Exposing the component via a web-service",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "langchain-core"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.1.35"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-1455"
}, {
"type" : "WEB",
"url" : "https://github.com/langchain-ai/langchain/pull/17250"
}, {
"type" : "WEB",
"url" : "https://github.com/langchain-ai/langchain/pull/19653"
}, {
"type" : "WEB",
"url" : "https://github.com/langchain-ai/langchain/pull/19660"
}, {
"type" : "WEB",
"url" : "https://github.com/langchain-ai/langchain/commit/727d5023ce88e18e3074ef620a98137d26ff92a3"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/langchain-ai/langchain"
}, {
"type" : "WEB",
"url" : "https://huntr.com/bounties/4353571f-c70d-4bfd-ac08-3a89cecb45b6"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-776" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-03-26T21:22:28Z",
"nvd_published_at" : "2024-03-26T14:15:08Z"
}
}