CVE-2024-1455: Billion Laughs Attack leading to DoS in langchain-ai/langchain
A vulnerability in the langchain-ai/langchain repository allows for a Billion Laughs Attack, a type of XML External Entity (XXE) exploitation. By nesting multiple layers of entities within an XML document, an attacker can cause the XML parser to consume excessive CPU and memory resources, leading to a denial of service (DoS).
Other sources
The XMLOutputParser in LangChain uses the etree module from the XML parser in the standard python library which has some XML vulnerabilities; see: https://docs.python.org/3/library/xml.html
This primarily affects users that combine an LLM (or agent) with the XMLOutputParser and expose the component via an endpoint on a web-service.
This would allow a malicious party to attempt to manipulate the LLM to produce a malicious payload for the parser that would compromise the availability of the service.
A successful attack is predicated on:
1. Usage of XMLOutputParser 2. Passing of malicious input into the XMLOutputParser either directly or by trying to manipulate an LLM to do so on the users behalf 3. Exposing the component via a web-service
— NVD
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/langchain-coreto a version that resolves this vulnerability.Fixed in 0.1.35
Event History
Frequently Asked Questions
What is the severity of CVE-2024-1455?
CVE-2024-1455 has been assigned a high severity rating due to the potential for a Billion Laughs Attack that can exhaust system resources.
How do I fix CVE-2024-1455?
To fix CVE-2024-1455, update the langchain-core package to version 0.1.34 or later.
What is a Billion Laughs Attack in CVE-2024-1455?
A Billion Laughs Attack is an XML external entity attack that exploits XML parsers by using nested entities to inflate resource consumption.
Which software is affected by CVE-2024-1455?
CVE-2024-1455 affects the langchain-core package prior to version 0.1.34.
How can attackers exploit CVE-2024-1455?
Attackers can exploit CVE-2024-1455 by crafting XML documents with nested entities to overwhelm the XML parser and cause denial of service.