CVE-2025-6985: Langchain text splitters LangChain Text Splitters Is Vulnerable Vulnerability

HIGH
Advisory Identifier: GHSA-m42m-m8cr-8m58
CVSS 7.5
CWE-611
Published
Advisory Summary

CVE-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

CVE Identifier CVE-2025-6985
GHSA Identifier GHSA-m42m-m8cr-8m58
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-611: Improper Restriction of XML External Entity Reference
Affected Product Langchain text splitters
Package Ecosystem PyPI
Published Date
Last Updated

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).

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 None (I:N)
Availability None (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.

langchain-text-splitters fixed: 0.3.9
pip install langchain-text-splitters>=0.3.9
Verify Direct and Transitive Dependencies

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

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.

CVE-2025-6985 Affected Langchain text splitters Versions

1 component(s)
Fixed Versions:
0.3.9
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?
CVE-2025-6985 is a security vulnerability in Langchain text splitters involving LangChain Text Splitters is vulnerable to XML External Entity (XXE) attacks due to unsafe XSLT parsing under CWE-611: Improper Restriction of XML External Entity Reference.
Which Langchain text splitters versions are affected?
Affected versions include releases prior to 0.3.9 across affected packages: langchain-text-splitters.
What version fixes CVE-2025-6985?
Upgrading to 0.3.9 (or the latest patched release for your respective branch) resolves the vulnerability.
Is langchain-text-splitters affected?
Yes, langchain-text-splitters is affected in releases prior to 0.3.9. Upgrade your dependency to 0.3.9 or later.
What is the CVSS score of CVE-2025-6985?
CVE-2025-6985 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2025-6985?
CVE-2025-6985 is classified under CWE-611: Improper Restriction of XML External Entity Reference (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.).
How can I check PyPI dependencies for CVE-2025-6985?
Run the dependency tree command: 'pip show langchain-text-splitters'. 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-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"
  }
}