PostgreSQL
CVE-2026-33142
HIGH
Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessAuthenticate to application with valid credentials
-
DeliverySend API request with malicious object keys in body
-
ExploitInject SQL via toSortStatement/toSelectStatement/toGroupByStatement methods
-
ExecutionExecute arbitrary ClickHouse queries
-
ImpactExtract sensitive data or modify database
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Parameterized queries, prepared statements
MITRE ATT&CK
2 techniques across 2 tactics: Initial Access, Persistence The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Authenticated user with API access to ClickHouse connector. Attacker sends crafted API request with malicious object keys in request body targeting toSortStatement, toSelectStatement, or toGroupByStatement methods. No user interaction required. Affects ClickHouse SQL injection vulnerability in statement generation paths. |
| Impact | The CVSS score of 8.1 (High) reflects network-based attack vector with low complexity, requiring only low-level authentication and no user interaction, with high confidentiality and integrity impact but no availability impact (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N). The PR:L (low privileges required) requirement somewhat limits risk to authenticated users, but the detailed GitHub security advisory (GHSA-gcg3-c5p2-cqgg) provides comprehensive exploitation guidance including specific vulnerable methods, input flows, and suggested fixes, effectively serving as a technical roadmap for attackers. The vulnerability affects analytics endpoints that are likely exposed to authenticated internal users or customers with API access, increasing practical exploitation risk. No EPSS score or KEV status is provided in the intelligence, suggesting no active widespread exploitation has been detected yet. However, the low attack complexity combined with detailed public disclosure makes this a genuine priority for OneUptime deployments, particularly those with untrusted authenticated users or multi-tenant analytics access. The scope limitation to ClickHouse data (not PostgreSQL) provides some boundary to the blast radius. |
| Exploit ScenarioDerived | An authenticated attacker with access to OneUptime's analytics API crafts a POST request to any analytics list or aggregate endpoint with a malicious sort parameter containing SQL injection payloads as object keys, such as {"col1; DROP TABLE analytics_logs--": "asc"}. Because toSortStatement does not validate the key against actual model columns, the injected SQL is passed as a ClickHouse Identifier parameter and executed directly, allowing the attacker to exfiltrate sensitive analytics data, modify aggregation results, or delete logs and metrics stored in ClickHouse. The low attack complexity and detailed public advisory make exploitation straightforward for any authenticated user with API access. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Mar 18, 2026
SQL injection in PostgreSQL StatementGenerator allows authenticated attackers to execute arbitrary SQL commands through unsanitized object keys in sort, select, and groupBy parameters on analytics endpoints. The vulnerability exists because column name validation was incompletely applied during a previous fix, leaving three query construction methods vulnerable to direct identifier injection. An attacker with valid credentials can exploit this to access or manipulate database contents without requiring user interaction.
Earlier versions of this analysis (1)
A SQL injection vulnerability exists in OneUptime's ClickHouse analytics query construction where three methods (toSortStatement, toSelectStatement, toGroupByStatement) accept user-controlled object keys from API request bodies and interpolate them as ClickHouse Identifier parameters without validating they correspond to actual model columns. Authenticated users can exploit any analytics list or aggregate endpoint to inject arbitrary SQL through crafted sort, select, or groupBy keys, potentially reading, modifying, or deleting analytics data including logs, metrics, traces, and exceptions stored in ClickHouse. No KEV listing or public POC is currently documented, though the vulnerability is technically straightforward to exploit given the detailed advisory.
RemediationAI
Apply the suggested fix by adding getTableColumn() validation to the three unvalidated methods (toSortStatement, toSelectStatement, toGroupByStatement) in StatementGenerator.ts, matching the pattern already implemented in toWhereStatement and the previous GHSA-p5g2-jm85-8g35 fix for _aggregateBy. The fix involves iterating over user-provided keys and throwing a BadDataException for any column name not recognized by the model via this.model.getTableColumn(key) before constructing SQL statements. Monitor the OneUptime GitHub repository at https://github.com/OneUptime/oneuptime and security advisory at https://github.com/OneUptime/oneuptime/security/advisories/GHSA-gcg3-c5p2-cqgg for official patches. As an interim workaround, implement additional input validation at the API layer to restrict sort, select, and groupBy parameters to a whitelist of known-safe column names, or restrict access to analytics endpoints to only highly trusted authenticated users until patches can be deployed. Review ClickHouse audit logs for suspicious analytics queries containing unusual column names or SQL syntax in sort, select, or groupBy parameters.
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in npm
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
This vulnerability affects the OneUptime npm package (pkg:npm/oneuptime), specifically in the StatementGenerator.ts component that constructs ClickHouse SQL queries for analytics data. The root cause is CWE-89 (SQL Injection) stemming from improper neutralization of special elements in SQL commands. ClickHouse Identifier parameters are substituted directly into queries without escaping or quoting, which is safe only for trusted column names. While the earlier GHSA-p5g2-jm85-8g35 fix added validation to the _aggregateBy method via getTableColumn() checks, the same protection was not applied to toSortStatement, toSelectStatement, and toGroupByStatement methods. These methods receive deserialized user input from req.body through BaseAnalyticsAPI.ts without column validation, creating multiple injection vectors. The vulnerability is isolated to ClickHouse analytics data; PostgreSQL data paths remain unaffected as they use separate query construction logic.
Know when PostgreSQL gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
Primary rating from Vendor (https://github.com/OneUptime/oneuptime) · only source for this CVE.
CVSS VectorVendor: https://github.com/OneUptime/oneuptime
Lifecycle Timeline
2DescriptionCVE.org
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, 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:
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:
// 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.
Executive ViewAI
OneUptime deployments face a high-severity SQL injection vulnerability in analytics query processing that allows authenticated users to access, modify, or delete sensitive operational data including logs, metrics, traces, and exceptions. Organizations using OneUptime for monitoring and observability should immediately assess exposure and implement interim controls, as no vendor patch is currently available.
Implement Web Application Firewall (WAF) rules to reject analytics API requests containing non-alphanumeric characters or SQL keywords in sort, select, and groupBy parameters; enforce network segmentation to restrict analytics endpoint access to internal networks only; disable analytics query customization features for non-administrative users; enable comprehensive audit logging and alerting on analytics API access patterns; apply API rate limiting and IP allowlisting to trusted consuming applications. Monitor vendor security advisories closely for patch release.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
SQL injection exploits the way applications construct database queries by mixing user input directly into SQL statements.
Affected Products (CPE)CVE.org
Related Vulnerabilities in ClickHouse SQL Injection Validation
View all 2More in PostgreSQL
View allPostgreSQL libpq functions PQescapeLiteral(), PQescapeIdentifier(), PQescapeString(), and PQescapeStringConn() improperl
An issue was discovered in Appsmith before 1.52. Rated critical severity (CVSS 9.8), this vulnerability is remotely expl
Argument injection vulnerability in PostgreSQL 9.2.x before 9.2.4, 9.1.x before 9.1.9, and 9.0.x before 9.0.13 allows re
Unauthenticated arbitrary file write in Splunk Enterprise (below 10.2.4 and 10.0.7) and Splunk Cloud Platform (below 10.
Unauthenticated SQL injection in Sangoma Switchvox SMB Edition 8.3 (build 104997) lets remote attackers execute arbitrar
PostgreSQL versions before 9.2.22, 9.3.18, 9.4.13, 9.5.8 and 9.6.4 are vulnerable to incorrect authentication flaw allow
The build_tablename function in pgsql.c in the PostgreSQL (aka pgsql) extension in PHP through 5.6.7 does not validate t
A vulnerability in the h2oai/h2o-3 REST API versions 3.46.0.4 allows unauthenticated remote attackers to execute arbitra
In PostgreSQL 9.3 through 11.2, the "COPY TO/FROM PROGRAM" function allows superusers and users in the 'pg_execute_serve
Unauthenticated SQL injection in Vendure Shop API allows remote attackers to execute arbitrary SQL commands against the
Parse Server is an open source http web server backend. Rated critical severity (CVSS 10.0), this vulnerability is remot
Hard-coded default PostgreSQL credentials shipped in the docker-compose.yaml of langgenius Dify through version 1.5.1 al
GHSA-gcg3-c5p2-cqgg
NVD
CVE.org
EPSS
VulDB
Exploit-DB