Summary
SigNoz fails to escape user-supplied telemetry field-key names in the v5 query_range API, allowing authenticated users to inject ClickHouse SQL. A Viewer-role user or higher may exploit crafted field names to access system tables and exfiltrate telemetry or other database data.
Affected context
The vulnerability occurs in SigNoz deployments that expose the v5 query_range API and process user-controlled telemetry field-key names as part of ClickHouse queries. It becomes risky when an authenticated user with Viewer privileges or higher can submit field names containing characters that are interpreted as SQL identifier or string delimiters, and the API does not apply context-appropriate escaping or parameterization.
Exploit preconditions
- Attack surface: The v5
query_rangeAPI - Required access: An authenticated SigNoz account with Viewer role or higher
- Trigger point: Query construction involving user-supplied telemetry field-key names
- Why exploitation is possible: Field names are insufficiently escaped before being incorporated into ClickHouse SQL, allowing identifier or string-literal boundaries to be altered
Why this happens
The underlying bug is SQL query construction that treats user-controlled field-key names as trusted SQL syntax. Special characters such as backticks and quotes can change the interpretation of identifiers or string literals when values are concatenated into a query without context-aware escaping or parameterization. This maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command, commonly known as SQL injection.
Potential impact
- An attacker may execute arbitrary ClickHouse SQL within the API's database context.
- An attacker could read system tables and internal metadata.
- Sensitive telemetry and stored data may be exfiltrated.
- Query integrity could be affected, potentially exposing information across tenants or datasets depending on deployment controls.
- Database resources could be abused through unauthorized queries.
General mitigation guidance
Mitigation generally focuses on ensuring that user-controlled field names cannot become executable SQL syntax.
Common defensive patterns include:
- Using parameterized query mechanisms wherever supported.
- Applying strict allowlists for valid field-key names and rejecting unexpected delimiters.
- Escaping identifiers with database-specific, context-appropriate routines rather than generic string replacement.
- Separating query structure from user-provided values and identifiers.
- Enforcing tenant isolation and least-privilege permissions for the API's ClickHouse account.
- Limiting access to system tables and sensitive datasets through database policies.
- Applying authentication, authorization, and rate-limiting controls consistently across query endpoints.
How teams detect issues like this
Organizations can look for this vulnerability through:
- Static analysis rules identifying string concatenation or interpolation of request fields into SQL statements.
- Code review checks for field names used as identifiers without database-specific escaping or allowlisting.
- Dynamic testing with delimiter characters in telemetry field-key inputs, using non-destructive validation cases.
- API gateway or database audit logs showing unusual query structures, system-table access, or unexpected identifier patterns.
- Policy enforcement that requires parameterized queries and restricts database identities used by read-only APIs.
Automated security review tools may help identify unsafe query construction patterns, but database-aware manual review remains useful for identifier handling.

