/

CVE-2026-42221

Severity:

HIGH RISK

(8.1)

Missing Authentication in Nginx UI

CVE-2026-42221

Analyzed

Vulnerability type

Category:

Missing Authentication

CWE:

CWE-306

Impact:

Unauthorized Administrative Account Creation and Instance Takeover

Severity:

HIGH RISK

(8.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Nginx UI instances from 2.0.0 to before 2.3.8 allow an unauthenticated attacker to create the initial administrator account during the first-run setup process.

Because the public /api/install endpoint does not enforce authentication, a remote attacker who reaches a fresh instance before the legitimate operator can permanently take over that installation.

Affected context

This vulnerability appears in Nginx UI deployments that are in a fresh, uninitialized state and expose the application over a network where untrusted clients can reach the setup interface.

During this initial "first-run" window, the /api/install endpoint is publicly reachable and is intended to bootstrap the first administrator account.

If the service is accessible from broader networks (e.g., internet-exposed, shared internal networks, or container platforms with open ingress), the risk of an attacker racing the legitimate operator increases.

Exploit preconditions

  • Attack surface: Remote over HTTP(S), via the public /api/install endpoint on a fresh Nginx UI instance.
  • Required access: Network-level access to the Nginx UI service before the administrator completes the first-run setup.
  • Trigger point: Sending an installation request to /api/install that specifies the admin email, username, and password while the instance is still in the uninitialized state.
  • Why exploitation is possible: The installation flow implements request encryption for confidentiality but does not require prior authentication or proof of control by the legitimate operator, leaving the first admin creation open to any network client.

Why this happens

The root cause is a missing authentication and authorization check on a critical, state-changing operation: the creation of the initial administrator account via /api/install.

This maps to CWE-306: Missing Authentication for Critical Function, where a function that establishes long-term privileged access is exposed without validating the caller's identity or intent.

The design assumes that the first party reaching the setup endpoint is trusted, but provides no technical guarantee of that assumption, turning a bootstrap convenience into a permanent privilege-escalation vector.

Potential impact

  • An attacker may create the first administrator account and gain full control over the Nginx UI instance.
  • An attacker could configure or modify Nginx server settings, virtual hosts, and reverse proxy rules through the compromised UI.
  • An attacker may introduce malicious configurations, such as traffic redirection, TLS downgrade, or injection of backend endpoints they control.
  • An attacker could lock out the legitimate operator, forcing them to rebuild or redeploy the instance.
  • An attacker may leverage control of the UI-managed Nginx configuration for broader network attacks, such as credential phishing or traffic inspection.

General mitigation guidance

Mitigation patterns focus on enforcing trust boundaries around initial setup and ensuring critical bootstrap flows are not anonymously accessible:

  • Require some form of prior authentication or possession factor before allowing access to the first-run installation endpoint (e.g., setup tokens, instance-local secrets, or OS-level user binding).
  • Restrict the first-run setup interface to a trusted network segment (e.g., localhost-only binding, administrative VPN, or management subnet) by default.
  • Implement a one-time, time-limited installation token generated out-of-band (e.g., on the server console) that must be presented to complete the initial admin creation.
  • Ensure that configuration options controlling listen addresses and exposure of setup endpoints are secure-by-default and documented as part of deployment guidance.
  • Apply least-privilege principles so that, where possible, even a misused UI has limited ability to affect unrelated system components.

How teams detect issues like this

Detection in this context focuses on both code-level review and runtime monitoring:

  • Static analysis / code review:
  • Flag endpoints performing critical state changes (e.g., account creation, role assignment, installation) that lack explicit authentication and authorization checks.
  • Verify that first-run or installation modes are gated by strong preconditions (local-only, token-based, or OS-bound).
  • Look for patterns where "setup" or "install" routes are accessible in the same router or middleware pipeline as public endpoints without additional protections.
  • Configuration and policy checks:
  • Enforce policies that management interfaces must not be internet-exposed by default; use automated scans to identify exposed admin or setup URLs.
  • Integrate security checks into deployment pipelines to ensure Nginx UI is bound to trusted interfaces when running in uninitialized mode.
  • Operational monitoring:
  • Log and alert on first-run install events and the creation of initial admin accounts, especially when they originate from unexpected IP ranges.
  • Use intrusion detection or WAF rules to watch for suspicious access patterns to /api/install on instances expected to be already configured.

Sources

SourceLink
github.comgithub.com/0xJacky/nginx-ui/releases/tag/v2.3.8
github.comgithub.com/0xJacky/nginx-ui/security/advisories/GHSA-h27v-ph7w-m9fp

Frequently asked

questions

Yes, if a fresh Nginx UI instance is reachable from the internet (or any untrusted network) during its first-run window, a remote attacker can exploit this issue by racing the legitimate operator to access the /api/install endpoint.

The attacker only needs network connectivity to the Nginx UI service while it is uninitialized; no prior credentials are required.

Exploitation is essentially a race to be the first party to submit installation data to the setup endpoint.

The most robust pattern is to require a strong, pre-established trust mechanism for initial admin creation, such as a one-time setup token generated on the host, local-only access to the setup interface, or binding installation to an existing OS or identity provider account.

The /api/install endpoint should never accept unauthenticated requests from arbitrary network clients.

Treat all installation and bootstrap flows as security-critical operations:

  • Design them with explicit authentication or possession requirements.
  • Default to local or restricted network exposure during setup.
  • Include security reviews for any "first-run" or "wizard" functionality.
  • Use threat modeling to identify and lock down race-to-bootstrap scenarios where the first actor gains long-term privileged access.
Find out what's already
exploitable in your codebase.