Skip to main content

Inefficient Regular Expression Complexity

CVE-2024-58340

Severity High
Score 8.7/10

Summary

LangChain contains 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.

  • LOW
  • NETWORK
  • NONE
  • UNCHANGED
  • NONE
  • NONE
  • NONE
  • HIGH

CWE-1333 - Inefficient Regular Expression Complexity

The product uses a regular expression with an inefficient, possibly exponential worst-case computational complexity that consumes excessive CPU cycles.

References

Advisory Timeline

  • Published