llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Go · github.com/0xJacky/Nginx-UI

GHSA-97PJ-XRFH-GCFM

WebSocket short tokens still authenticate the HTTP MCP endpoint (incomplete fix of GHSA-gp79-j356-rr7m)

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:H/I:H/A:N Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición29 dDesde la divulgación, 22 oct 2026, 1:59 a. m.
Detección27 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
22 oct 26
18 nov 26
20 nov 26
22 oct 26
29 oct 26
6 nov 26
13 nov 26
20 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-97PJ-XRFH-GCFM 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

Class: authentication bypass (CWE-287 improper authentication) — incomplete fix of GHSA-gp79-j356-rr7m

Details

Repository `0xJacky/nginx-ui`, file `mcp/router.go` lines 87–91 (`mcpAuthRequired`), unfixed at HEAD `d875dbd2` (v2.8.4). A second authentication middleware still accepts a 16-character WebSocket short token as an HTTP `Authorization: Bearer` credential on `POST /mcp` and `POST /mcp_message`. The GHSA-gp79-j356-rr7m fix removed this branch from `AuthRequired()` only.

Summary

The fix for GHSA-gp79-j356-rr7m (commit 1b022804ea20e99053f1a0514416c851f1f34d1d) removed the short-token branch from the general HTTP middleware `AuthRequired()` in `internal/middleware/middleware.go` and replaced it with an explicit rejection:

// internal/middleware/middleware.go:284-288 (fixed)
if len(token) <= 16 {
    // Short tokens are only valid on AuthRequiredWS routes.
    abortWithAuthFailure()
    return
}

The advisory's own regression test encodes the invariant in its name: `TestShortTokenOnlyAuthenticatesWebSocketRoutes` (`api/user/short_token_security_test.go`). The fix did not touch `mcpAuthRequired()`, a separate authentication middleware used by the MCP endpoints, which still contains the identical pre-fix short-token branch:

// mcp/router.go:82-97 (still present at HEAD d875dbd2)
if token != "" {
    var (
        currentUser *model.User
        ok          bool
    )
    if len(token) <= 16 {
        currentUser, ok = user.GetTokenUserByShortToken(token)   // <-- sink
    } else {
        currentUser, ok = user.GetTokenUser(token)
    }
    if ok {
        c.Set("user", currentUser)
        c.Next()
        return
    }
}

`mcp.InitRouter` is registered unconditionally (`router/routers.go:69`) with no feature flag, so the endpoint is reachable whenever nginx-ui is. The fix's file list (api/user/auth.go, api/user/short_token.go, internal/middleware/middleware.go, internal/user/*, model/user.go) does not include mcp/router.go, which was last modified by the earlier MCP parser fix (66471391) and is unchanged at HEAD.

Impact

A party holding a WebSocket short token (the same pre-requisite as GHSA-gp79-j356-rr7m) can authenticate to the HTTP MCP endpoint and invoke MCP management tools. `authorizeMCPToolRequest()` classifies each call: read-classified tools (`nginx_config_get`, `nginx_config_list`, `nginx_status`, …) require no secure session, so a short token reaches them directly. For an account without OTP/passkey, `userNeedsSecureSession()` returns false, so even write-classified tools (`nginx_config_add`, `nginx_config_modify`, `reload_nginx`, `restart_nginx`) clear `RequireSecureSession` — the same escalation path that made the original advisory HIGH. This is the residual "access management APIs" half of GHSA-gp79-j356-rr7m; the "renew after logout" half is fixed by the session binding, and this sink is distinct from the `AuthRequired` sink that was fixed.

PoC

Executed against HEAD d875dbd2 with the source-built test `mcp/router_shorttoken_proof_test.go`:

GOWORK=off go test -tags=unembed -run TestMCPAcceptsWebSocketShortTokenOnHTTP ./mcp/ -v

The test mints a normal login session for a non-OTP user and reads the paired 16-character short token from the `AuthToken` row, then sends it to three routes. Observed output:

control (garbage token) status=403 body={"message":"Authorization failed"}
short-token AuthRequired /api/nginx/status status=403
short-token /mcp_message status=400 body={"jsonrpc":"2.0","id":null,"error":{"code":-32602,"message":"Missing sessionId"}}

Line 1 shows the endpoint rejects a bad credential. Line 2 shows the same short token is correctly rejected (403) by the fixed `AuthRequired()`. Line 3 shows the same short token is accepted on `POST /mcp_message` — the request passed `mcpAuthRequired` and reached the MCP server, which only reports the missing transport `sessionId`. A caller completes the MCP `initialize` handshake to obtain a `sessionId` and then dispatches tools with the same short token.

Suggested fix

Apply the same rejection in `mcpAuthRequired()`:

if len(token) <= 16 {
    c.AbortWithStatusJSON(http.StatusForbidden, gin.H{"message": "Authorization failed"})
    return
}
u, ok := user.GetTokenUser(token)

Preferably, centralise short-token resolution behind a single helper that only `AuthRequiredWS` may call, so a future authentication middleware cannot reintroduce the branch. A regression test should assert the short token is rejected on `/mcp` and `/mcp_message` as it already is on `AuthRequired` routes.

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:H
AltoBajoNinguno
IntegridadI:H
AltoBajoNinguno
DisponibilidadA:N
AltoBajoNinguno
Versiones

Rangos afectados

Afectada Corregida Última
github.com/0xJacky/Nginx-UI< 2.9.0
v1.9.9
2.9.0
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
gogithub.com/0xJacky/Nginx-UI
Sin parche — — v1.9.9 afectada
Versiones corregidas2.9.0
Explotación

Arsenal público

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

Referencias
Advisoryhttps://github.com/0xJacky/nginx-ui/security/advisories/GHSA-97pj-xrfh-gcfm

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