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

GHSA-2RJR-44WX-8QPG

JwtSecret Overwrite via Settings API Causes Session Invalidation and Monopoly

Sin parche publicado
Descargar PNG JSON
CVSS 3.1
3.8
Baja
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:L/A:L Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición8 dDesde la divulgación, 12 nov 2026, 4:38 a. m.
Detección6 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
12 nov 26
18 nov 26
20 nov 26
12 nov 26
14 nov 26
16 nov 26
18 nov 26
20 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-2RJR-44WX-8QPG divulgada · CVSS 3.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

An administrator session or an `api:write` service token could overwrite `JwtSecret` through the app settings write. That invalidates every issued session at once, and the change persists in app.ini. Users can sign in again immediately, because sessions are issued and checked with the current secret, so this is a recoverable forced logout rather than an exclusive takeover.

Patches

Fixed in 2.9.1 (fecb2a8d71 https://github.com/0xJacky/nginx-ui/commit/fecb2a8d71): settings writes always keep the saved JwtSecret; it can only be changed in app.ini.

Workarounds

Limit `api:write` tokens to trusted automation.

---

Original report

The maintainer narrowed the following points: the prerequisite is an administrator-equivalent credential rather than "any authenticated user"; "session monopoly" and "recovery requires direct server access" do not hold, since other users can sign in again right away.

Summary

The JwtSecret field in the cosy framework's App struct lacks the `protected:"true"` tag, allowing any authenticated user to overwrite it via `POST /api/settings/app`. This immediately invalidates ALL existing JWT sessions and allows the attacker to monopolize access. This is a regression — the v1 struct had `protected:"true"` on JwtSecret, and `restore.go` still treats it as a protected field.

Details

The `JwtSecret` field in the cosy framework's App struct lacks the `protected:"true"` tag, allowing any authenticated user to overwrite it via `POST /api/settings/app`. This immediately invalidates ALL existing JWT sessions (since they were signed with the old secret), and the attacker can log in again to hold the only valid session.

Evidence This Is a Regression

  1. The v1 struct (`settings/server_v1.go` line 19) had `protected:"true"` on JwtSecret — it was removed during the cosy framework migration.
  1. The restore function (`settings/restore.go` lines 20-27) explicitly lists JwtSecret in `protectedFields`:
protectedFields: map[string]struct{}{
    "JwtSecret": {},
}

This proves the maintainer knows JwtSecret needs protection.

  1. Inconsistency with other protected fields:

| Field | Has `protected:"true"` | Controls |
|-------|----------------------|----------|
| `Terminal.StartCmd` | YES | Command execution |
| `Logrotate.CMD` | YES | Command execution |
| `Crypto.Secret` | YES | Encryption key |
| `Casdoor.*` (all fields) | YES | SSO authentication |
| `OIDC.*` (all fields) | YES | SSO authentication |
| `JwtSecret` | NO | ALL JWT authentication |

JwtSecret, which controls the validity of every session in the system, is the only authentication-critical field missing protection.

Note on Token Forgery

Direct JWT forgery does NOT work because `GetTokenUser()` (`internal/user/user.go` lines 161-185) performs a dual check: JWT signature validation AND exact token string lookup in the `auth_tokens` database table. A forged JWT with a valid signature but no matching DB row is rejected. The real impact is session invalidation and monopoly, not token forgery.

Proof of concept

Step 1: Login as any user and note the JWT token.

Step 2: Overwrite JwtSecret:

POST /api/settings/app
Content-Type: application/json
Authorization: Bearer <jwt>

{"jwt_secret": "attacker-controlled-secret"}

Result: HTTP 200 — accepted.

Step 3: Verify ALL existing sessions are killed:

GET /api/users
Authorization: Bearer <old-jwt>

Result: HTTP 403 — session invalidated.

Step 4: Verify other sensitive fields ARE correctly protected (proving this is a gap):

POST /api/settings/terminal
Content-Type: application/json

{"start_cmd": "/bin/evil"}

Result: Terminal.StartCmd remains unchanged — `protected:"true"` works correctly on other fields.

Step 5: Login again — the attacker is now the only user with a valid session.

Step 6: Verify persistence — survives server restarts:

cat /etc/nginx-ui/app.ini | grep JwtSecret
# JwtSecret = attacker-controlled-secret

Full automated PoC tested on Docker (nginx-ui latest).

Impact
  • Immediate session invalidation for ALL users (Denial of Service)
  • Session monopoly — attacker is the only user with valid access after re-login
  • Persistent — written to `app.ini`, survives server restarts
  • Recovery requires direct server access — other admins must SSH in and manually edit `app.ini` to restore access. In cloud/containerized deployments, this may require infrastructure-level intervention.

Suggested Fix

Add `protected:"true"` to the `JwtSecret` field in the cosy App struct, consistent with:
- How it was protected in the v1 struct (`settings/server_v1.go` line 19)
- How `restore.go` treats it as protected (lines 20-27)
- How all other security-critical fields (`Terminal.StartCmd`, `Logrotate.CMD`, `Crypto.Secret`, Casdoor/OIDC) are protected

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:H
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:N
AltoBajoNinguno
IntegridadI:L
AltoBajoNinguno
DisponibilidadA:L
AltoBajoNinguno
Versiones

Rangos afectados

Afectada Corregida Última
github.com/0xJacky/Nginx-UI< 2.9.1
v1.9.9
2.9.1
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.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/0xJacky/nginx-ui/security/advisories/GHSA-2rjr-44wx-8qpg

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