LangChainLLM Denial-of-Service Vulnerability in run-llama/llama_index v0.12.5

Vulnerability

A denial-of-service vulnerability has been identified in the LangChainLLM class of the run-llama/llama_index repository, version v0.12.5. The issue arises in the stream_complete method, which executes a language model (LLM) using a separate thread and retrieves the result through the get_response_gen method of the StreamingGeneratorCallbackHandler class. If the thread unexpectedly terminates before the LLM's predict method is called, there is no exception handling to address this, causing an infinite loop in the get_response_gen function. This situation can be triggered by sending an input of an incorrect type, leading the thread to crash while the process remains stuck in the loop.

Impact

Exploitation of this vulnerability creates an infinite loop in the response generation process, causing a significant degradation in server performance.

Reproduction

The vulnerability can be reproduced by using the LangChainLLM class with the ChatOpenAI model from the langchain_openai library. After setting the OpenAI API key, the stream_complete method can be called with an integer input instead of a string. This causes the thread handling the LLM response to terminate prematurely, while the main process gets stuck in an infinite loop, effectively creating a denial-of-service condition.

Remediation

Users are advised to update to LangChainLLM version 0.12.6, where this vulnerability has been fixed.

Added: Jun 9, 2025, 7:46 PM
Updated: Jun 9, 2025, 7:46 PM

Vulnerability Rating

Custom Algorithm
spread
0.0
impact
2.5
exploitability
8.7
remediation
7.7
relevance
0.0
threat
6.4
urgency
2.9
incentive
5.8

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.