# CVE-2024-58340: LangChain <= 0.3.1 MRKLOutputParser ReDoS

> CVE-2024-58340: LangChain <= 0.3.1 MRKLOutputParser ReDoS. CVSS 7.5 (CVSS 3.1).

Canonical: https://rewindex.com/cve/CVE-2024-58340
Last updated: 2026-07-14T23:17:18Z

- Published: 2026-01-12 23:05 UTC · Updated: 2026-07-14 23:17 UTC · Assigner: VulnCheck
- CVSS: 7.5 (CVSS 3.1) · Severity: High · Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- EPSS: 0.48%, 41th percentile (scored 2026-10-25)
- CISA KEV: no
- CWE: CWE-1333

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

## Affected vendors and products

- LangChain AI: LangChain

## Tracked companies

- [LangChain (LangSmith)](https://rewindex.com/company/langchain-langsmith.md)

## References

- [CVE record on cve.org](https://www.cve.org/CVERecord?id=CVE-2024-58340)
- [NVD entry](https://nvd.nist.gov/vuln/detail/CVE-2024-58340)
- [https://github.com/langchain-ai/langchain](https://github.com/langchain-ai/langchain)
- [https://huntr.com/bounties/e7ece02c-d4bb-4166-8e08-6baf4f8845bb](https://huntr.com/bounties/e7ece02c-d4bb-4166-8e08-6baf4f8845bb)
- [https://www.langchain.com/](https://www.langchain.com/)
- [https://www.vulncheck.com/advisories/langchain-mrkloutputparser-redos](https://www.vulncheck.com/advisories/langchain-mrkloutputparser-redos)

---

_Sources: CVE records from the CVE Program (cve.org). CVE® is a registered trademark of The MITRE Corporation. (https://www.cve.org/) This product uses data from the NVD API but is not endorsed or certified by the NVD. (https://nvd.nist.gov/) Known Exploited Vulnerabilities catalog from CISA. (https://www.cisa.gov/known-exploited-vulnerabilities-catalog) EPSS scores from FIRST (Exploit Prediction Scoring System). (https://www.first.org/epss/)_


---
Canonical: https://rewindex.com/cve/CVE-2024-58340 · Markdown: https://rewindex.com/cve/CVE-2024-58340.md · JSON: https://rewindex.com/api/v1/cves/CVE-2024-58340 · Data licensed CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) · Generated 2026-10-26T03:11:08.015Z
