Cyber Resilience

CVE-2024-58340

HighPublic PoC

Published: 12 January 2026

Published
12 January 2026
Modified
21 January 2026
KEV Added
Patch
CVSS Score v4 8.7 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
EPSS Score 0.0041 32.6th percentile
Risk Priority 55 floored blend · peak EPSS

Summary

CVE-2024-58340 is a high-severity Inefficient Regular Expression Complexity (CWE-1333) vulnerability in Langchain Langchain. Its CVSS base score is 8.7 (High).

Operationally, exploitation aligns with the MITRE ATT&CK technique Application or System Exploitation (T1499.004); ranked at the 32.6th 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.

The strongest mitigations our analysis identified are NIST 800-53 SC-5 (Denial-of-service Protection) and SI-2 (Flaw Remediation).

Deeper analysis

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.

EU & UK References

Vulnerability details

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.

CWE(s)

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, llm, prompt injection

Related Threats

MITRE ATT&CK Enterprise TechniquesAI

T1499.004 Application or System Exploitation Impact
Adversaries may exploit software vulnerabilities that can cause an application or system to crash and deny availability to users.
Why these techniques?

ReDoS flaw directly enables application exhaustion via crafted input to the vulnerable parser, matching T1499.004 (Application or System Exploitation).

Confidence: HIGH · MITRE ATT&CK Enterprise v19.0

CVEs Like This One

CVE-2026-44843Same product: Langchain Langchain
CVE-2024-12720Shared CWE-1333
CVE-2025-70030Shared CWE-1333
CVE-2026-30837Shared CWE-1333
CVE-2026-34070Same vendor: Langchain
CVE-2025-70034Shared CWE-1333
CVE-2025-10990Shared CWE-1333
CVE-2026-23956Shared CWE-1333
CVE-2026-25750Same vendor: Langchain
CVE-2026-0621Shared CWE-1333

Affected Assets

langchain
langchain
≤ 0.3.1

Mitigating Controls

Mitigating Controls (NIST 800-53 r5) AI

prevent

Flaw remediation requires timely installation of vendor patches for the known ReDoS vulnerability in LangChain's MRKLOutputParser, directly eliminating the backtracking-prone regex issue.

preventdetect

Denial-of-service protection implements mechanisms like resource limits and timeouts to counter CPU exhaustion from crafted regex inputs targeting the parser.

prevent

Information input validation sanitizes or rejects malicious LLM outputs before parsing to block prompt injection payloads that trigger the ReDoS condition.

References