CVE-2024-58340
Published: 12 January 2026
Summary
CVE-2024-58340 is a high-severity Inefficient Regular Expression Complexity (CWE-1333) vulnerability in Langchain Langchain. Its CVSS base score is 7.5 (High).
Operationally, exploitation aligns with the MITRE ATT&CK technique Application or System Exploitation (T1499.004); ranked at the 24.1th percentile by exploit likelihood (below the median); it is not currently listed in the CISA KEV catalog; a public proof-of-concept is referenced.
This vulnerability is AI-related — categorised as NLP and Transformers; in the LLM/Generative AI Risks risk domain.
Threat & Defense at a Glance
Threat & Defense Details
MITRE ATT&CK Enterprise TechniquesAI
Why these techniques?
ReDoS flaw directly enables application exhaustion via crafted input to the vulnerable parser, matching T1499.004 (Application or System Exploitation).
NVD Description
LangChain versions up to and including 0.3.1 contain a regular expression denial-of-service (ReDoS) vulnerability in the MRKLOutputParser.parse() method (libs/langchain/langchain/agents/mrkl/output_parser.py). The parser applies a backtracking-prone regular expression when extracting tool actions from model output. An attacker who can supply or influence…
more
the parsed text (for example via prompt injection in downstream applications that pass LLM output directly into MRKLOutputParser.parse()) can trigger excessive CPU consumption by providing a crafted payload, causing significant parsing delays and a denial-of-service condition.
Deeper analysisAI
CVE-2024-58340 is a regular expression denial-of-service (ReDoS) vulnerability in LangChain versions up to and including 0.3.1. The flaw affects the MRKLOutputParser.parse() method in the file libs/langchain/langchain/agents/mrkl/output_parser.py, where a backtracking-prone regular expression is used to extract tool actions from model output. This can result in excessive CPU consumption when processing malicious input.
The vulnerability can be exploited by an attacker who can supply or influence the text parsed by MRKLOutputParser.parse(), for instance through prompt injection in downstream applications that pass LLM output directly to the parser. Successful exploitation triggers significant parsing delays and a denial-of-service condition due to high resource usage. It carries a CVSS v3.1 score of 7.5 (AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H) and is associated with CWE-1333.
Advisories and references, including the LangChain GitHub repository (https://github.com/langchain-ai/langchain), Huntr (https://huntr.com/bounties/e7ece02c-d4bb-4166-8e08-6baf4f8845bb), LangChain website (https://www.langchain.com/), and VulnCheck (https://www.vulncheck.com/advisories/langchain-mrkloutputparser-redos), provide further details on the issue.
This vulnerability is relevant to AI/ML applications built with LangChain, particularly those involving agent tooling and LLM output parsing.
Details
- CWE(s)
Affected Products
AI Security AnalysisAI
- AI Category
- NLP and Transformers
- Risk Domain
- LLM/Generative AI Risks
- OWASP Top 10 for LLMs 2025
- None mapped
- Classification Reason
- Matched keywords: langchain, langchain, langchain, prompt injection, llm