llama-index-packs-finchat SQL Injection vulnerability
The FinanceChatLlamaPack's database agent passed user input directly into SQL queries, allowing an attacker to inject arbitrary SQL. This could lead to remote code execution via PostgreSQL's large object functionality.
run-llama/llama_index
Originally disclosed on huntr
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.
From the GitHub Advisory Database (GHSA-x48g-hm9c-ww42, CC BY 4.0).
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the run_sql_query function built SQL statements by concatenating user-supplied input instead of using parameterised queries.
Impact
An attacker could inject arbitrary SQL and potentially achieve remote code execution through PostgreSQL's large object functionality.
What the attacker needed
Access to the database agent; PostgreSQL backend
The fix
The package is no longer officially supported and has been moved to a stale_packages branch, removing it from documentation.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
SQL injection is when a program builds a database command by gluing together text that includes user input, so a user can sneak in extra commands. Here, the finance chat package did that, letting an attacker run their own database commands. The report says this could even let them run code on the database server.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.