Executive brief
LangChain is a popular framework used to build applications powered by large language models (LLMs). A flaw in how the library processes text from AI models could allow an attacker to crash the application or cause significant performance delays. By using techniques like prompt injection to influence the AI's output, an attacker can force the system to consume excessive processor resources, leading to a denial-of-service condition.
Technical details
A Regular Expression Denial of Service (ReDoS) vulnerability exists in LangChain's MRKLOutputParser.parse() method, located in libs/langchain/langchain/agents/mrkl/output_parser.py. The vulnerability is caused by a backtracking-prone regular expression used to extract tool actions from model outputs (CWE-1333). An attacker can exploit this by supplying or influencing the text passed to the parser, often through prompt injection in downstream applications. This results in catastrophic backtracking, leading to high CPU utilization and a denial-of-service (DoS) condition. The issue affects versions up to and including 0.3.1.
Affected products
- LangChain AI LangChain <= 0.3.1
Timeline
- 2026-01-12: advisory: Initial disclosure by VulnCheck
- 2026-01-12: disclosed