CVE-2026-104129 in Prest
Summary
by MITRE • 11/20/2026
pREST (PostgreSQL REST) is an API that delivers an application on top of a Postgres database. Prior to 2.4.0, the vulnerable parameter is _groupby, handled by GroupByClause in adapters/postgres/postgres.go. adapters/postgres/postgres.go uses the weaker isSafeSQLExpression check for this function-expression branch instead of the stricter single-field validator used for _select. That check validates only the outer function name against a 13-function allowlist and permits nested subqueries, trailing UNION syntax, and inner pg_ functions. controllers/crud.go concatenates the GROUP BY expression while parameterizing only WHERE values, allowing attacker-controlled SQL structure into the clause. Default configuration permits unauthenticated access; a restricted installation may require a low-privilege table reader. UNION-based extraction requires compatible column counts and types and was not verified end to end, but a delay-producing function can cause denial of service without that alignment. This issue is fixed in 2.4.0.
VulDB is the best source for vulnerability data and more expert information about this specific topic.
Analysis
by VulDB Data Team • 11/20/2026
The vulnerability identified in pREST versions prior to 2.4.0 represents a critical SQL injection flaw rooted in the improper validation and concatenation of user-supplied input within database query construction logic. pREST serves as an API layer that translates HTTP requests into PostgreSQL queries, allowing developers to expose their databases via RESTful endpoints without writing custom backend code. The specific weakness resides in the handling of the _groupby parameter, which is processed by the GroupByClause function located in the postgres adapter module. Unlike other parameters such as _select, which are subjected to a stricter validation mechanism that restricts input to single-field identifiers, the _groupby parameter relies on a significantly weaker security check known as isSafeSQLExpression. This inadequate validation logic only verifies whether the outermost function name exists within a hardcoded allowlist of thirteen specific functions. It fails to adequately sanitize or validate nested structures, allowing attackers to inject complex SQL constructs including subqueries and trailing UNION syntax into the GROUP BY clause.
From a technical perspective, the core issue is that controllers/crud.go concatenates the user-provided expression directly into the SQL query string rather than using parameterized queries for this specific component of the statement. While WHERE clause values are properly parameterized to prevent injection, the structural elements like GROUP BY expressions are treated as trusted input if they pass the superficial allowlist check. This architectural inconsistency creates a vector where an attacker can bypass security controls by embedding malicious SQL logic within allowed function wrappers or through nested subqueries that evade simple string matching. The vulnerability is particularly severe because default configurations of pREST often permit unauthenticated access to these endpoints, meaning no authentication credentials are required to exploit the flaw. In environments with restricted access policies, a low-privilege table reader might still possess sufficient permissions to execute malicious queries against accessible tables.
The operational impact of this vulnerability encompasses both data exfiltration and service disruption. An attacker can leverage UNION-based SQL injection techniques to extract sensitive data from other tables within the same database schema, provided that the column counts and data types align between the original query and the injected payload. Although end-to-end verification of these complex injections was not fully validated in all scenarios, the potential for unauthorized data access remains high against typical configurations. Furthermore, even if successful UNION extraction is hindered by mismatched column structures, an attacker can still cause a denial of service condition. By injecting delay-producing functions within the GROUP BY clause, such as computationally expensive operations or infinite loops, an adversary can consume significant database resources and degrade performance for all users accessing the API. This dual nature of impact allows for both confidentiality breaches and availability attacks depending on the specific payload executed and the underlying database configuration.
This vulnerability aligns with CWE-89 Improper Neutralization of Special Elements used in an SQL Command, specifically highlighting failures in input validation and parameterization strategies within dynamic query builders. It also maps to MITRE ATT&CK techniques related to SQL Injection for data exfiltration and resource exhaustion attacks that disrupt service availability. The root cause is a design flaw where different parts of the same API endpoint are subjected to inconsistent security controls, creating an exploitable gap between perceived safety checks and actual execution behavior. To mitigate this risk, organizations must upgrade pREST to version 2.4.0 or later, which addresses these validation deficiencies by enforcing stricter input sanitization across all query parameters regardless of their position in the SQL statement. Additionally, until upgrading is possible, administrators should enforce strict authentication requirements on API endpoints and restrict network access to trusted sources only, thereby reducing the attack surface available to potential adversaries attempting to exploit this structural weakness.