GHSA-Q825-59PV-RPXW
Authenticated MCP request buffering lacked a body limit before v2.6.0
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-Q825-59PV-RPXW divulgada · CVSS 6.5 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Maintainer verified historical scope (2026-10-18)
Accepted as an already-fixed historical authenticated request-body buffering issue. The source-confirmed affected range is >= 2.4.1, < 2.6.0; the first patched release is v2.6.0 under the shipped production engine/default configuration. This assessment supersedes the original report's claim that default v2.8.4 or v2.9.0 remains unbounded.
The unbounded preclassification ReadAll was introduced by 23d1934099b05b2a01589b48129dc3d3159d91c2 in the middleware preceding authorizeMCPToolRequest. Beginning with a6c2a74b585663dbb378b2878034d97a6713f5ce, first released in v2.6.0, the production Cosy engine applies MaxBytesReader globally before MCP handlers consume the body. The current default is 10 MiB and covers unknown-length and GET bodies. A finite counted-reader probe confirms this inherited limit; no multi-GB body, process OOM or actual outage was tested. Explicitly disabling or greatly increasing the payload cap changes that deployment's resource budget; this does not establish an unfixed default current-version flaw.
No exact published duplicate with this authenticated MCP heap-buffering cause was found. The signed-node temporary-disk exhaustion and MCP parser authorization advisories concern different causes. Current scope metadata has been corrected; the original submitted account is retained below. No CVE was requested or publication performed.
---
Original submission (historical record)
## Summary
`authorizeMCPToolRequest` buffers the entire HTTP request body into memory with an unbounded `io.ReadAll(c.Request.Body)` (`mcp/router.go:126`), before request classification and before the service-token scope check. Any principal that passes MCP authentication — including a read-scope `nui_pat_` service token — can send an arbitrarily large body and exhaust the memory of the single-process server, causing a Go runtime OOM and full outage.
## Root Cause
In `authorizeMCPToolRequest` the body is read with no size limit:
body, err = io.ReadAll(c.Request.Body) // mcp/router.go:126 — no LimitReader / MaxBytesReaderThis read occurs BEFORE `classifyMCPRequest` (~:139) and BEFORE `principal.HasScope(requiredScope)` (~:149). Go's net/http imposes no default request-body cap, and gin's `MaxMultipartMemory` does not apply to `io.ReadAll`. A repo-wide grep shows `MaxBytesReader`/`LimitReader` guards at other sites (nginx private-key upload, cert archive, nodeauth 128MB cap) but none on this path, so the full allocation happens for every authenticated principal regardless of scope.
## Impact
A single contiguous byte-slice allocation grows to the full body size; concurrent requests multiply it → process memory exhaustion → OOM-kill of the single server process = full availability outage (A:H). No confidentiality/integrity impact. PR:L (any valid read-scope token), AC:L (one request).
Proof of Concept
POST /mcp HTTP/1.1
Host: <controller>
Authorization: Bearer nui_pat_<read-scope token>
Content-Type: application/octet-stream
<multi-GB body, e.g. curl --data-binary @big.bin>The body is fully materialized in RAM before the malformed-JSON 400 or the scope rejection can fire.
## Attack Chain
1. Entry: obtain any read-scope MCP service token (or any user token / legacy `X-Node-Secret`), send `POST /mcp` with a multi-GB body.
- Guard: `mcpAuthRequired` (`mcp/router.go:60-116`). Bypass proof: read scope passes authentication; the scope gate is after the vulnerable read (line ~149 > line 126).
2. Sink: `io.ReadAll(c.Request.Body)` at `mcp/router.go:126`.
- Guard: should be a size cap (as `internal/nodeauth/body.go` uses `io.LimitReader`/128MB). Bypass proof: no limiter here; grep shows `LimitReader`/`MaxBytesReader` present elsewhere but absent on this line.
3. Full buffering completes before `classifyMCPRequest` can reject non-JSON (~:139/167) and before `HasScope` (~:149); the malformed-JSON 400 only fires after the allocation.
4. Impact: byte slice grows to the full body size → Go runtime OOM-kill of the single server process = full outage (A:H).
## Bypass Evidence
`grep -rn "MaxBytesReader\|LimitReader\|MaxMultipartMemory"` returns guarded sites, none on `mcp/router.go`; `mcp/router.go:124-146` shows the read strictly precedes both `classifyMCPRequest` and the scope check. Verified present on release v2.8.4: `git show v2.8.4:mcp/router.go` shows `io.ReadAll(c.Request.Body)` at line 126 with no limiter.
## Affected Versions
`<= 2.9.0` (verified byte-identical v2.8.4 → HEAD; no post-release fix).
## Distinction from existing advisories
Distinct from GHSA-j3hg-9rp3-5hw9 (that is `internal/nodeauth/body.go`, UNAUTHENTICATED, staged to a temp file + fsync and already wrapped in `io.LimitReader`). This is `mcp/router.go`, authenticated service token, RAM-buffered, no limiter — different file, auth model, and resource. Distinct from GHSA-x2x3-p8j2-63mx (MCP parser scope-differential authz bug, not resource exhaustion).
## Suggested Fix
Wrap the body read with `http.MaxBytesReader` / `io.LimitReader` using a sane cap, and perform the scope check before buffering the body.
---
Reported by zx (Jace) — GitHub: @manus-use
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/0xJacky/Nginx-UI |
Sin parche | — | — | v1.9.9 no afectada |
2.6.0Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/0xJacky/nginx-ui/security/advisories/GHSA-q825-59pv-rpxwLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
