CVE-2025-6985: Langchain text splitters LangChain Text Splitters Is Vulnerable Vulnerability
HIGHCVE-2025-6985 is a HIGH (CVSS 7.5) langchain text splitters is vulnerable vulnerability (CWE-611: Improper Restriction of XML External Entity Reference) affecting Langchain text splitters libraries in the PyPI ecosystem. The issue involves langchain text splitters is vulnerable to xml external entity (xxe) attacks due to unsafe xslt parsing. Remediation is available by upgrading affected packages to version 0.3.9.
CVE-2025-6985 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.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N).
How to Fix CVE-2025-6985
To remediate this vulnerability, upgrade all affected Langchain text splitters 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-text-splitters>=0.3.9
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show langchain-text-splitters
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2025-6985, inspect your installed packages using pip:
pip show langchain-text-splitters
Analyze the terminal output to locate any version of Langchain text splitters in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.3.9), your application is affected.
Note: The pip show langchain-text-splitters command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-611: Improper Restriction of XML External Entity Reference, where the product processes an xml document that can contain xml entities with uris that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output. In Langchain text splitters, 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-2025-6985 Affected Langchain text splitters Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
langchain-text-splitters
|
PyPI |
< 0.3.9
|
0.3.9
|
References
Frequently Asked Questions
What is CVE-2025-6985?
Which Langchain text splitters versions are affected?
What version fixes CVE-2025-6985?
Is langchain-text-splitters affected?
What is the CVSS score of CVE-2025-6985?
What CWE is associated with CVE-2025-6985?
How can I check PyPI dependencies for CVE-2025-6985?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-m42m-m8cr-8m58",
"modified" : "2025-10-08T14:07:35Z",
"published" : "2025-10-06T18:31:07Z",
"aliases" : [ "CVE-2025-6985" ],
"summary" : "LangChain Text Splitters is vulnerable to XML External Entity (XXE) attacks due to unsafe XSLT parsing",
"details" : "The HTMLSectionSplitter class in langchain-text-splitters is vulnerable to XML External Entity (XXE) attacks due to unsafe XSLT parsing. This vulnerability arises because the class allows the use of arbitrary XSLT stylesheets, which are parsed using lxml.etree.parse() and lxml.etree.XSLT() without any hardening measures. In lxml versions up to 4.9.x, external entities are resolved by default, allowing attackers to read arbitrary local files or perform outbound HTTP(S) fetches. In lxml versions 5.0 and above, while entity expansion is disabled, the XSLT document() function can still read any URI unless XSLTAccessControl is applied. This vulnerability allows remote attackers to gain read-only access to any file the LangChain process can reach, including sensitive files such as SSH keys, environment files, source code, or cloud metadata. No authentication, special privileges, or user interaction are required, and the issue is exploitable in default deployments that enable custom XSLT.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "langchain-text-splitters"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.3.9"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-6985"
}, {
"type" : "WEB",
"url" : "https://github.com/langchain-ai/langchain/pull/31819"
}, {
"type" : "WEB",
"url" : "https://github.com/langchain-ai/langchain/commit/43eef435505a1c907227b724c0c760ad5fc01790"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/langchain-ai/langchain"
}, {
"type" : "WEB",
"url" : "https://huntr.com/bounties/cf78abbb-df3b-43de-b6ee-132b73ff8331"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-611" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2025-10-07T21:32:54Z",
"nvd_published_at" : "2025-10-06T18:15:52Z"
}
}