Vulnerability in Langchain

CVE-2024-58340

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.

Vulnerability class: ReDoS (Regular Expression Denial of Service)

Published · last modified .

CVSS v3 metric

CVSS v3 base score 7.5 (High). Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.

EPSS exploit prediction

EPSS: 0.005 (38.2th percentile), scored .

Very low probability of exploitation in the next 30 days; routine patching cadence is appropriate. 38th percentile — 38.2% of CVEs in the catalogue have a lower EPSS than this one. How to read EPSS.

EPSS trend (30 days)EPSS over the last 30 days for CVE-2024-58340: held from 0.004 to 0.005.

EPSS over last 30 days · oldest: 0.004 · newest: 0.005 · change: +0.001

Affected products

Weakness classification (CWE)

References

Frequently asked questions

What is CVE-2024-58340?
CVE-2024-58340 is a high-severity vulnerability in Langchain, classified under Inefficient Regular Expression Complexity. CVSS score: 7.5/10. Published 2026-01-12.
How severe is CVE-2024-58340?
High severity. CVSS v3 base score is 7.5 out of 10.