Vulnerabilities · 2024 · Langchain
CVE-2024-58340
Langchain vulnerability
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 products
Langchain. The exact versions are in the references.
What to do now
- Check your exposureFind out whether Langchain runs anywhere in your environment, including systems of suppliers.
- UpdateInstall the version in which the vendor fixed the vulnerability. The references lead to the advisory.
- Limit access until thenIf you cannot update at once, take the system off the internet or restrict who can reach it.
References
More vulnerabilities in Langchain products
Data: CVE list and the NVD. This product uses data from the NVD API but is not endorsed or certified by the NVD.