CVE-2024-12911

7.1 HIGH

📋 TL;DR

This vulnerability allows SQL injection through prompt injection in the JSONalyzeQueryEngine component of llama_index. Attackers can create arbitrary files and cause Denial-of-Service attacks. All users of affected llama_index versions are impacted.

💻 Affected Systems

Products:
  • run-llama/llama_index
Versions: All versions before 0.5.1
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Affects the default_jsonalyzer function when processing untrusted user prompts.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise via arbitrary file creation leading to remote code execution, data exfiltration, and persistent backdoors.

🟠

Likely Case

Denial-of-Service through resource exhaustion and potential data leakage from database queries.

🟢

If Mitigated

Limited impact with proper input validation and query sanitization in place.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploit details available in public bounty reports; SQL injection via prompt manipulation is straightforward.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 0.5.1

Vendor Advisory: https://github.com/run-llama/llama_index/commit/bf282074e20e7dafd5e2066137dcd4cd17c3fb9e

Restart Required: No

Instructions:

Update llama_index package: pip install llama_index==0.5.1
Verify no breaking changes in your application
Test functionality with updated version

🔧 Temporary Workarounds

Input Validation Filter

all

Implement strict input validation to reject prompts containing SQL keywords or special characters

Implement regex filter: ^[a-zA-Z0-9\s]+$ for prompt inputs

🧯 If You Can't Patch

  • Disable JSONalyzeQueryEngine functionality if not required
  • Implement network segmentation to isolate vulnerable systems from critical infrastructure

🔍 How to Verify

Check if Vulnerable:

Check llama_index version: pip show llama_index | grep Version

Check Version:

pip show llama_index | grep Version

Verify Fix Applied:

Confirm version is 0.5.1 or higher and test with known malicious prompts

📡 Detection & Monitoring

Log Indicators:

  • Unusual SQL query patterns in application logs
  • Multiple failed query attempts with special characters
  • Unexpected file creation events

Network Indicators:

  • Abnormal database query volumes
  • Unexpected outbound connections from application servers

SIEM Query:

source="application.log" AND ("SQL" OR "SELECT" OR "INSERT" OR "CREATE") AND "jsonalyzer"

🔗 References

📤 Share & Export