Skip to content
HighVulnerabilityLLM-specific

CVE-2024-58340: LangChain ReDoS in MRKLOutputParser.parse() via crafted model output

Identifier
CVE-2024-58340
Published
Record updated
View JSON
Known exploitation
Not listed in the CISA Known Exploited Vulnerabilities catalog at the last check.
EPSS
0.5%

Summary

LangChain versions up to and including 0.3.1 contain a regular expression denial-of-service (ReDoS) flaw in the MRKLOutputParser.parse() method (libs/langchain/langchain/agents/mrkl/output_parser.py). The parser runs a backtracking-prone regular expression when extracting tool actions from model output, so an attacker who can supply or influence the parsed text, for example through prompt injection in downstream applications that pass LLM output directly into the parser, can cause excessive CPU consumption and significant parsing delays.

Mitigation

The source does not state a fix yet. Check the original advisory for updates.