GHSA-CP4H-7PXC-XX3M
Self-check fix endpoint rewrites live nginx.conf without interactive secure-session step-up
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-CP4H-7PXC-XX3M divulgada · CVSS 5.4 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
## Summary
`POST /api/self_check/:name/fix` triggers a self-check remediation that rewrites the live nginx.conf entry file on disk. The route carries no interactive secure-session (OTP/passkey) step-up, even though every other configuration-to-disk writer in Nginx-UI (settings, config, sites, streams) is gated by `RequireSecureSession`. A 2FA-enabled administrator session (or a leaked/stolen JWT) can therefore mutate the running nginx configuration without the re-authentication the project enforces on equivalent actions.
## Root Cause
The self-check router group is mounted without the step-up middleware:
- `g := r.Group("self_check")` at `api/system/router.go:37` is reached only through `AuthRequired()` + `Proxy()`; it has no `RequireSecureSession`.
- Config-writing siblings (`POST /settings`, `POST /config`, `POST /sites/:name`, stream writers) all carry `RequireSecureSession`.
`SelfCheckFix` → `self_check.AttemptFix(name)` → the task's `FixFunc` → `os.WriteFile(nginx.GetConfEntryPath(), ...)` in `internal/self_check/nginx_conf.go` (e.g. `FixNginxConfIncludeConfD`, `FixNginxConfIncludeSites`, `FixNginxConfIncludeStreams`). The write re-serializes the whole nginx.conf via a gonginx parse→dump round-trip and persists it unconditionally when the expected include directive is absent.
## Impact
Integrity drift of the live nginx configuration surface without the step-up that guards all other config writes (I:L — content constrained to standard `include ...;` directives plus a timestamped `.bak`). A lossy parse/dump round-trip can mangle the existing config so the next reload fails, and `.bak.<ts>` files accrue (A:L). Via `Proxy()` + `X-Node-ID` the same action reaches child cluster nodes.
Proof of Concept
POST /api/self_check/NginxConf-ConfD-Include/fix HTTP/1.1
Host: <controller>
Authorization: Bearer <valid JWT, no fresh X-Secure-Session-ID>The live nginx.conf entry file is re-dumped and an `include .../conf.d/*;` directive injected (or a whole `http{}`/`stream{}` block appended if absent) with no re-authentication prompt.
## Attack Chain
1. Entry: `POST /api/self_check/NginxConf-ConfD-Include/fix` with a valid JWT of a 2FA-enabled admin WITHOUT a fresh `X-Secure-Session-ID`.
- Guard: `AuthRequired()` + `IPWhiteList()` (`api/system/router.go` bare `g` group; `routers.go:123`). Bypass proof: `AuthRequired` only proves JWT possession (no role gate); `IPWhiteList` is a no-op when `AuthSettings.IPWhiteList` is empty (default).
2. Routing: request reaches `SelfCheckFix` → `AttemptFix("NginxConf-ConfD-Include")`.
- Guard: should be `RequireSecureSession` as on config-writer siblings. Bypass proof: the `self_check` group at `api/system/router.go:37` has no middleware; `routers.go:123` mounts `InitPrivateRouter` on bare `g` (`AuthRequired()`+`Proxy()` only).
3. Sink: `FixNginxConfIncludeConfD()` re-serializes and `os.WriteFile`s the live nginx.conf entry file (`internal/self_check/nginx_conf.go`), injecting `include .../conf.d/*;`.
- Guard: none on this path. Bypass proof: write is unconditional once the task runs; no `X-Secure-Session-ID` is demanded, unlike the gated siblings.
4. Impact: live nginx.conf rewritten / conf directories created without the OTP step-up that guards all other config writes.
## Bypass Evidence
`grep` across `api/` shows `RequireSecureSession` present on settings/config/sites/streams writers but absent from both self_check groups. Task registry (`internal/self_check/tasks.go`) confirms the write sinks are reachable through the fixable task keys. Code verified present on release tag v2.8.4: `git show v2.8.4:api/system/router.go` shows `g := r.Group("self_check")` with no step-up.
## Affected Versions
`<= 2.8.4` (verified byte-identical v2.8.4 → HEAD; no post-release fix).
## Suggested Fix
Mount the `self_check` fix routes under `RequireSecureSession` (and `RejectInDemo`) as the other configuration-to-disk writers are, so remediation that rewrites nginx.conf requires a fresh interactive secure session.
---
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 afectada |
2.9.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-cp4h-7pxc-xx3mLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
