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

- Priority: **Prioritise**
- Reason: Public exploit (reference, Date unknown)
- Next step: Check applicability and the vendor advisory: no fix release is recorded here
- Status: published
- Published: 2026-01-12 · Modified: 2026-07-14
- Aliases: PYSEC-2026-75
- Record: https://cvemate.com/vulnerability/CVE-2024-58340 · JSON: https://cvemate.com/vulnerability/CVE-2024-58340/json

## Description

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

## Signals

- CVSS: 8.7 high (v4.0, CVE.org) 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
- EPSS: 0.481%, percentile 43.12%, as of 2026-12-04
- Known exploited (KEV): CISA not listed, ENISA not listed, CIRCL not listed
- Ransomware use: none recorded
- Public exploits: 1 (reference)

## Affected

- langchain ai langchain: ≤ 0.3.1
- langchain langchain: ≤ 0.3.1
- PyPI langchain-exa (PyPI): \< 1.0.0a1

## References

- <https://huntr.com/bounties/e7ece02c-d4bb-4166-8e08-6baf4f8845bb>
- <https://www.langchain.com/>
- <https://github.com/langchain-ai/langchain>
- <https://www.vulncheck.com/advisories/langchain-mrkloutputparser-redos>

---

Data as of 2026-12-05T12:42:44.300Z. The priority label is CveMate's own model from public evidence, not an official rating, and it knows nothing about your assets. How labels are decided: https://cvemate.com/faq#priority
