XML External Entity Vulnerability in LangChain Text Splitters by LangChain
CVE-2025-6985
What is CVE-2025-6985?
The HTMLSectionSplitter class in LangChain Text Splitters version 0.3.8 is susceptible to XML External Entity (XXE) attacks due to vulnerable XSLT parsing practices. By allowing arbitrary XSLT stylesheets to be processed without appropriate safeguards, this vulnerability can be exploited by attackers to access sensitive files, including SSH keys and environment files, from the LangChain process. The issue stems from the fact that in certain versions of the lxml library, external entities are resolved by default. Even in later versions, where entity expansion is turned off, the XSLT document() function remains exploitable if not properly controlled. Attackers do not require authentication, special privileges, or user interaction to carry out these exploits, making the vulnerability particularly concerning for default installations that permit custom XSLT.
Affected Version(s)
langchain-ai/langchain <= unspecified