CVE-2024-12704: LlamaIndex Improper Handling of Exceptional Conditions vulnerability
llama-index-core before 0.12.6 can be hung by a bad input to `LangChainLLM.stream_complete`. If the worker thread dies before the model runs, `get_response_gen` loops forever waiting for a finish signal that never comes. A remote caller who can send wrongly typed input to such an endpoint can cause denial of service. Upgrade to llama-index-core 0.12.6.
Published Mar 20, 2025 · Updated Feb 24, 2026 · Analysis Nov 1, 2026
What an attacker can do
LangChainLLM.stream_complete runs the wrapped LangChain model in a separate thread. It reads tokens through get_response_gen in StreamingGeneratorCallbackHandler (llama_index/core/langchain_helpers/streaming.py). That generator was a while True loop that exits only when a done event is set. The event is set by the callback after _llm.predict finishes. If the thread terminates abnormally earlier, for example because the input has the wrong type, nothing sets the event and nothing catches the exception.
The consumer then polls forever. The request never returns, and the polling loop uses CPU without sleeping. One bad request pins a worker. Repeated requests exhaust the worker pool of an API server. The report was against v0.12.5.
The attacker needs network access to an application that passes user-controlled input into stream_complete on a LangChainLLM. No authentication or user interaction is needed in the vector. The effect is availability only (CWE-755, CWE-835). Apps that use native LlamaIndex LLM classes rather than the LangChainLLM wrapper are not on this code path.
Who is affected
Affected: llama-index-core below 0.12.6, for applications that call stream_complete on LangChainLLM. The advisory names v0.12.5.
pip show llama-index-coreThen search your code for LangChainLLM and stream_complete to see whether the vulnerable path is used, and whether untrusted input reaches it.
llama-index-core
- Ecosystem
- PyPI
- Affected
- < 0.12.6
- Fixed in
- 0.12.6
- Check
pip show llama-index-core
How to fix it
Upgrade to llama-index-core 0.12.6:
pip install --upgrade "llama-index-core>=0.12.6"The fix in get_response_gen adds a timeout parameter, default 120 seconds. The loop now raises TimeoutError once the deadline passes, and sleeps 0.01 seconds when no token is queued so it no longer spins. Your handler should catch TimeoutError. The sources give no other workaround. Until you upgrade, validate input types before they reach stream_complete and set request timeouts at your web server or proxy.
How to tell if you were hit
Look for requests to streaming endpoints that never complete, and worker threads or processes stuck at high CPU inside get_response_gen. A stack dump (for example with py-spy dump) shows the loop in llama_index/core/langchain_helpers/streaming.py.
In application logs, look for a thread exception from the LangChain call with no matching response, for example a type error on the prompt argument, followed by a request that stays open. After the fix, the same condition shows up as a TimeoutError after 120 seconds.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
A vulnerability in the LangChainLLM class of the run-llama/llama_index repository, version v0.12.5, allows for a Denial of Service (DoS) attack. The stream_complete method executes the llm using a thread and retrieves the result via the get_response_gen method of the StreamingGeneratorCallbackHandler class. If the thread terminates abnormally before the _llm.predict is executed, there is no exception handling for this case, leading to an infinite loop in the get_response_gen function. This can be triggered by providing an input of an incorrect type, causing the thread to terminate and the process to continue running indefinitely.
Credited to fossilet.
Questions
- Is llama-index-core 0.12.5 affected by CVE-2024-12704?
Yes. The report was filed against v0.12.5. Versions below 0.12.6 are affected, and 0.12.6 is the patched release.
- Do I need to be using LangChain?
The flaw is in the
LangChainLLMwrapper's streaming path. If you do not useLangChainLLM.stream_complete, you are not on the vulnerable code path.- What does the attacker send?
Input of an incorrect type, which makes the worker thread terminate before the model call. The consumer loop then never gets its done signal.
- Is it exploited in the wild?
No source reports exploitation, and it is not in CISA's KEV catalog.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More LlamaIndex vulnerabilities
All LlamaIndex entriesCVE-2025-6208
llama-index-core vulnerable to Uncontrolled Resource Consumption
medium5.3Feb 2, 2026CVE-2025-7707
llama-index has Insecure Temporary File
high7.1Oct 13, 2025CVE-2025-7647
llama-index-core insecurely handles temporary files
high7.3Sep 27, 2025CVE-2025-5302
LlamaIndex affected by a Denial of Service (DOS) in JSONReader
high8.6Aug 26, 2025CVE-2025-6211
LlamaIndex vulnerable to data loss through hash collisions in its DocugamiReader class
medium6.5Jul 10, 2025CVE-2025-3108
LlamaIndex has Incomplete Documentation of Program Execution related to JsonPickleSerializer component
medium5.0Jul 7, 2025
