CVE-2024-12910
Executive Summary
CVE-2024-12910 is a Denial of Service (DoS) vulnerability in the KnowledgeBaseWebReader class of the run-llama/llama_index repository (version latest). The flaw allows an attacker to cause infinite recursive calls to the get_article_urls method by controlling a URL variable to contain the root URL. This leads to exhaustion of system resources and potential application crash. The vulnerability has a CVSS score of 4.2 (Medium) and an EPSS score of 0.0%, indicating low exploitation likelihood at this time. No public exploit code or patch is currently available.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability affects the llama_index Python package, which is distributed via PyPI. Organizations using this package should monitor for updates and consider pinning versions to avoid automatic updates that might introduce unpatched code. The lack of a patch increases supply chain risk, as the vulnerable component could be used in downstream applications.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
- Base Score: 4.2 (Medium)
- Attack Vector: Network (AV:N) – The vulnerability can be exploited remotely.
- Attack Complexity: Low (AC:L) – No special conditions required.
- Privileges Required: None (PR:N) – No authentication needed.
- User Interaction: None (UI:N) – No user action required.
- Scope: Unchanged (S:U) – The impact is confined to the vulnerable component.
- Confidentiality Impact: None (C:N) – No data exposure.
- Integrity Impact: None (I:N) – No data modification.
- Availability Impact: Low (A:L) – Resource exhaustion may degrade performance or cause crash.
Threat Level: Medium. The vulnerability is easy to exploit remotely but only results in a denial of service, not data compromise.
Deep Dive & Mechanics
The vulnerability resides in the KnowledgeBaseWebReader class, specifically in the get_article_urls method. This method is designed to fetch and parse article URLs from a given web page. The flaw occurs when an attacker controls the URL variable to point to the root URL (e.g., https://example.com/). The method recursively calls itself for each URL found on the page, but if the root URL is provided, it may find itself again in the list of URLs, leading to infinite recursion.
Technical Flow:
- The
KnowledgeBaseWebReaderreceives a URL from user input. - The
get_article_urlsmethod fetches the page and extracts all hyperlinks. - If the extracted links include the root URL (or a URL that leads back to the same page), the method recursively calls itself with that URL.
- This recursion continues indefinitely, consuming CPU and memory resources, eventually causing a denial of service.
Root Cause: Lack of a depth limit or visited-URL tracking in the recursive function.
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual):
class KnowledgeBaseWebReader:
def get_article_urls(self, url):
page = self.fetch_page(url)
urls = self.extract_urls(page)
for u in urls:
# No check if u has been visited or if recursion depth is exceeded
self.get_article_urls(u)
return urls
Patched Code (Hypothetical):
class KnowledgeBaseWebReader:
def get_article_urls(self, url, visited=None, depth=0, max_depth=5):
if visited is None:
visited = set()
if url in visited or depth > max_depth:
return []
visited.add(url)
page = self.fetch_page(url)
urls = self.extract_urls(page)
for u in urls:
self.get_article_urls(u, visited, depth+1, max_depth)
return urls
The patch introduces a visited set to track already-processed URLs and a max_depth limit to prevent infinite recursion.
Exploitation & Lab Setup
Red Team
Prerequisites:
- A target running a vulnerable version of
llama_indexwithKnowledgeBaseWebReaderexposed. - Ability to control the URL parameter (e.g., via API endpoint).
Exploitation Steps:
- Identify an endpoint that uses
KnowledgeBaseWebReaderand accepts a URL parameter. - Send a request with the URL set to the root of a site that contains links back to itself (e.g.,
https://example.com/). - The server will enter infinite recursion, consuming resources and potentially crashing.
Example Request (cURL):
curl -X POST "http://target:8000/read" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/"}'
Expected Outcome: The server becomes unresponsive or crashes due to resource exhaustion.
Blue Team
Detection:
- Monitor for unusually high CPU or memory usage on servers running
llama_index. - Look for repeated requests to the same URL pattern (e.g., root URL) in logs.
- Implement rate limiting and input validation on URL parameters.
Mitigation:
- Apply the hypothetical patch (add depth limit and visited tracking).
- Use a web application firewall (WAF) to block requests with suspicious URL patterns.
- Restrict the
KnowledgeBaseWebReaderto only allow specific, trusted domains.
Indicators of Compromise (IOCs)
- Network: Repeated HTTP requests to the same root URL (e.g.,
https://example.com/) from the same source IP. - System: High CPU usage by the Python process running
llama_index. - Logs: Error messages related to recursion depth exceeded or memory exhaustion in application logs.
- File: Temporary files or memory dumps indicating excessive recursion.
Detection Engineering
YARA Rule
rule CVE_2024_12910_KnowledgeBaseWebReader_DoS {
meta:
description = "Detects potential exploitation of CVE-2024-12910 in llama_index"
author = "Valters IT"
date = "2025-04-10"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2024-12910"
strings:
$s1 = "get_article_urls" ascii wide nocase
$s2 = "KnowledgeBaseWebReader" ascii wide nocase
$s3 = "recursion" ascii wide nocase
condition:
all of ($s*) and filesize < 10MB
}
Sigma Rule
title: CVE-2024-12910 - llama_index KnowledgeBaseWebReader DoS
id: 8a3f7c2e-5d1b-4a9f-8c6e-2b3d1f0a7e9c
status: experimental
description: Detects potential exploitation of CVE-2024-12910 via excessive recursion
author: Valters IT
date: 2025-04-10
logsource:
category: process_creation
product: linux
detection:
selection:
Image|endswith: '/python3'
CommandLine|contains: 'get_article_urls'
condition: selection
falsepositives:
- Legitimate use of KnowledgeBaseWebReader with non-recursive URLs
level: medium
Suricata Rule
alert http any any -> any any (
msg:"CVE-2024-12910 - llama_index KnowledgeBaseWebReader DoS Attempt";
flow:to_server;
content:"/read"; http_uri;
content:"url"; http_client_body;
pcre:"/https?:\/\/[^\/]+\//";
classtype:attempted-dos;
sid:1000001;
rev:1;
)
Remediation & Mitigation
Immediate Actions:
- Disable the
KnowledgeBaseWebReadercomponent if not needed. - Implement input validation to restrict URLs to a whitelist of trusted domains.
- Apply rate limiting on endpoints that accept URL parameters.
Long-Term Fix:
- Patch the code to include recursion depth limits and visited URL tracking (as shown in the patched code section).
- Update to a patched version once released by the vendor.
Workaround:
- Use a reverse proxy or WAF to block requests containing root URLs (e.g.,
https://example.com/) in the request body.
Monitoring:
- Enable logging for all requests to the vulnerable endpoint.
- Set up alerts for high CPU usage or process crashes.
Valters IT