CVE-2026-33142: Oneuptime SQL Injection Vulnerability

HIGH
Advisory Identifier: GHSA-gcg3-c5p2-cqgg
CVSS 8.1
CWE-89
Published
Advisory Summary

CVE-2026-33142 is a HIGH (CVSS 8.1) 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 vulnerable to sql injection via unvalidated column identifiers in sort, select, and groupby parameters. Remediation is available by upgrading affected packages to version 10.0.34.

CVE-2026-33142 at a Glance

CVE Identifier CVE-2026-33142
GHSA Identifier GHSA-gcg3-c5p2-cqgg
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Oneuptime
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.1

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:U/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-33142

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.

oneuptime fixed: 10.0.34
npm install oneuptime@10.0.34
Verify Direct and Transitive Dependencies

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-33142, 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.34), 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

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 for trusted column names but unsafe for user input. ### Input flow `BaseAnalyticsAPI.ts` deserializes `sort`, `select`, and `groupBy` directly from `req.body` (lines 239-253) and passes them to the service layer without column validation: ```typescript sort = JSONFunctions.deserialize(req.body["sort"]) as Sort<AnalyticsDataModel>; select = JSONFunctions.deserialize(req.body["select"]) as Select<AnalyticsDataModel>; groupBy = JSONFunctions.deserialize(req.body["groupBy"]) as GroupBy<AnalyticsDataModel>; ``` ### Affected endpoints Any endpoint backed by `BaseAnalyticsAPI.getList()` or `BaseAnalyticsAPI.getAggregate()` - this includes analytics queries for logs, metrics, spans, and exceptions. ## Impact An authenticated user can inject arbitrary ClickHouse SQL through crafted column names in sort, select, or groupBy request parameters. This allows reading, modifying, or deleting analytics data (logs, metrics, traces) stored in ClickHouse. PostgreSQL data is not affected (separate query path). ## Suggested Fix Add the same `getTableColumn()` validation already present in `toWhereStatement` to the three unvalidated methods: ```typescript // toSortStatement, toSelectStatement, toGroupByStatement for (const key in sort) { if (!this.model.getTableColumn(key)) { throw new BadDataException(`Unknown column: ${key}`); } // existing logic } ``` This matches the pattern used in the GHSA-p5g2 fix for `_aggregateBy` and the existing `toWhereStatement` validation.

CVE-2026-33142 Affected Oneuptime Versions

1 component(s)
Fixed Versions:
10.0.34
Product / Package Ecosystem Affected Versions Fixed Version
oneuptime
npm
< 10.0.34
10.0.34

References

Frequently Asked Questions

What is CVE-2026-33142?
CVE-2026-33142 is a security vulnerability in Oneuptime involving OneUptime ClickHouse vulnerable to SQL Injection via unvalidated column identifiers in sort, select, and groupBy parameters under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Oneuptime versions are affected?
Affected versions include releases prior to 10.0.34 across affected packages: oneuptime.
What version fixes CVE-2026-33142?
Upgrading to 10.0.34 (or the latest patched release for your respective branch) resolves the vulnerability.
Is oneuptime affected?
Yes, oneuptime is affected in releases prior to 10.0.34. Upgrade your dependency to 10.0.34 or later.
What is the CVSS score of CVE-2026-33142?
CVE-2026-33142 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2026-33142?
CVE-2026-33142 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (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.).
How can I check npm dependencies for CVE-2026-33142?
Run the dependency tree command: 'npm ls oneuptime'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-gcg3-c5p2-cqgg",
  "modified" : "2026-03-20T21:33:25Z",
  "published" : "2026-03-18T16:34:18Z",
  "aliases" : [ "CVE-2026-33142" ],
  "summary" : "OneUptime ClickHouse vulnerable to SQL Injection via unvalidated column identifiers in sort, select, and groupBy parameters",
  "details" : "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.\n\nClickHouse 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.\n\n## Details\n\n### Root cause\n\n`StatementGenerator.ts` has four methods that iterate over user-provided object keys to build SQL:\n\n| Method | Validates keys? |\n|--------|----------------|\n| `toWhereStatement` (line 292) | Yes - calls `this.model.getTableColumn(key)` |\n| `toSortStatement` (line 467) | **No** |\n| `toSelectStatement` (line 483) | **No** |\n| `toGroupByStatement` (line 451) | **No** |\n\nIn `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 for trusted column names but unsafe for user input.\n\n### Input flow\n\n`BaseAnalyticsAPI.ts` deserializes `sort`, `select`, and `groupBy` directly from `req.body` (lines 239-253) and passes them to the service layer without column validation:\n\n```typescript\nsort = JSONFunctions.deserialize(req.body[\"sort\"]) as Sort<AnalyticsDataModel>;\nselect = JSONFunctions.deserialize(req.body[\"select\"]) as Select<AnalyticsDataModel>;\ngroupBy = JSONFunctions.deserialize(req.body[\"groupBy\"]) as GroupBy<AnalyticsDataModel>;\n```\n\n### Affected endpoints\n\nAny endpoint backed by `BaseAnalyticsAPI.getList()` or `BaseAnalyticsAPI.getAggregate()` - this includes analytics queries for logs, metrics, spans, and exceptions.\n\n## Impact\n\nAn authenticated user can inject arbitrary ClickHouse SQL through crafted column names in sort, select, or groupBy request parameters. This allows reading, modifying, or deleting analytics data (logs, metrics, traces) stored in ClickHouse. PostgreSQL data is not affected (separate query path).\n\n## Suggested Fix\n\nAdd the same `getTableColumn()` validation already present in `toWhereStatement` to the three unvalidated methods:\n\n```typescript\n// toSortStatement, toSelectStatement, toGroupByStatement\nfor (const key in sort) {\n  if (!this.model.getTableColumn(key)) {\n    throw new BadDataException(`Unknown column: ${key}`);\n  }\n  // existing logic\n}\n```\n\nThis matches the pattern used in the GHSA-p5g2 fix for `_aggregateBy` and the existing `toWhereStatement` validation.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "oneuptime"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "10.0.34"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/OneUptime/oneuptime/security/advisories/GHSA-gcg3-c5p2-cqgg"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-33142"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/OneUptime/oneuptime"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-18T16:34:18Z",
    "nvd_published_at" : "2026-03-20T21:17:14Z"
  }
}