Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

CVE-2024-58340: CWE-1333 Inefficient Regular Expression Complexity in LangChain AI LangChain

0
High
VulnerabilityCVE-2024-58340cvecve-2024-58340cwe-1333
Published: Mon Jan 12 2026 (01/12/2026, 23:05:00 UTC)
Source: CVE Database V5
Vendor/Project: LangChain AI
Product: LangChain

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 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.

AI-Powered Analysis

AILast updated: 01/12/2026, 23:38:04 UTC

Technical Analysis

CVE-2024-58340 identifies a ReDoS vulnerability in the LangChain AI LangChain library, specifically in versions up to 0.3.1. The vulnerability arises from the MRKLOutputParser.parse() method, which employs a regular expression that is susceptible to catastrophic backtracking when processing model-generated text outputs. This regex is used to extract tool actions from the output of large language models (LLMs). If an attacker can influence or supply the input text—potentially through prompt injection attacks in downstream applications that feed LLM outputs directly into this parser—they can craft inputs that trigger excessive CPU usage during regex evaluation. This results in significant delays in parsing and can cause denial-of-service conditions by exhausting system resources. The vulnerability requires no privileges, authentication, or user interaction, making it remotely exploitable over the network. The CVSS 4.0 score of 8.7 (high severity) reflects the vulnerability's ease of exploitation and its potential to cause high impact on availability. No patches are currently linked, and no known exploits have been observed in the wild, but the risk remains significant for affected deployments. The issue is categorized under CWE-1333 (Inefficient Regular Expression Complexity), highlighting the root cause as a poorly constructed regex pattern vulnerable to backtracking attacks.

Potential Impact

For European organizations leveraging LangChain in AI-driven applications, automation, or data processing pipelines, this vulnerability poses a significant risk to service availability. An attacker exploiting this flaw can cause denial-of-service by triggering excessive CPU consumption, potentially leading to application crashes, degraded performance, or unresponsiveness. This can disrupt critical business operations relying on AI workflows, especially in sectors like finance, healthcare, and public services where LangChain might be integrated for natural language processing or decision automation. The vulnerability's remote exploitability without authentication increases the attack surface, particularly for internet-facing services or those processing untrusted inputs. Additionally, the potential for prompt injection as an attack vector means that any system accepting user-generated content or external data that flows into LangChain parsing is at risk. This could lead to operational downtime, loss of productivity, and reputational damage. Given the growing adoption of AI tools in Europe, the impact could be widespread if not addressed promptly.

Mitigation Recommendations

To mitigate CVE-2024-58340, organizations should first upgrade LangChain to a version where this vulnerability is fixed once available. In the absence of an official patch, consider the following specific actions: 1) Implement input validation and sanitization to prevent untrusted or malicious inputs from reaching the MRKLOutputParser.parse() method, especially inputs derived from user-generated content or external sources. 2) Introduce rate limiting and resource usage monitoring on services invoking LangChain parsing to detect and throttle abnormal CPU consumption indicative of ReDoS attempts. 3) Employ sandboxing or containerization to isolate LangChain processes, limiting the impact of potential denial-of-service conditions on broader systems. 4) Review and harden prompt injection defenses in downstream applications to reduce the risk of attacker-controlled inputs influencing the parser. 5) If feasible, replace or refactor the vulnerable regex with a more efficient parsing approach that avoids backtracking-prone patterns. 6) Maintain vigilant logging and alerting on parsing errors and performance anomalies to enable rapid incident response. These targeted mitigations go beyond generic advice by focusing on controlling input sources, monitoring resource usage, and architectural isolation.

Need more detailed analysis?Upgrade to Pro Console

Technical Details

Data Version
5.2
Assigner Short Name
VulnCheck
Date Reserved
2026-01-09T20:28:41.285Z
Cvss Version
4.0
State
PUBLISHED

Threat ID: 69658281da2266e838450d22

Added to database: 1/12/2026, 11:23:45 PM

Last enriched: 1/12/2026, 11:38:04 PM

Last updated: 1/13/2026, 1:27:53 AM

Views: 12

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console in Console -> Billing for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats