PraisonAI Multiple Backends Vulnerable to SQL Injection via Unvalidated Table Prefix
PraisonAI is vulnerable to SQL injection across nine database backends due to unsanitized `table_prefix` parameters, and in PostgreSQL due to an unsanitized `schema` parameter, enabling arbitrary SQL execution.
PraisonAI, a software application, contains a critical SQL injection vulnerability affecting nine of its conversation store backends, including MySQL, PostgreSQL, and others. The vulnerability stems from the improper handling of the table_prefix parameter, which is passed directly into SQL queries without adequate validation. Specifically, backends such as MySQL, PostgreSQL, async SQLite/MySQL/PostgreSQL, Turso, SingleStore, Supabase, and SurrealDB are affected. In addition, the PostgreSQL backend is vulnerable due to the unvalidated schema parameter. This flaw allows an attacker to inject arbitrary SQL commands, potentially gaining unauthorized access to sensitive data. The incomplete fix for CVE-2026-40315 only addressed the SQLite backend, leaving other backends exposed. This vulnerability exists in PraisonAI versions 4.5.148 and earlier, as well as PraisonAI Agents versions 1.6.7 and earlier.
Attack Chain
- An attacker identifies a PraisonAI instance where the
table_prefixorschema(PostgreSQL) parameter is derived from external input (e.g., API request, user-modifiable configuration). - The attacker crafts a malicious
table_prefixorschemastring containing SQL injection payload (e.g., “x’; DROP TABLE users; –”). - The attacker injects the malicious
table_prefixorschemavia the vulnerable input vector. - The PraisonAI application receives the crafted
table_prefixorschemaand incorporates it into a dynamically generated SQL query without proper sanitization. - The application executes the malicious SQL query against the database.
- The attacker’s injected SQL commands are executed, potentially allowing them to read, modify, or delete data within the database.
- The attacker gains unauthorized access to sensitive data, such as user credentials, financial information, or other confidential data.
- The attacker may escalate privileges, compromise other systems, or perform further malicious activities within the affected environment.
Impact
Successful exploitation of this vulnerability enables attackers to execute arbitrary SQL commands, potentially leading to complete database compromise. The attacker can read sensitive data, modify existing records, inject malicious code, or even drop entire tables. This can result in significant data loss, financial damage, and reputational harm for affected organizations. This vulnerability is exploitable in any deployment where the table_prefix is derived from external input, such as in multi-tenant setups or API-driven configurations. The PostgreSQL schema parameter provides an additional injection point, further expanding the attack surface.
Recommendation
- Apply input validation and sanitization to the
table_prefixparameter in all database backends, mirroring the fix implemented forsqlite.pyas described in the overview. - Apply input validation and sanitization to the
schemaparameter in the PostgreSQL backend, as noted in the overview. - Deploy the Sigma rule
Detect Malicious Table Prefixto detect attempts to exploit this vulnerability in MySQL and PostgreSQL backends, as detailed below. - Upgrade PraisonAI to a version that includes proper input validation for
table_prefixandschemaparameters, targeting versions later than 4.5.148 for PraisonAI and later than 1.6.7 for PraisonAI Agents.
Detection coverage 2
Detect Malicious Table Prefix
highDetects suspicious table prefix values in web requests that may indicate SQL injection attempts against PraisonAI MySQL and PostgreSQL backends.
Detect PraisonAI SQL Injection via Table Name
highDetects attempts to inject SQL commands via the table_name parameter, exploiting a vulnerability in SQLiteBackend.
Detection queries are kept inside the platform. Get full rules →