CVE-2026-42221: Nginx-UI Unauthenticated First-Run Installer Allows Remote Vulnerability

HIGH
Advisory Identifier: GHSA-h27v-ph7w-m9fp
CVSS 8.1
CWE-306
Published
Advisory Summary

CVE-2026-42221 is a HIGH (CVSS 8.1) unauthenticated first-run installer allows remote vulnerability (CWE-306: Missing Authentication for Critical Function) affecting Nginx-UI libraries in the Go ecosystem. The issue involves unauthenticated first-run installer allows remote initial admin claim. Remediation is available by upgrading affected packages to version 2.3.8.

CVE-2026-42221 at a Glance

CVE Identifier CVE-2026-42221
GHSA Identifier GHSA-h27v-ph7w-m9fp
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-306: Missing Authentication for Critical Function
Affected Product Nginx-UI
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 8.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-42221

To remediate this vulnerability, upgrade all affected Nginx-UI dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/0xJacky/Nginx-UI fixed: 2.3.8
Upgrade github.com/0xJacky/Nginx-UI to 2.3.8
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/0xJacky/Nginx-UI

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-42221, inspect your project dependencies for Nginx-UI:

inspect dependencies for github.com/0xJacky/Nginx-UI

Analyze the terminal output to locate any version of Nginx-UI in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.3.8), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-306: Missing Authentication for Critical Function, where the product does not perform any authentication for functionality that requires a provable user identity or consumes a significant amount of resources. In Nginx-UI, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary An unauthenticated network attacker can claim the initial administrator account on a fresh `nginx-ui` instance during the first-run setup window. The public `/api/install` endpoint is reachable without authentication, and the request-encryption flow only protects payload confidentiality in transit; it does not authenticate who is allowed to perform installation. A remote attacker who reaches the service before the legitimate operator can set the admin email, username, and password, causing permanent initial-instance takeover. ### Details The vulnerable route is exposed publicly through the main API router. `router/routers.go:61-70` mounts `system.InitPublicRouter(root)` under `/api`, and `api/system/router.go:16-19` registers both `GET /api/install` and `POST /api/install` without `AuthRequired()`. The install handler only checks whether the instance is already installed and whether more than ten minutes have elapsed since startup. `api/system/install.go:26-33` treats the instance as uninstalled when `JwtSecret` is empty and `SkipInstallation` is false. `api/system/install.go:56-69` rejects requests only if installation has already happened or the ten-minute window has expired. If those checks pass, the unauthenticated caller controls the initialization flow. `api/system/install.go:77-81` generates and saves the JWT secret, node secret, and certificate email from attacker-controlled input, and `api/system/install.go:93-97` overwrites user ID `1` with the attacker-chosen username and password hash. `internal/kernel/init_user.go:15-22` guarantees that privileged user ID `1` exists ahead of time, so there is always an account to claim. The public-key bootstrap does not add authentication. `api/crypto/router.go:5-9` exposes `POST /api/crypto/public_key` publicly, `api/crypto/crypto.go:12-32` returns a server public key to any caller, `internal/crypto/crypto.go:44-61` stores a shared keypair in cache, and `internal/middleware/encrypted_params.go:25-50` only decrypts `encrypted_params` before passing the request to the install handler. No request ID, local-only restriction, bootstrap secret, or prior trust check is enforced. This was verified locally in an isolated lab instance. A fresh instance returned `{"lock":false,"timeout":false}`, an unauthenticated `POST /api/install` returned `{"message":"ok"}`, the instance then flipped to `{"lock":true,"timeout":false}`, and the on-disk SQLite database showed user ID `1` renamed to the attacker-controlled username with a non-empty password hash. ### PoC The quickest local verification path is the helper script created during validation: ```bash ATTACKER_EMAIL='attacker@example.com' ATTACKER_USER='attacker' ATTACKER_PASS='Password12345' \ '/Users/r1zzg0d/Documents/CVE hunting/targets/nginx-ui/output/verify/verify_fresh_install_takeover.sh' ``` Expected proof points: ```text [1/6] Fresh-instance status: { "lock": false, "timeout": false } [3/6] Claiming the initial administrator account... { "message": "ok" } [4/6] Verifying install is now locked... { "lock": true, "timeout": false } [5/6] Verifying the on-disk admin record was overwritten... { "id": 1, "name": "attacker", "password_len": 60 } ``` To confirm the final state manually: ```bash sqlite3 '/Users/r1zzg0d/Documents/CVE hunting/targets/nginx-ui/tmp/poc-install-takeover/database.db' \ 'select id,name,length(password) from users where id=1;' ``` Expected output: ```text 1|attacker|60 ``` Manual HTTP reproduction is also straightforward: 1. Request `GET /api/install` and confirm `lock=false` and `timeout=false`. 2. Request `POST /api/crypto/public_key` to obtain the public RSA key. 3. Encrypt `{"email":"attacker@example.com","username":"attacker","password":"Password12345"}` with that public key and base64-encode the ciphertext. 4. Submit the ciphertext to `POST /api/install` as `{"encrypted_params":"..."}`. 5. Re-request `GET /api/install` and observe that `lock=true`. 6. Inspect the backing database and confirm user ID `1` now belongs to the attacker-controlled username. ### Impact This is an authentication bypass / initial admin claim vulnerability affecting fresh, uninitialized instances that are reachable over the network during the installation window. Any attacker able to reach the service before the legitimate operator can permanently take ownership of the first administrator account and thereby seize control of the application. Because `nginx-ui` is an administrative interface for Nginx and related host-management features, compromise of the initial admin account can lead to unauthorized configuration changes, certificate management abuse, backup manipulation, service disruption, and broader operational takeover of the managed environment. ### Remediation 1. Require a single-use bootstrap secret for installation. Generate the token locally on first start, print it only to the server console or write it to a root-owned local file, and require it on `POST /api/install`. 2. Restrict installation endpoints to loopback by default until setup completes. Remote setup should require an explicit opt-in configuration flag, not be enabled automatically on all interfaces. 3. Make installer claim atomic and explicitly stateful. Persist a dedicated installation state record, consume the bootstrap token exactly once, and refuse concurrent or repeated initialization attempts even within the startup window.

CVE-2026-42221 Affected Nginx-UI Versions

1 component(s)
Fixed Versions:
2.3.8
Product / Package Ecosystem Affected Versions Fixed Version
github.com/0xJacky/Nginx-UI
Go
≥ 2.0.0
< 2.3.8
2.3.8

References

Frequently Asked Questions

What is CVE-2026-42221?
CVE-2026-42221 is a security vulnerability in Nginx-UI involving Unauthenticated First-Run Installer Allows Remote Initial Admin Claim under CWE-306: Missing Authentication for Critical Function.
Which Nginx-UI versions are affected?
Affected versions include releases prior to 2.3.8 across affected packages: github.com/0xJacky/Nginx-UI.
What version fixes CVE-2026-42221?
Upgrading to 2.3.8 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/0xJacky/Nginx-UI affected?
Yes, github.com/0xJacky/Nginx-UI is affected in releases prior to 2.3.8. Upgrade your dependency to 2.3.8 or later.
What is the CVSS score of CVE-2026-42221?
CVE-2026-42221 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-42221?
CVE-2026-42221 is classified under CWE-306: Missing Authentication for Critical Function (The product does not perform any authentication for functionality that requires a provable user identity or consumes a significant amount of resources.).
How can I check Go dependencies for CVE-2026-42221?
Run the dependency tree command: 'inspect dependencies for github.com/0xJacky/Nginx-UI'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-h27v-ph7w-m9fp",
  "modified" : "2026-05-06T16:59:00Z",
  "published" : "2026-05-06T16:59:00Z",
  "aliases" : [ "CVE-2026-42221" ],
  "summary" : "Nginx-UI: Unauthenticated First-Run Installer Allows Remote Initial Admin Claim",
  "details" : "### Summary\nAn unauthenticated network attacker can claim the initial administrator account on a fresh `nginx-ui` instance during the first-run setup window. The public `/api/install` endpoint is reachable without authentication, and the request-encryption flow only protects payload confidentiality in transit; it does not authenticate who is allowed to perform installation. A remote attacker who reaches the service before the legitimate operator can set the admin email, username, and password, causing permanent initial-instance takeover.\n\n### Details\nThe vulnerable route is exposed publicly through the main API router. `router/routers.go:61-70` mounts `system.InitPublicRouter(root)` under `/api`, and `api/system/router.go:16-19` registers both `GET /api/install` and `POST /api/install` without `AuthRequired()`.\n\nThe install handler only checks whether the instance is already installed and whether more than ten minutes have elapsed since startup. `api/system/install.go:26-33` treats the instance as uninstalled when `JwtSecret` is empty and `SkipInstallation` is false. `api/system/install.go:56-69` rejects requests only if installation has already happened or the ten-minute window has expired.\n\nIf those checks pass, the unauthenticated caller controls the initialization flow. `api/system/install.go:77-81` generates and saves the JWT secret, node secret, and certificate email from attacker-controlled input, and `api/system/install.go:93-97` overwrites user ID `1` with the attacker-chosen username and password hash. `internal/kernel/init_user.go:15-22` guarantees that privileged user ID `1` exists ahead of time, so there is always an account to claim.\n\nThe public-key bootstrap does not add authentication. `api/crypto/router.go:5-9` exposes `POST /api/crypto/public_key` publicly, `api/crypto/crypto.go:12-32` returns a server public key to any caller, `internal/crypto/crypto.go:44-61` stores a shared keypair in cache, and `internal/middleware/encrypted_params.go:25-50` only decrypts `encrypted_params` before passing the request to the install handler. No request ID, local-only restriction, bootstrap secret, or prior trust check is enforced.\n\nThis was verified locally in an isolated lab instance. A fresh instance returned `{\"lock\":false,\"timeout\":false}`, an unauthenticated `POST /api/install` returned `{\"message\":\"ok\"}`, the instance then flipped to `{\"lock\":true,\"timeout\":false}`, and the on-disk SQLite database showed user ID `1` renamed to the attacker-controlled username with a non-empty password hash.\n\n### PoC\nThe quickest local verification path is the helper script created during validation:\n\n```bash\nATTACKER_EMAIL='attacker@example.com' ATTACKER_USER='attacker' ATTACKER_PASS='Password12345' \\\n'/Users/r1zzg0d/Documents/CVE hunting/targets/nginx-ui/output/verify/verify_fresh_install_takeover.sh'\n```\n\nExpected proof points:\n\n```text\n[1/6] Fresh-instance status:\n{\n  \"lock\": false,\n  \"timeout\": false\n}\n\n[3/6] Claiming the initial administrator account...\n{\n  \"message\": \"ok\"\n}\n\n[4/6] Verifying install is now locked...\n{\n  \"lock\": true,\n  \"timeout\": false\n}\n\n[5/6] Verifying the on-disk admin record was overwritten...\n{\n  \"id\": 1,\n  \"name\": \"attacker\",\n  \"password_len\": 60\n}\n```\n\nTo confirm the final state manually:\n\n```bash\nsqlite3 '/Users/r1zzg0d/Documents/CVE hunting/targets/nginx-ui/tmp/poc-install-takeover/database.db' \\\n'select id,name,length(password) from users where id=1;'\n```\n\nExpected output:\n\n```text\n1|attacker|60\n```\n\nManual HTTP reproduction is also straightforward:\n\n1. Request `GET /api/install` and confirm `lock=false` and `timeout=false`.\n2. Request `POST /api/crypto/public_key` to obtain the public RSA key.\n3. Encrypt `{\"email\":\"attacker@example.com\",\"username\":\"attacker\",\"password\":\"Password12345\"}` with that public key and base64-encode the ciphertext.\n4. Submit the ciphertext to `POST /api/install` as `{\"encrypted_params\":\"...\"}`.\n5. Re-request `GET /api/install` and observe that `lock=true`.\n6. Inspect the backing database and confirm user ID `1` now belongs to the attacker-controlled username.\n\n### Impact\nThis is an authentication bypass / initial admin claim vulnerability affecting fresh, uninitialized instances that are reachable over the network during the installation window. Any attacker able to reach the service before the legitimate operator can permanently take ownership of the first administrator account and thereby seize control of the application. Because `nginx-ui` is an administrative interface for Nginx and related host-management features, compromise of the initial admin account can lead to unauthorized configuration changes, certificate management abuse, backup manipulation, service disruption, and broader operational takeover of the managed environment.\n\n### Remediation\n1. Require a single-use bootstrap secret for installation. Generate the token locally on first start, print it only to the server console or write it to a root-owned local file, and require it on `POST /api/install`.\n2. Restrict installation endpoints to loopback by default until setup completes. Remote setup should require an explicit opt-in configuration flag, not be enabled automatically on all interfaces.\n3. Make installer claim atomic and explicitly stateful. Persist a dedicated installation state record, consume the bootstrap token exactly once, and refuse concurrent or repeated initialization attempts even within the startup window.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/0xJacky/Nginx-UI"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.3.8"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.3.5"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/0xJacky/nginx-ui/security/advisories/GHSA-h27v-ph7w-m9fp"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-42221"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/0xJacky/nginx-ui"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/0xJacky/nginx-ui/releases/tag/v2.3.8"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-306" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-06T16:59:00Z",
    "nvd_published_at" : "2026-05-04T21:16:32Z"
  }
}