NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · LangChain

CVE-2024-1455: LangChain's XMLOutputParser vulnerable to XML Entity Expansion

mediumCVSS 3.0 5.9GHSA-q84m-rmw3-4382

LangChain's XMLOutputParser in langchain-core before 0.1.35 parses text with Python's standard-library etree module, which is open to XML entity expansion. Someone who can feed or steer the XML the parser receives can make the service unavailable. Upgrade langchain-core to 0.1.35.

Published Mar 26, 2024 · Updated Mar 27, 2024 · Analysis Nov 2, 2026

What an attacker can do

XMLOutputParser takes the model's output and parses it as XML with the etree module from the Python standard library. The Python documentation lists known XML weaknesses for that module, including entity expansion, where small nested entity definitions expand into very large strings and consume memory and CPU.

The attack needs three things, according to the advisory: the app uses XMLOutputParser, malicious input reaches the parser directly or through an LLM manipulated into emitting it, and the component is exposed through a web service. An attacker prompts the model, or plants text in content the model reads, so that the output carries an entity-expansion payload. The parser then expands it. The result is a denial of service on the endpoint. The advisory says it affects availability only. The CVSS vector marks attack complexity as high, because the attacker has to steer the model first.

Who is affected

langchain-core below 0.1.35, in apps that use XMLOutputParser and expose it, for example through an API that passes user input to an LLM and parses the answer. Apps that never use XMLOutputParser are not exposed through this path.

Check the installed version:

pip show langchain-core

Search your code for the parser:

grep -rn XMLOutputParser .

langchain-core

Ecosystem
PyPI
Affected
< 0.1.35
Fixed in
0.1.35
Check
pip show langchain-core

How to fix it

Upgrade to langchain-core 0.1.35:

pip install --upgrade "langchain-core>=0.1.35"

The fix is in the pull request titled "Patch XML vulnerability in XMLOutputParser". Its notes describe a potential denial-of-service issue. The sources I could read do not show the code change or give a workaround. As a precaution, do not feed untrusted model output to the parser on a public endpoint until you upgrade.

How to tell if you were hit

Look for requests to the endpoint that run XMLOutputParser followed by memory growth, high CPU or timeouts in the Python worker. Check application logs for parser errors or worker restarts after prompts that ask the model to output XML with a DOCTYPE or entity definitions. Check the langchain-core version in every environment and container image.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

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

Credited to eyurtsev.

Questions

Does this allow code execution or data theft?

No. The advisory describes a loss of availability only. The CVSS vector has no confidentiality or integrity impact.

Am I affected if I do not use XMLOutputParser?

The advisory is specific to XMLOutputParser. The attack is predicated on using it, on malicious input reaching it, and on exposing it through a web service.

Which version fixes CVE-2024-1455?

langchain-core 0.1.35. Anything below it is in the vulnerable range.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More LangChain vulnerabilities

All LangChain entries