OneUptime ClickHouse vulnerable to SQL Injection via unvalidated column identifiers in sort, select, and groupBy parameters
Date: 2026-03
Affected: npm/oneuptime
Attack vector: deserialization
Category: vulnerability-disclosure
Severity: High
CVE: CVE-2026-33142
CWE: CWE-89
CVSS: 8.1 (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N)

The fix for GHSA-p5g2-jm85-8g35 (ClickHouse SQL injection via aggregate query parameters) added column name validation to the `_aggregateBy` method but did not apply the same validation to three other query construction paths in `StatementGenerator`. The `toSortStatement`, `toSelectStatement`, and `toGroupByStatement` methods accept user-controlled object keys from API request bodies and interpolate them as ClickHouse `Identifier` parameters without verifying they correspond to actual model columns. ClickHouse Identifier parameters are substituted directly into queries without escaping, so an attacker who can reach any analytics list or aggregate endpoint can inject arbitrary SQL through crafted `sort`, `select`, or `groupBy` keys. ## Details ### Root cause `StatementGenerator.ts` has four methods that iterate over user-provided object keys to build SQL: | Method | Validates keys? | |--------|----------------| | `toWhereStatement` (line 292) | Yes - calls `this.model.getTableColumn(key)` | | `toSortStatement` (line 467) | **No** | | `toSelectStatement` (line 483) | **No** | | `toGroupByStatement` (line 451) | **No** | In `Statement.ts`, when a value passed to the `SQL` tagged template is a string, it receives the `Identifier` data type (line 40). Per [ClickHouse documentation](https://clickhouse.com/docs/en/sql-reference/syntax#defining-and-using-query-parameters), Identifier parameters are substituted directly into the query without quoting or escaping. This is correct


Mitigations:

Architectural layers (MAESTRO):