Join the Cyber Forum: Threat Intel on May 12, 2026 to learn how AI is reshaping threat defense.Join the Virtual Cyber Forum: Threat IntelRegister Now
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2024-58340

CVE-2024-58340: LangChain ReDoS Vulnerability

CVE-2024-58340 is a regular expression denial-of-service flaw in LangChain's MRKLOutputParser that allows attackers to trigger excessive CPU consumption. This post covers the technical details, affected versions, and mitigation.

Updated: January 22, 2026

CVE-2024-58340 Overview

CVE-2024-58340 is a Regular Expression Denial of Service (ReDoS) vulnerability affecting LangChain versions up to and including 0.3.1. The vulnerability exists in the MRKLOutputParser.parse() method located in libs/langchain/langchain/agents/mrkl/output_parser.py. When parsing tool actions from model output, the parser applies a backtracking-prone regular expression that can be exploited to cause excessive CPU consumption and denial-of-service conditions.

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 this vulnerability by providing a specially crafted payload. This results in significant parsing delays and can render affected applications unresponsive.

Critical Impact

Network-accessible ReDoS vulnerability in LangChain's agent output parsing can cause denial of service through CPU exhaustion, affecting AI/ML applications that rely on MRKL agent architecture.

Affected Products

  • LangChain versions up to and including 0.3.1
  • Applications using MRKLOutputParser.parse() for LLM output processing
  • AI/ML pipelines that pass untrusted LLM output to LangChain's MRKL agent parser

Discovery Timeline

  • 2026-01-12 - CVE CVE-2024-58340 published to NVD
  • 2026-01-13 - Last updated in NVD database

Technical Details for CVE-2024-58340

Vulnerability Analysis

This vulnerability is classified under CWE-1333 (Inefficient Regular Expression Complexity). The core issue lies in the regular expression pattern used by the MRKLOutputParser class to extract tool actions from LLM-generated text. The regex contains patterns that exhibit exponential backtracking behavior when processing carefully crafted input strings.

In LangChain's MRKL (Modular Reasoning, Knowledge and Language) agent architecture, the output parser is responsible for interpreting the structured responses from language models. When the parser encounters malformed or adversarial input designed to exploit the regex's backtracking behavior, the pattern matching algorithm enters a state of catastrophic backtracking.

The attack is particularly concerning in AI/ML applications because the input to MRKLOutputParser.parse() often originates from LLM output, which can be influenced through prompt injection techniques. This creates an indirect attack vector where an attacker manipulates the LLM's response to contain a ReDoS payload that is then processed by the vulnerable parser.

Root Cause

The root cause of CVE-2024-58340 is the use of a backtracking-prone regular expression in the MRKLOutputParser.parse() method. Regular expressions with nested quantifiers or overlapping alternatives can exhibit exponential time complexity when the regex engine repeatedly backtracks to find a match against specially crafted input strings. The vulnerable code path is triggered when parsing text that causes the regex to explore an exponentially growing number of possible matches before ultimately failing.

Attack Vector

The attack vector for this vulnerability is network-based and requires no authentication or user interaction. An attacker can exploit this vulnerability through the following methods:

  1. Direct Input Manipulation: If an application accepts user-controlled input that is passed to MRKLOutputParser.parse(), an attacker can directly submit a ReDoS payload.

  2. Prompt Injection: In more sophisticated scenarios, an attacker can inject prompts that cause the underlying LLM to generate output containing ReDoS payloads. When this output is subsequently parsed by the vulnerable method, it triggers the denial of service.

  3. Indirect Influence: Any pathway that allows an attacker to influence the text being parsed—including through data sources consumed by the LLM—represents a potential attack vector.

The attack causes excessive CPU consumption on the server processing the request, effectively creating a denial-of-service condition that can impact application availability.

Detection Methods for CVE-2024-58340

Indicators of Compromise

  • Abnormal CPU utilization spikes correlating with LangChain agent parsing operations
  • Unusually long response times for requests that invoke MRKL agent functionality
  • Application logs showing timeouts or hangs in MRKLOutputParser.parse() calls
  • Patterns in input data containing repetitive character sequences typical of ReDoS payloads

Detection Strategies

  • Monitor CPU usage patterns on systems running LangChain applications, particularly during LLM output parsing
  • Implement application-level logging to track the duration of MRKLOutputParser.parse() calls
  • Use web application firewalls (WAF) configured to detect ReDoS payload patterns in request content
  • Deploy runtime application self-protection (RASP) solutions capable of detecting algorithmic complexity attacks

Monitoring Recommendations

  • Set up alerting thresholds for abnormal CPU consumption on application servers handling LangChain workloads
  • Configure timeout mechanisms for parsing operations to prevent indefinite resource consumption
  • Implement request rate limiting on endpoints that invoke MRKL agent parsing functionality
  • Enable distributed tracing to identify slow parsing operations across microservice architectures

How to Mitigate CVE-2024-58340

Immediate Actions Required

  • Upgrade LangChain to a version newer than 0.3.1 that contains the fix for this vulnerability
  • Implement input validation and sanitization before passing data to MRKLOutputParser.parse()
  • Configure parsing timeouts to limit the maximum time allowed for regex processing
  • Consider implementing regex complexity analysis in CI/CD pipelines to prevent similar issues

Patch Information

Organizations should upgrade to the latest version of LangChain that addresses this vulnerability. Refer to the LangChain GitHub Repository for release notes and the VulnCheck Advisory for detailed remediation guidance. The Huntr Bounty Listing contains additional technical details about the vulnerability disclosure.

Workarounds

  • Implement a timeout wrapper around calls to MRKLOutputParser.parse() to prevent indefinite CPU consumption
  • Validate and limit the length of input strings before parsing to reduce attack surface
  • Consider using alternative parsing strategies that do not rely on the vulnerable regex pattern
  • Deploy the application behind a reverse proxy configured with request timeout limits
bash
# Configuration example - Python timeout wrapper
# Wrap MRKLOutputParser.parse() calls with signal-based timeout
# to prevent CPU exhaustion from ReDoS attacks
import signal

class TimeoutError(Exception):
    pass

def timeout_handler(signum, frame):
    raise TimeoutError("Parsing timeout exceeded")

# Set a 5-second timeout for parsing operations
signal.signal(signal.SIGALRM, timeout_handler)
signal.alarm(5)

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeDOS

  • Vendor/TechLangchain

  • SeverityHIGH

  • CVSS Score8.7

  • EPSS Probability0.05%

  • Known ExploitedNo
  • CVSS Vector
  • 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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-1333
  • Technical References
  • GitHub LangChain Repository

  • Huntr Bounty Listing

  • LangChain Official Website

  • VulnCheck Advisory on LangChain
  • Related CVEs
  • CVE-2026-30617: LangChain-ChatChat 0.3.1 RCE Vulnerability

  • CVE-2026-40087: LangChain RCE Vulnerability

  • CVE-2026-34070: LangChain Path Traversal Vulnerability

  • CVE-2026-27795: LangChain RecursiveUrlLoader SSRF Bypass
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English