/

CVE-2026-10105

Severity:

HIGH RISK

(8.3)

SQL Injection in agno ClickHouse Vector Backend

CVE-2026-10105

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Arbitrary SQL Execution / Data Manipulation

Severity:

HIGH RISK

(8.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

agno 2.6.5 contains a SQL injection vulnerability in the ClickHouse vector database backend where metadata filters are concatenated into queries using unsafe f-string interpolation.

By supplying crafted metadata keys and values to the delete_by_metadata() method, an attacker can inject arbitrary SQL expressions to manipulate or disclose data in the ClickHouse backend.

Affected context

This vulnerability appears in deployments using agno 2.6.5 with the ClickHouse vector database backend enabled and the delete_by_metadata() method exposed through an API, service layer, or application logic.

The issue manifests when metadata keys and values supplied by upstream callers are accepted without robust validation or parameterization and are passed to clickhousedb.py, where they are interpolated directly into SQL statements.

Systems that allow tenants, users, or external integrations to control metadata filters used for cleanup, retention policies, or record-specific deletions are particularly exposed.

Exploit preconditions

  • Attack surface: Any endpoint, task, or internal service that calls delete_by_metadata() with user- or client-controlled metadata.
  • Required access: Ability to supply or influence metadata keys and/or values (e.g., via HTTP API inputs, SDK parameters, or job configuration).
  • Trigger point: Invocation of delete_by_metadata() in the ClickHouse backend, which builds SQL using f-strings in clickhousedb.py.
  • Why exploitation is possible: Metadata fields are interpolated into SQL without proper escaping or parameterization, allowing attacker-controlled content to alter the intended query structure.

Why this happens

The root cause aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').

In the ClickHouse backend implementation (clickhousedb.py), delete_by_metadata() uses Python f-strings or similar string concatenation to embed metadata keys and values directly into SQL statements.

Because these values are not passed as bound parameters and are not rigorously sanitized, attacker-controlled input can inject additional SQL syntax, change WHERE clauses, or append new operations.

This pattern breaks the separation between data and code in database interactions, allowing the database server to interpret untrusted input as part of the executable query.

Potential impact

  • Attackers may delete all rows from targeted ClickHouse tables by manipulating delete filters.
  • Attackers could selectively delete or retain specific records, undermining data integrity and auditability.
  • Error-based SQL injection may reveal schema details, table names, and column structure.
  • Blind SQL injection techniques could be used to infer sensitive information from the database over time.
  • Compromised metadata deletion logic may disrupt downstream analytics, search, or vector similarity operations relying on consistent datasets.

General mitigation guidance

Mitigation typically focuses on enforcing a strict separation between query structure and user-controlled data.

Common defensive patterns include:

  • Using parameterized queries or prepared statements for all metadata-driven SQL, ensuring metadata values are bound as parameters rather than interpolated into query strings.
  • Restricting allowed metadata keys to a fixed, validated whitelist and mapping them to known column names instead of trusting arbitrary key names.
  • Normalizing and validating metadata values according to expected types and formats (e.g., enums, integers, UUIDs) before passing them to the database layer.
  • Centralizing query-building utilities to discourage ad hoc f-string or string-concatenation patterns for SQL.
  • Applying least-privilege database roles so that even if a query is abused, the account cannot perform destructive operations beyond its intended scope.

How teams detect issues like this

Effective detection strategies for this class of vulnerability include:

  • Static analysis rules that flag string-formatted SQL, especially f-strings or concatenation involving variables derived from request or metadata inputs.
  • Code review checklists that require reviewers to confirm use of parameterized queries in all data access layers, particularly around delete or update operations.
  • Logging and monitoring of unusual deletion patterns in ClickHouse, such as frequent full-table deletions or unexpected metadata filters, to identify potential abuse.
  • Security tests and dynamic analysis (including fuzzing metadata inputs) to probe delete_by_metadata() and similar methods for injection behavior.
  • Incorporating automated tooling in CI to enforce policies against unsafe query construction patterns in database adapters and backends.

Sources

SourceLink
github.comgithub.com/agno-agi/agno/issues/7866
github.comgithub.com/agno-agi/agno/pull/7883
github.comgithub.com/agno-agi/agno/pull/7883/changes/26a7439b803c0ccc9a58ee53572d8088a678923f
github.comgithub.com/agno-agi/agno/pull/7883/changes/a0ec99305e782e68ba26f5966c53ad50b5f40132
vulncheck.comvulncheck.com/advisories/agno-sql-injection-via-clickhouse-delete-by-metadata

Frequently asked

questions

Exploitability depends on how widely delete_by_metadata() is exposed. If external users or tenants can influence metadata filters through APIs or SDKs, the vulnerability can be exploited remotely from any client capable of sending those inputs.

An attacker needs a path to supply or control metadata keys and values used by delete_by_metadata(). This could be via public APIs accepting metadata filters, internal tools used by multiple teams, or any integration that forwards client-provided metadata into the ClickHouse backend.

The safest pattern is to replace string interpolation with fully parameterized queries, map metadata keys to a fixed set of known columns, and enforce strict type validation on metadata values. Refactoring the data access layer to disallow ad hoc query construction significantly reduces risk.

Adopt a consistent database access layer that mandates parameterization, establish coding standards forbidding f-string or concatenated SQL, and integrate static analysis and code review policies to catch violations early. Training developers on secure query-building patterns and continuously monitoring database activity further helps prevent recurrence.

Find out what's already
exploitable in your codebase.