Summary
SigNoz contains a SQL injection vulnerability in trace-funnel analytics endpoints because service and span names are interpolated into ClickHouse string literals without escaping. An authenticated attacker may inject SQL through funnel step definitions, execute arbitrary queries, and read returned results over HTTP.
Affected context
The vulnerability occurs in SigNoz deployments that expose trace-funnel analytics endpoints and process attacker-influenced funnel step definitions. It becomes risky when an authenticated user can submit service_name or span_name values that reach ClickHouse queries without adequate parameterization or escaping.
Exploit preconditions
- Attack surface: Authenticated HTTP trace-funnel analytics endpoints
- Required access: Valid application credentials or another permitted authenticated session
- Trigger point: Processing funnel step definitions containing service_name or span_name values
- Why exploitation is possible: User-controlled values are interpolated into ClickHouse string literals without sufficient escaping or parameter binding
Why this happens
The underlying bug is an unsafe construction of database queries from untrusted application data. When service_name and span_name values are inserted directly into ClickHouse SQL string literals, attacker-controlled delimiters and expressions may alter the intended query structure. This behavior 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 unauthorized ClickHouse queries
- Sensitive trace, metric, or application data could be disclosed in HTTP responses
- Database contents may be altered or deleted if the database account permits those operations
- Query performance could be degraded through resource-intensive statements
- Downstream analytics and operational decisions could be affected by manipulated data
General mitigation guidance
Mitigation generally centers on preventing user-controlled values from becoming executable SQL syntax.
Common defensive patterns include:
- Use parameterized queries or supported query-builder abstractions for all dynamic values
- Apply strict input trust reduction through allowlists, length limits, and expected-format validation
- Treat identifiers and filter values as data rather than concatenated query fragments
- Use database accounts with only the read and schema permissions required by analytics features
- Ensure query results and error responses expose no unnecessary sensitive information
- Add regression tests covering quote characters, malformed values, and unexpected query expressions
How teams detect issues like this
Organizations can look for SQL injection risks through:
- Static analysis rules identifying string concatenation or interpolation in database queries
- Code review checks for dynamic SQL construction involving request or form fields
- Tests that verify parameter binding is used for service, span, and other filter values
- Runtime monitoring for anomalous ClickHouse statements, repeated query errors, and unusually broad result sets
- Database audit policies that record query activity by application identity and flag unexpected statement patterns
- Automated code review or application security testing tools that inspect query-building paths

