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

GHSA-X62P-38PX-PP73

MCP endpoint /_mcp bypasses ExposureMiddleware, exposing databases, schemas and tables that expose.* was set to hide

Parche disponible
Descargar PNG JSON
CVSS 3.1
5.3
Media
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche el mismo día de la divulgación
Exposición115 dDesde la divulgación, 28 jul 2026, 9:56 p. m.
Detección113 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, automatizable e impacto técnico parcial. Hay versiones corregidas disponibles.
Tranqui, pero que no se quede en el olvido.Ponle etiqueta y a la cola. Ordenadito.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Modificada
Explotación
Remediación
Parche v2.4.1
Monitoreo
Detectada +1
29 jul 26
15 oct 26
19 nov 26
21 nov 26
29 jul 26
27 ago 26
24 sept 26
23 oct 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-X62P-38PX-PP73 divulgada · CVSS 5.3 (GitHub)
Remediación Parche v2.4.1 github.com/prest/prest/v2 · 0 d desde divulgación
Divulgación Modificada Última actualización del registro
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

MCP endpoint (/_mcp) bypasses ExposureMiddleware, ignoring expose.databases/schemas/tables=false in prest/prest

Reporter: CyberSec42 (DevNest UG), reporter handle `lwebmedia`, security@cybersec42.com

Audited artifact: `github.com/prest/prest`, `main` branch, commit `084348fa82701b098492fc520557ff290b7691e2`, which is also the commit tagged as the published release `v2.4.0` (published 2026-07-27), verified 2026-07-27 -- unpatched. prEST is distributed as a Go module and Docker image rather than through npm or PyPI, so the GitHub release tag is cited as the equivalent published-version reference.

Severity: Medium
CVSS 3.1: `AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N` (base score 5.3) -- this vector reflects the project's documented default configuration, `auth.enabled = false` (`config/config.go`, `v.SetDefault("auth.enabled", false)`), under which `/_mcp` requires no authentication at all. On installations that have enabled authentication, the same bypass is still reachable by any authenticated low-privilege caller at `AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N` (base score 4.3).
CWE: CWE-284 (Improper Access Control) / CWE-862 (Missing Authorization for a resource that a control was meant to cover)

Summary

prEST's `[expose]` configuration section is documented, in the project's own shipped sample configuration (`samples/prest.sample.toml`), as controlling "discovery/listing endpoints (as opposed to `[access]`, which controls whether data can be read/written)". An operator who sets `expose.enabled = true` together with `databases = false`, `schemas = false`, and `tables = false` is choosing to hide the database, schema, and table catalog from discovery while still allowing already-known tables to be queried directly.

That intent is enforced correctly for the three legacy REST catalog routes (`GET /databases`, `/schemas`, `/tables`) via `ExposureMiddleware`, which is appended to the single global middleware stack whenever `expose.enabled` is true and denies each of those three routes with HTTP 401 when its corresponding flag is false.

The same protection is not applied to the newer Model Context Protocol endpoint, `/_mcp`. `ExposureMiddleware` gates exactly three hardcoded URL path prefixes (`/databases`, `/tables`, `/schemas`); any other path, including `/_mcp`, falls through unconditionally to the next handler. The three MCP tool handlers that expose the identical catalog data -- `listDatabases`, `listSchemas`, and `listTables` in `controllers/mcp.go` -- never reference the `[expose]` configuration at all; they are gated only by a database-existence check and, for two of the three, by the separate `[access]` permissions ACL, a different configuration surface entirely. As a result, a caller who is correctly denied `GET /databases` still receives the full database, schema, table, and column catalog through `/_mcp`.

The gap is worse than a `tools/call` round trip: a bare, unauthenticated `GET /_mcp` returns a discovery payload that already enumerates every accessible database, schema, and table, with column names embedded in each tool's description, with no JSON-RPC call required.

There is no configuration flag anywhere in `config/config.go` to disable the `/_mcp` route itself, so this bypass cannot be closed from within prEST's own configuration; it can currently only be mitigated by blocking `/_mcp` at a reverse proxy in front of the server.

We note, in fairness to the design, that `listSchemas`, `listTables`, and the other read tools on `/_mcp` (though not `listDatabases`) are also filtered by prEST's separate `[access]` table/field permissions ACL when that ACL is configured with `access.restrict = true`. An operator who additionally enables `access.restrict` therefore already bounds what `/_mcp` can return to what that ACL allows for the caller. `[access].restrict` defaults to false, however, and `[expose]` and `[access]` are documented and configured as two independent, orthogonal controls with no coupling that requires enabling one whenever the other is set -- so an operator who follows the sample configuration's own description of `[expose]` as governing "discovery/listing endpoints" and stops there does not get the protection that description promises.

Data Flow

  1. A caller sends `GET /_mcp` (for the discovery payload) or `POST /_mcp` with a JSON-RPC body such as `{"method":"tools/call","params":{"name":"prest.list_databases"}}` (equivalently `prest.list_schemas` or `prest.list_tables`).
  2. The request traverses the single global middleware stack built in `middlewares.New(cfg)` and wired to the whole router in `app/app.go` (`n := middlewares.New(cfg); n.UseHandler(muxWithAdapter)`). That stack conditionally appends `ExposureMiddleware(cfg.ExposeConf)` only when `cfg.ExposeConf.Enabled`.
  3. `ExposureMiddleware` (`middlewares/middlewares.go`) checks the request path against exactly three literal prefixes -- `/databases`, `/tables`, `/schemas` -- denying with HTTP 401 when the matching flag is false. `/_mcp` matches none of these prefixes, so the middleware calls the next handler unconditionally.
  4. The request reaches the router's `/_mcp` route (`router/router.go`), which only conditionally adds an authentication middleware (`AuthMiddleware`, gated on `cfg.AuthEnabled`) -- never `ExposureMiddleware` -- before dispatching into the MCP handler.
  5. The MCP handler dispatches to `listDatabases`, `listSchemas`, or `listTables` in `controllers/mcp.go`. None of these three functions reference `cfg.ExposeConf` or any equivalent expose-configuration field; the only gating present is a database-existence check and, for two of the three, the separate `[access]` ACL.
  6. The full catalog -- database aliases, schema names, table names, and (via the discovery payload's per-tool descriptions) column names -- is returned to the caller, regardless of the operator's `expose.databases/schemas/tables = false` settings.

Preconditions

  1. The operator has set `expose.enabled = true` together with one or more of `databases = false`, `schemas = false`, `tables = false`, specifically to prevent catalog discovery.
  2. No additional precondition is required to reach `/_mcp` itself in the documented default configuration, since `auth.enabled` defaults to false. On installations with authentication enabled, a valid low-privilege token is sufficient, since none of the three affected MCP handlers apply the `[expose]` control regardless of caller identity.

Location

  • `controllers/mcp.go:327` -- `listDatabases`: no reference to `ExposeConf` anywhere in the function.
  • `controllers/mcp.go:346` -- `listSchemas`: gated only by database existence and the separate `[access]` ACL (`accessibleSchemas`), not by `ExposeConf`.
  • `controllers/mcp.go:394` -- `listTables`: gated only by database existence, not by `ExposeConf`.
  • `middlewares/middlewares.go` -- `ExposureMiddleware`: checks only the three literal prefixes `/databases`, `/tables`, `/schemas`; every other path, including `/_mcp`, falls through via an unconditional call to `next()`.
  • `middlewares/config.go` -- `New(cfg)`: appends `ExposureMiddleware(cfg.ExposeConf)` to the single global middleware stack only when `cfg.ExposeConf.Enabled`; this is the only place `[expose]` is ever enforced anywhere in the codebase.
  • `app/app.go` -- `n := middlewares.New(cfg); n.UseHandler(muxWithAdapter)`: the global middleware stack wraps the entire router, so `/_mcp` does traverse `ExposureMiddleware`, it is simply never matched by any of its three prefix checks.
  • `router/router.go` -- registers `/_mcp` (`GET`, `POST`) via a route wrapper that only conditionally adds an authentication middleware when `cfg.AuthEnabled`; `ExposureMiddleware` is never added to this route.
  • `config/config.go` -- no configuration key exists to disable the `/_mcp` route itself (confirmed by search); `auth.enabled` and `expose.enabled` both default to `false`.
  • `samples/prest.sample.toml` -- the shipped sample configuration's own comment on the `[expose]` section: "control discovery/listing endpoints (as opposed to `[access]`, which controls whether data can be read/written)" -- the general claim this finding shows is not fulfilled for the `/_mcp` discovery/listing surface.

Proof of Concept

Source-only review; no live prEST instance or database was contacted. Reproduced locally as a static/structural proof against the exact commit in a local clone (no network access to any deployed target, no external system touched):

git clone https://github.com/prest/prest.git
cd prest
git rev-parse HEAD
# 084348fa82701b098492fc520557ff290b7691e2  (== tag v2.4.0)

# 1. Confirm ExposureMiddleware's enforcement is limited to three literal prefixes:
grep -n "HasPrefix" middlewares/middlewares.go
# -> only "/databases", "/tables", "/schemas" are checked; the function ends with
#    an unconditional next(rw, rq) for any other path.

# 2. Confirm the MCP route never receives ExposureMiddleware:
grep -n "mcpRoute\|ExposureMiddleware" router/router.go
# -> mcpRoute only conditionally wraps AuthMiddleware; ExposureMiddleware does not
#    appear anywhere in router.go.

# 3. Confirm the three MCP catalog handlers never reference ExposeConf:
grep -n "ExposeConf" controllers/mcp.go
# -> no output (zero matches) for the entire file, including listDatabases (line 327),
#    listSchemas (line 346), and listTables (line 394).

# 4. Confirm the vendor's own sample configuration frames [expose] as covering
#    discovery/listing endpoints in general, not three named REST routes:
grep -n -A2 "\[expose\]" samples/prest.sample.toml

Illustrative request sequence an attacker-modeled scenario would follow once the precondition holds (fabricated example values, no real target or system contacted):

# Operator configuration (example values):
# [expose]
# enabled  = true
# databases = false
# schemas   = false
# tables    = false

GET /databases
# -> 401 Unauthorized, "unauthorized listing" -- ExposureMiddleware correctly denies this.

GET /_mcp
# -> 200 OK, JSON discovery payload enumerating every accessible database, schema,
#    and table, with column names present in each tool's description -- the exact
#    catalog the operator configured [expose] to hide, returned in full through the
#    unguarded route.

Remediation

  • Apply the same `ExposeConf` checks used by `ExposureMiddleware` (`databases`, `schemas`, `tables`) inside `listDatabases`, `listSchemas`, and `listTables` in `controllers/mcp.go`, or extend `ExposureMiddleware`'s path matching to also cover `/_mcp` JSON-RPC method names (`prest.list_databases`, `prest.list_schemas`, `prest.list_tables`) and the discovery-payload (`GET /_mcp`) response.
  • Add test coverage in `controllers/mcp_test.go` and the integration suite asserting that `/_mcp` respects `expose.databases/schemas/tables = false`, mirroring the existing `TestExposureMiddleware_DatabasesDenied/_SchemasDenied/_TablesDenied` tests that currently only cover the REST routes.
  • Consider factoring `[expose]` enforcement into a single shared check invoked by every handler that returns catalog metadata (REST and MCP alike), rather than re-implementing the same three-flag check independently per route family, since that duplication is how this route was missed.
  • Document, for operators relying on `[expose]` for catalog confidentiality, that it is currently scoped only to the three legacy REST routes, and that `[access].restrict = true` should additionally be enabled if catalog-name secrecy on `/_mcp` is required until the fix ships.

Scope and safety

Source-only static review of the public repository at the commit above. No live prEST instance, database, or network target was contacted; no request was sent to any deployed system. All configuration values, request examples, and payloads shown above are fabricated for illustration only. This review was performed strictly read-only: no issue, pull request, comment, branch, or advisory was opened or modified on GitHub or any other system.

Requests

Coordinated fix, followed by a request for a CVE identifier, with public credit to CyberSec42 (reporter `lwebmedia`).

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:N
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:L
AltoBajoNinguno
IntegridadI:N
AltoBajoNinguno
DisponibilidadA:N
AltoBajoNinguno
Score de explotaciónQué tan fácil y probable es que la exploten
10.0/ 10Muy alto
Vector 10.0 (muy fácil) · sin evidencia de explotación.
Versiones

Rangos afectados

Afectada Corregida Última
github.com/prest/prest/v2≤ 2.4.0
2.4.0
v2.5.3
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
gogithub.com/prest/prest/v2
Corregida v2.4.1 0 d v2.5.3 no afectada
Versiones corregidasv2.4.1
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-x62p-38px-pp73

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