LangChain
CVE-2024-58340
HIGH
Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessCraft ReDoS payload text
-
DeliveryInject via prompt injection into agent input
-
ExploitLLM emits crafted string
-
ExecutionMRKLOutputParser.parse() triggers catastrophic backtracking
-
PersistCPU exhaustion hangs worker
-
ImpactService denial for users
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A06:2021 - Vulnerable and Outdated Components
ASVS 5.0
V2 - Validation and Business Logic Regex complexity limits
MITRE ATT&CK
1 technique across 1 tactic: Impact The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires that the target application uses LangChain's MRKL agent and passes attacker-influenceable text into MRKLOutputParser.parse() - most realistically via indirect/prompt-injection channels where the attacker shapes the LLM's output rather than calling the parser directly. The affected feature is specifically the MRKL output parser in langchain <= 0.3.1; applications using structured/JSON tool-calling agents or other parsers are not affected. Limiting factors: the crafted payload must reach the parser (an attacker with no path to influence parsed text cannot trigger it), the impact is availability-only (no data disclosure or code execution), and effective payloads generally need enough length to force catastrophic backtracking, so input-length limits or parse timeouts materially reduce risk. |
| Impact | The CVSS 4.0 base score is 8.7 (High) with vector AV:N/AC:L/AT:N/PR:N/UI:N and VA:H but VC:N/VI:N - impact is confined to availability, with no confidentiality or integrity loss. Signals conflict on true priority: the CVSS is high and public exploit code exists, but EPSS is only 0.08% (23rd percentile) and there is no KEV listing, suggesting real-world mass exploitation is unlikely and any attack would be targeted rather than opportunistic. Importantly, the PR:N/network rating assumes an attacker can get crafted text to the parser; in practice this usually requires an indirect prompt-injection path (the attacker influences LLM output that the app forwards into the parser) rather than a direct exposed endpoint, so exploitability depends heavily on how the downstream application is built. Net: a genuine availability risk worth patching for anyone running MRKL agents on attacker-influenced input, but not an emergency for most deployments given the DoS-only impact and low EPSS. |
| Exploit ScenarioDerived | In an app that lets users chat with a MRKL agent, an attacker embeds a prompt-injection payload (for example in a document or web page the agent will read) that steers the LLM into emitting a specially crafted string; when the application feeds that output into MRKLOutputParser.parse(), the backtracking regex spikes CPU and hangs the request. Repeating this ties up worker threads and degrades or denies service for other users. Public exploit code is referenced in the huntr bounty, lowering the effort required. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv2 – Jul 14, 2026
Denial-of-service in LangChain versions up to and including 0.3.1 lets remote attackers exhaust CPU by feeding a crafted string into the MRKLOutputParser.parse() method, whose backtracking-prone regular expression exhibits catastrophic backtracking (ReDoS). Because MRKL agents parse LLM output to extract tool actions, an attacker who can influence that text - typically via prompt injection in downstream applications - can stall or hang the parsing thread. Publicly available exploit code exists (huntr bounty), though EPSS is low at 0.08% and it is not on the CISA KEV list.
Earlier versions of this analysis (1)
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). [CVSS 7.5 HIGH]
RemediationAI
Patch available per vendor advisory: upgrade LangChain to a version later than 0.3.1 that hardens the MRKL parser regex (confirm the exact fixed release against the VulnCheck advisory at https://www.vulncheck.com/advisories/langchain-mrkloutputparser-redos and the upstream repository https://github.com/langchain-ai/langchain before deploying, as no specific fixed version number was provided in this input). If immediate upgrade is not possible, reduce exposure by not passing untrusted or raw LLM output directly into MRKLOutputParser.parse(): impose a strict length cap on text handed to the parser (catastrophic backtracking requires a sizeable crafted payload, so bounding input length blunts the attack at the cost of truncating very long legitimate agent outputs), enforce a wall-clock timeout or run parsing in a separate worker/thread that can be killed so a hung regex cannot block the main service, and add input sanitization or prompt-injection defenses upstream to limit an attacker's ability to shape parsed text. Consider migrating off the MRKL agent to a structured/JSON tool-calling agent that does not rely on regex parsing of free-form output.
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in pypi
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
The affected component is LangChain's MRKL (Modular Reasoning, Knowledge and Language) agent output parser, libs/langchain/langchain/agents/mrkl/output_parser.py, which turns free-form LLM text into structured Action/Action Input tool invocations. The root cause is CWE-1333 (Inefficient Regular Expression Complexity): the parser uses a regex whose structure permits catastrophic backtracking, so a specially shaped input causes the regex engine's matching time to grow super-linearly. The affected CPE is cpe:2.3:a:langchain:langchain:*:*:*:*:*:*:*:*, the Python langchain package. The exposure exists specifically where application code passes untrusted or model-generated text directly into MRKLOutputParser.parse(), which is common in agentic pipelines that route tool-using LLM responses through this parser.
Know when Langchain gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
Remotely reachable via attacker-influenced parser input with no auth or interaction, and impact is availability-only through CPU-exhausting ReDoS, so C:N/I:N/A:H.
Primary rating from Vendor (vulncheck).
CVSS VectorVendor: vulncheck
Lifecycle Timeline
4DescriptionCVE.org
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 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.
Executive ViewAI
LangChain versions up to 0.3.1 are vulnerable to denial-of-service attacks with publicly available exploit code, allowing attackers to trigger application hangs and service unavailability through prompt injection vectors. Organizations running LangChain-based services face operational disruption risk; this vulnerability requires urgent patching of all affected systems. Service availability and end-user experience are at immediate risk without remediation.
Apply vendor patch.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.
Affected Products (CPE)CVE.org
Code injection in Langflow CSV Agent node before 1.8.0. The node hardcodes allow_dangerous_code=True, enabling arbitrary
An issue in Harrison Chase langchain v.0.0.194 allows an attacker to execute arbitrary code via the python exec calls in
A remote code execution vulnerability in langchain-ai/langchain (CVSS 10.0). Risk factors: public PoC available. Vendor
A vulnerability in the GraphCypherQAChain class of langchain-ai/langchain version 0.2.5 allows for SQL injection through
A vulnerability in the GraphCypherQAChain class of langchain-ai/langchainjs versions 0.2.5 and all versions with this cl
langchain_experimental (aka LangChain Experimental) 0.1.17 through 0.3.0 for LangChain allows attackers to execute arbit
A vulnerability was found in LangChain langchain_community 0.0.26. Rated critical severity (CVSS 9.8), this vulnerabilit
An issue in LanChain-ai Langchain v.0.0.245 allows a remote attacker to execute arbitrary code via the evaluate function
An issue in langchain v.0.0.171 allows a remote attacker to execute arbitrary code via a JSON file to load_prompt. Rated
An issue in langchain langchain-ai v.0.0.232 and before allows a remote attacker to execute arbitrary code via a crafted
An issue in Harrison Chase langchain v.0.0.194 and before allows a remote attacker to execute arbitrary code via the fro
An issue in LangChain v.0.0.231 allows a remote attacker to execute arbitrary code via the prompt parameter. Rated criti
NVD
CVE.org
EPSS
GitHub
VulDB
Exploit-DB