PyPI: langchain-core
CVE-2024-1455
Safety vulnerability ID: SFTY-20240326-88331
Safety legacy ID: pyup.io-71610
Affected versions of the langchain package are vulnerable to XML External Entity (XXE) Injection due to unrestricted XML entity expansion in the langchain_core.output_parsers.xml.XMLOutputParser component. The XMLOutputParser.parse, _transform, and _atransform implementations rely on xml.etree.ElementTree.fromstring and XMLPullParser without prohibiting entity expansion, allowing recursive entity references (Billion Laughs) to be processed.
Overview
LangChain's XMLOutputParser vulnerable to XML Entity Expansion
Advisory
Affected versions of the langchain package are vulnerable to XML External Entity (XXE) Injection due to unrestricted XML entity expansion in the langchain_core.output_parsers.xml.XMLOutputParser component. The XMLOutputParser.parse, _transform, and _atransform implementations rely on xml.etree.ElementTree.fromstring and XMLPullParser without prohibiting entity expansion, allowing recursive entity references (Billion Laughs) to be processed.
How to Fix
Mitigation and Workarounds
---
Vulnerable Functions
Functions linked to known vulnerabilities.
References
- https://getsafety.com/vulnerabilities/SFTY-20240326-88331/CVE-2024-1455
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-1455
- https://docs.python.org/3/library/xml.html
- https://github.com/advisories/GHSA-q84m-rmw3-4382
- https://github.com/langchain-ai/langchain/commit/727d5023ce88e18e3074ef620a98137d26ff92a3
- https://github.com/langchain-ai/langchain/pull/19653
- https://huntr.com/bounties/4353571f-c70d-4bfd-ac08-3a89cecb45b6
- https://inspector.pypi.io/project/langchain-core/0.1.35/packages/07/d0/1018dfc4263eb895a92fae77582e71d04ffd0b95869a9499b0b4ede51013/langchain_core-0.1.35.tar.gz/langchain_core-0.1.35/langchain_core/output_parsers/xml.py#line.137
- https://python-security.readthedocs.io/vuln/expat-billion-laughs.html
- https://nvd.nist.gov/vuln/detail/CVE-2024-1455
- https://huntr.com/bounties/4353571f-c70d-4bfd-ac08-3a89cecb45b6
- https://github.com/langchain-ai/langchain/pull/17250
- https://github.com/langchain-ai/langchain/commit/727d5023ce88e18e3074ef620a98137d26ff92a3
- https://github.com/langchain-ai/langchain/pull/19653
- https://github.com/langchain-ai/langchain/pull/19660
- https://github.com/advisories/GHSA-q84m-rmw3-4382
Verified by Safety
Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.
Learn more
