CVE-2026-142652: CVE-2026-142652: SQL Injection in Agenta Tracing Full-Text Content Filter
CVE-2026-142652: SQL Injection in Agenta Tracing Full-Text Content Filter Vulnerability ID: CVE-2026-142652 CVSS Score: 7.7 Published: 2026-12-03 An authenticated SQL injection vulnerability exists in Agenta prior t
CVE-2026-142652: SQL Injection in Agenta Tracing Full-Text Content Filter
Vulnerability ID: CVE-2026-142652
CVSS Score: 7.7
Published: 2026-12-03
An authenticated SQL injection vulnerability exists in Agenta prior to version 0.122.5 within the tracing database query layer. The full-text content filter handler in api/oss/src/dbs/postgres/tracing/utils.py interpolates user-supplied search strings directly into a SQLAlchemy text() construct without parameter binding or escaping. This flaw allows an authenticated user with read access to spans in a single project to execute arbitrary SQL conditions against the tracing database, bypassing project and tenant isolation boundaries to exfiltrate trace data across the entire platform.
TL;DR
Agenta versions prior to 0.122.5 contain an SQL injection vulnerability (CWE-89) in the POST /api/spans/query endpoint. By passing crafted search strings to the full-text content filter, a low-privileged authenticated user can perform boolean-based or time-based blind SQL injection to read LLM traces, prompts, and span metadata across all projects and tenants.
โ ๏ธ Exploit Status: POC
Technical Details
- Vulnerability Type: CWE-89: SQL Injection
- CVSS v3.1 Score: 7.7 High (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N)
- Affected Component: api/oss/src/dbs/postgres/tracing/utils.py (_handle_fts_field)
- Attack Vector: Authenticated HTTP POST to /api/spans/query
- Security Impact: Cross-project and cross-tenant disclosure of LLM traces and spans
- Fixed Version: 0.122.5
- CISA KEV Status: Not Listed
Affected Systems
- Agenta-AI/agenta (< 0.122.5)
-
agenta: < 0.122.5 (Fixed in:
0.122.5)
Code Analysis
Commit: 345d6d3
fix(tracing): bind full-text content filter value as a query parameter
File: api/oss/src/dbs/postgres/tracing/utils.py
@@ -678,7 +678,10 @@ def _handle_fts_field(
# ------------------------- #
ts_vector = func.to_tsvector(text("'simple'"), attribute)
- ts_query = func.websearch_to_tsquery(text("'simple'"), text(f"'{value}'"))
+ ts_query = func.websearch_to_tsquery(
+ text("'simple'"),
+ bindparam(None, str(value), type_=Text),
+ )
conditions.append(ts_vector.op("@@")(ts_query))
@@ -692,7 +695,10 @@ def _handle_fts_field(
# ------------------------- #
ts_vector = func.to_tsvector(text("'simple'"), attribute)
- ts_query = func.websearch_to_tsquery(text("'simple'"), text(f"'{value}'"))
+ ts_query = func.websearch_to_tsquery(
+ text("'simple'"),
+ bindparam(None, str(value), type_=Text),
+ )
conditions.append(ts_vector.op("@@")(ts_query))
Mitigation Strategies
- Upgrade Agenta to version 0.122.5 or later to ensure all full-text search terms are passed via SQLAlchemy bound parameters.
- Deploy WAF or API Gateway inspection rules on POST /api/spans/query to block requests containing single quotes or SQL comment sequences in the content filter.
- Audit PostgreSQL query logs for syntax errors involving websearch_to_tsquery or anomalous execution times indicative of blind SQL injection probing.
Remediation Steps:
- Identify all running Agenta backend instances running versions prior to 0.122.5.
- Pull the official Agenta release v0.122.5 or apply commit 345d6d3e22bc0ece92ebefdf11d8e453c658e51c to the api service codebase.
- Restart the Agenta API services and verify the patch by executing the unit test suite in api/oss/tests/pytest/unit/tracing/test_content_filter.py.
- Review historical logs for POST /api/spans/query to confirm no cross-tenant trace exfiltration occurred prior to patching.
References
- GitHub Security Advisory GHSA-96p7-33vc-xgf2
- Agenta Pull Request #7529
- Fix Commit 345d6d3e22bc0ece92ebefdf11d8e453c658e51c
- Agenta Release v0.122.5
- CVE.org Record for CVE-2026-142652
- CVEListV5 JSON Record
- NVD Vulnerability Detail for CVE-2026-142652
Read the full report for CVE-2026-142652 on our website for more details including interactive diagrams and full exploit analysis.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes โ full credit and traffic to the original publisher.