llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Go · github.com/prest/prest

GHSA-R867-GHGV-MRP9

pREST executes DELETE and PUT against whole tables when the query string is empty - a single request with a valid token and no WHERE condition wipes or rewrites every row

Sin parche publicado
Descargar PNG JSON
CVSS 3.1
8.1
Alta
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición21 dDesde la divulgación, 30 oct 2026, 10:40 a. m.
Detección20 dDesde la divulgación hasta su ingreso al índice
Decisión estimadaSeguir
Remediar en la ventana regular de mantenimiento
Estimación de Llama con el árbol SSVC de CISA a partir de vector CVSS 3.1 y la evidencia de explotación (sin evaluación oficial): sin explotación conocida, no automatizable e impacto técnico parcial. No hay versión corregida: aplique mitigaciones.
Seguimiento de cerca: yo sé de mirar de cerca.Agéndala y deja de pensar en ella.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
30 oct 26
19 nov 26
21 nov 26
30 oct 26
5 nov 26
10 nov 26
16 nov 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-R867-GHGV-MRP9 divulgada · CVSS 8.1 (GitHub)
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés
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) translates request query parameters into SQL WHERE clauses. Its DELETE and PUT controllers append the WHERE clause only when one is present (`src/controllers/crud.go`, Delete: `sql := DeleteSQL(...); if where != "" {...}`; Update is the same shape) - a request with no query parameters executes a bare `DELETE FROM "db"."schema"."table"` or an unscoped `UPDATE` against the entire table. There is no row-count limit, no requirement for a condition, and no confirmation parameter. Verified on a live v2.4.2 instance with authentication enabled: `DELETE /{db}/{schema}/t2` with no query string returned `{"rows_affected":3}` (HTTP 200) and a direct SQL check confirmed the table was empty - three rows destroyed by one request; the same request with `?id=1` correctly targets one row. In the default `access.restrict=false` mode `TablePermissions` returns true for every table and `FieldsPermissions` skips field filtering for delete operations entirely, so any token that can write one table can wipe it. The request needs only a valid write-capable token (or no token at all in the default unauthenticated mode), which makes this reachable not just by attackers but by ordinary client bugs: one proxy that strips a query string, one template that drops its filters, and the table is gone.

Details

The unscoped-write control flow:

# src/controllers/crud.go - Delete
#   sql := DeleteSQL(...)
#   if where != "" {          // WHERE appended only when the query string yields one
#       sql = fmt.Sprintf("%s WHERE %s", sql, where)
#   }
# src/controllers/crud.go - Update: same `if where != ""` shape for SET/WHERE
# src/adapters/postgres/postgres.go - TablePermissions
#   access.restrict=false (default) -> returns true for any table
#   FieldsPermissions: delete operations skip field filtering entirely

This is distinct from the known SQLi class (CVE-2025-58450, path-parameter injection, no fixed release): no injection is involved here. The SQL is fully parameterized and the identifiers pass `validatePathSegments`/`ident.IsSafeSegment` (we verified the injection class is mitigated on v2.4.2) - the database faithfully executes exactly the destructive statement the empty query string implies. The authentication-enabled deployment does not change the outcome: any valid token with write permission on the table triggers the same unscoped execution.

Proof of concept

The instance is pREST v2.4.2 (source-built, Go) in front of PostgreSQL 16, `PREST_AUTH_ENABLED=true`, table `pr6cr4_api.t2` holding 3 rows, caller holds a valid JWT:

#!/usr/bin/env bash
BASE=http://127.0.0.1:21990

# step 1: unscoped DELETE - no query parameters at all
curl -s -X DELETE -H "Authorization: Bearer $TOKEN" "$BASE/pr6cr4db/pr6cr4_api/t2"

# step 2: confirm server-side that the table is empty
psql -h 127.0.0.1 -U postgres -c "SELECT count(*) FROM pr6cr4_api.t2"

# step 3 (control): the same endpoint with a condition targets one row
#   (re-seed the table with a few rows first - step 1 wiped it)
curl -s -X DELETE -H "Authorization: Bearer $TOKEN" "$BASE/pr6cr4db/pr6cr4_api/t2?id=1"

Captured output from the running instance (verbatim from the retained probe log):

## F2: unscoped DELETE (JWT valid, no WHERE)
$ curl -X DELETE -H "Authorization: Bearer \$TOK" /pr6cr4db/pr6cr4_api/t2
{"rows_affected":3} [200]  # psql: SELECT count(*) FROM t2 -> 0 (table wiped, no condition)

Output interpretation: the API executed `DELETE FROM "pr6cr4db"."pr6cr4_api"."t2"` with no WHERE clause and reported the destroyed row count as a normal success response. The `?id=1` control confirms the parameterized path works when a condition is present, isolating the defect to the missing unscoped-write guard rather than the SQL layer. Table and token names are instance-specific; the stable verdict is the unscoped DELETE/PUT execution on empty query strings.

Impact

Unauthenticated (default mode) or single-token (authentication enabled) destruction or wholesale rewrite of any permitted table (CWE-284): one request without a query string erases every row, with no limit, no confirmation, and no audit friction beyond pREST's own logs - reachable by an attacker with any leaked or low-privilege write token, and equally by routine client defects such as a proxy stripping the query string. In the default `access.restrict=false` mode the blast radius is every table in every exposed schema. A fix is to reject DELETE/PUT without a WHERE condition (HTTP 400) or require an explicit opt-in parameter, and to enforce a row-count ceiling on unscoped writes.

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:L
BajaAlta
PrivilegiosPR:L
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:N
AltoBajoNinguno
IntegridadI:H
AltoBajoNinguno
DisponibilidadA:H
AltoBajoNinguno
Score de explotaciónQué tan fácil y probable es que la exploten
8.3/ 10Alto
Vector 8.3 (muy fácil) · sin evidencia de explotación.
Versiones

Rangos afectados

Afectada Corregida Última
github.com/prest/prest< 2.5.3
v1.5.5
2.5.3
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
gogithub.com/prest/prest
Sin parche — — v1.5.5 afectada
Versiones corregidas2.5.3
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/prest/prest/security/advisories/GHSA-r867-ghgv-mrp9

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.