Vulnerability 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.
CVSS Score
HIGH
Affected Products
| Vendor | Product | Versions |
|---|---|---|
| Langchain | Langchain | <= 0.3.1 |
Related Weaknesses (CWE)
References
- https://github.com/langchain-ai/langchainProduct
- https://huntr.com/bounties/e7ece02c-d4bb-4166-8e08-6baf4f8845bbExploitIssue TrackingThird Party Advisory
- https://www.langchain.com/Product
- https://www.vulncheck.com/advisories/langchain-mrkloutputparser-redosThird Party Advisory
FAQ
What is CVE-2024-58340?
CVE-2024-58340 is a vulnerability with a CVSS score of 7.5 (HIGH). 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_pa...
How severe is CVE-2024-58340?
CVE-2024-58340 has been rated HIGH with a CVSS base score of 7.5/10. Review the CVSS metrics above for detailed severity breakdown.
Is there a patch for CVE-2024-58340?
Check the references section above for vendor advisories and patch information. Affected products include: Langchain Langchain.