{"id":"CVE-2026-41496","aliases":["CVE-2026-41496","GHSA-rg3h-x3jw-7jm5","PYSEC-2026-2923","PYSEC-2026-2952"],"related":[],"kind":"vulnerability","state":"published","title":"PraisonAI: SQL Injection via unvalidated `table_prefix` in 9 conversation store backends (incomplete fix for CVE-2026-40315)","summary":"PraisonAI is a multi-agent teams system. Prior to praisonai version 4.6.9 and praisonaiagents version 1.6.9, the fix for CVE-2026-40315 added input validation to SQLiteConversationStore only. Nine sibling backends — MySQL, PostgreSQL, async SQLite/MySQL/PostgreSQL, Turso, SingleStore, Supabase, SurrealDB — pass table_prefix straight into f-string SQL. Same root cause, same code pattern, same exploitation. 52 unvalidated injection points across the codebase. postgres.py additionally accepts an unvalidated schema parameter used directly in DDL. This issue has been patched in praisonai version 4.6.9 and praisonaiagents version 1.6.9.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"PraisonAI is a multi-agent teams system. Prior to praisonai version 4.6.9 and praisonaiagents version 1.6.9, the fix for CVE-2026-40315 added input validation to SQLiteConversationStore only. Nine sibling backends — MySQL, PostgreSQL, async SQLite/MySQL/PostgreSQL, Turso, SingleStore, Supabase, SurrealDB — pass table_prefix straight into f-string SQL. Same root cause, same code pattern, same exploitation. 52 unvalidated injection points across the codebase. postgres.py additionally accepts an unvalidated schema parameter used directly in DDL. This issue has been patched in praisonai version 4.6.9 and praisonaiagents version 1.6.9.","source":"cvelist"},{"lang":"en","text":"The fix for [CVE-2026-40315](https://github.com/MervinPraison/PraisonAI/security/advisories/GHSA-x783-xp3g-mqhp) added input validation to `SQLiteConversationStore` only. Nine sibling backends — MySQL, PostgreSQL, async SQLite/MySQL/PostgreSQL, Turso, SingleStore, Supabase, SurrealDB — pass `table_prefix` straight into f-string SQL. Same root cause, same code pattern, same exploitation. 52 unvalidated injection points across the codebase.\n\n`postgres.py` additionally accepts an unvalidated `schema` parameter used directly in DDL.\n\n### Severity\n\n**High** — CWE-89 (SQL Injection)\n\nCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N — **8.1**\n\nExploitable in any deployment where `table_prefix` is derived from external input (multi-tenant setups, API-driven configuration, user-modifiable config files). Default config (`\"praison_\"`) is not affected.\n\n### Details\n\nThe [CVE-2026-40315 fix](https://github.com/MervinPraison/PraisonAI/security/advisories/GHSA-x783-xp3g-mqhp) added this guard to `sqlite.py:52`:\n\n```python\n# sqlite.py — PATCHED\nimport re\nif not re.match(r'^[a-zA-Z0-9_]*$', table_prefix):\n    raise ValueError(\"table_prefix must contain only alphanumeric characters and underscores\")\n```\n\nThe following backends perform the identical `table_prefix → f-string SQL` pattern **without this guard**:\n\n| Backend          | File                                         | Line            | Injection points        |\n| ---------------- | -------------------------------------------- | --------------- | ----------------------- |\n| MySQL            | `persistence/conversation/mysql.py`          | 65              | 5                       |\n| PostgreSQL       | `persistence/conversation/postgres.py`       | 89 (+schema:88) | 10                      |\n| Async SQLite     | `persistence/conversation/async_sqlite.py`   | 43              | 13                      |\n| Async MySQL      | `persistence/conversation/async_mysql.py`    | 65              | 13                      |\n| Async PostgreSQL | `persistence/conversation/async_postgres.py` | 63              | 13                      |\n| Turso/LibSQL     | `persistence/conversation/turso.py`          | 66              | 9                       |\n| SingleStore      | `persistence/conversation/singlestore.py`    | 51              | 7                       |\n| Supabase         | `persistence/conversation/supabase.py`       | 68              | 9                       |\n| SurrealDB        | `persistence/conversation/surrealdb.py`      | 57              | 8                       |\n| **Total**        | **9 backends**                               |                 | **52 injection points** |\n\nAdditionally, `praisonai-agents/praisonaiagents/storage/backends.py:179` (`SQLiteBackend`) accepts `table_name` without validation.\n\n### PoC\n\n```python\n#!/usr/bin/env python3\n\"\"\"\nDemonstrates: sqlite.py rejects malicious table_prefix, mysql.py accepts it.\nRun: python3 poc.py  (no dependencies required)\n\"\"\"\nimport re\n\npayload = \"x'; DROP TABLE users; --\"\n\n# ── SQLite (patched) ────────────────────────────────────────────────\ntry:\n    if not re.match(r'^[a-zA-Z0-9_]*$', payload):\n        raise ValueError(\"blocked\")\n    print(f\"[SQLite] FAIL — accepted: {payload}\")\nexcept ValueError:\n    print(f\"[SQLite] OK — rejected malicious table_prefix\")\n\n# ── MySQL (unpatched) ───────────────────────────────────────────────\nsessions_table = f\"{payload}sessions\"\nsql = f\"CREATE TABLE IF NOT EXISTS {sessions_table} (session_id VARCHAR(255) PRIMARY KEY)\"\nprint(f\"[MySQL]  VULN — generated SQL:\\n  {sql}\")\n\n# ── PostgreSQL (unpatched — both table_prefix AND schema) ──────────\nschema = \"public; DROP SCHEMA data CASCADE; --\"\nsessions_table = f\"{schema}.praison_sessions\"\nsql = f\"CREATE SCHEMA IF NOT EXISTS {schema}\"\nprint(f\"[Postgres] VULN — schema injection:\\n  {sql}\")\n```\n\nOutput:\n\n```\n[SQLite] OK — rejected malicious table_prefix\n[MySQL]  VULN — generated SQL:\n  CREATE TABLE IF NOT EXISTS x'; DROP TABLE users; --sessions (session_id VARCHAR(255) PRIMARY KEY)\n[Postgres] VULN — schema injection:\n  CREATE SCHEMA IF NOT EXISTS public; DROP SCHEMA data CASCADE; --\n```\n\n### Vulnerable code (mysql.py, representative)\n\n```python\n# mysql.py:65-67 — NO validation\nself.table_prefix = table_prefix                    # ← raw input\nself.sessions_table = f\"{table_prefix}sessions\"     # ← into identifier\nself.messages_table = f\"{table_prefix}messages\"\n\n# mysql.py:105 — straight into DDL\ncur.execute(f\"\"\"\n    CREATE TABLE IF NOT EXISTS {self.sessions_table} (\n        session_id VARCHAR(255) PRIMARY KEY, ...\n    )\n\"\"\")\n```\n\nCompare with the patched `sqlite.py:52`:\n\n```python\n# sqlite.py:52-53 — HAS validation\nif not re.match(r'^[a-zA-Z0-9_]*$', table_prefix):\n    raise ValueError(\"table_prefix must contain only alphanumeric characters and underscores\")\n```\n\n### Impact\n\nWhen `table_prefix` originates from untrusted input — multi-tenant tenant names, API request parameters, user-editable config — an attacker achieves **arbitrary SQL execution** against the backing database. The injected SQL runs in the context of DDL and DML operations (CREATE TABLE, INSERT, SELECT, DELETE), giving the attacker read/write/delete access to the entire database.\n\nPostgreSQL's `schema` parameter adds a second injection vector in DDL (`CREATE SCHEMA IF NOT EXISTS {schema}`).","format":"markdown","source":"ghsa"},{"lang":"es","text":"PraisonAI es un sistema de equipos multiagente. Antes de la versión 4.6.9 de praisonai y la versión 1.6.9 de praisonaiagents, la corrección para CVE-2026-40315 añadió validación de entrada solo a SQLiteConversationStore. Nueve backends hermanos - MySQL, PostgreSQL, SQLite/MySQL/PostgreSQL asíncrono, Turso, SingleStore, Supabase, SurrealDB - pasan table_prefix directamente a SQL de f-string. Misma causa raíz, mismo patrón de código, misma explotación. 52 puntos de inyección no validados en toda la base de código. postgres.py acepta adicionalmente un parámetro de esquema no validado utilizado directamente en DDL. Este problema ha sido parcheado en la versión 4.6.9 de praisonai y la versión 1.6.9 de praisonaiagents.","source":"nvd"}],"published":"2026-04-17T22:24:19.000Z","modified":"2026-10-26T19:10:00.163Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N","score":8.1,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N","score":8.1,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N","score":8.1,"rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N","score":8.1,"rating":"HIGH"}],"cwes":["CWE-89"],"affected":[{"ranges":[{"version":"praisonaiagents < 1.6.9","status":"affected"},{"version":"praisonai < 4.6.9","status":"affected"}],"vendor":"MervinPraison","product":"PraisonAI","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"4.5.149"}],"ecosystem":"PyPI","package":"praisonai","purl":"pkg:pypi/praisonai","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.6.8"}],"ecosystem":"PyPI","package":"praisonaiagents","purl":"pkg:pypi/praisonaiagents","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"4.6.9"}],"vendor":"praison","product":"praisonai","cpe":"cpe:2.3:a:praison:praisonai:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"status":"affected","fixed":"1.6.9"}],"vendor":"praison","product":"praisonaiagents","cpe":"cpe:2.3:a:praison:praisonaiagents:*:*:*:*:*:python:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"4.5.149"}],"ecosystem":"PyPI","package":"praisonai","purl":"pkg:pypi/praisonai","source":"pysec"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.6.8"}],"ecosystem":"PyPI","package":"praisonaiagents","purl":"pkg:pypi/praisonaiagents","source":"pysec"}],"references":[{"url":"https://github.com/MervinPraison/PraisonAI/security/advisories/GHSA-rg3h-x3jw-7jm5","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41496","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/MervinPraison/PraisonAI","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/praisonai","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-rg3h-x3jw-7jm5","tags":["advisory"],"sources":["pysec"]},{"url":"https://pypi.org/project/praisonaiagents","tags":["package"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"total","date":"2026-05-08T23:17:23.691Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-41496","url":"https://www.cve.org/CVERecord?id=CVE-2026-41496","licence":"CVE Terms of Use","modified":"2026-05-08T23:18:11.328Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-rg3h-x3jw-7jm5","url":"https://github.com/advisories/GHSA-rg3h-x3jw-7jm5","licence":"CC-BY-4.0","modified":"2026-07-13T16:42:31.030Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-41496","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41496","licence":"Public domain","modified":"2026-10-26T19:10:00.163Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-2923","url":"https://osv.dev/vulnerability/PYSEC-2026-2923","licence":"CC-BY-4.0","modified":"2026-07-13T16:42:31.030Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-2952","url":"https://osv.dev/vulnerability/PYSEC-2026-2952","licence":"CC-BY-4.0","modified":"2026-07-13T16:42:31.030Z"}],"updatedAt":"2026-11-25T22:59:20.970Z","epss":{"score":0.00347,"percentile":0.3029,"date":"2026-12-01T12:00:22.000Z"}}