REDHAT-BUG-2401958: High severity pypi/langchain-text-splitters vulnerability
The HTMLSectionSplitter class in langchain-text-splitters version 0.3.8 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.
Affected Software
Event History
Frequently Asked Questions
What is the severity of REDHAT-BUG-2401958?
The severity of REDHAT-BUG-2401958 is classified as high due to the potential for XML External Entity attacks.
How do I fix REDHAT-BUG-2401958?
To fix REDHAT-BUG-2401958, update langchain-text-splitters to a version that patches the XML parsing vulnerability.
Which versions of lxml are affected by REDHAT-BUG-2401958?
Versions of lxml from 4.9.x down to below 5.0 are affected by REDHAT-BUG-2401958.
What types of attacks can be executed using the vulnerability in REDHAT-BUG-2401958?
The vulnerability in REDHAT-BUG-2401958 can lead to XML External Entity (XXE) attacks, allowing attackers to access system files or perform server-side request forgery.
Is REDHAT-BUG-2401958 applicable to all lxml versions?
No, REDHAT-BUG-2401958 specifically affects lxml versions prior to 5.0, especially those in the 4.9.x range.