Skip to main content

Boteraser | Website and Server Security Solutions

🛡️ CVE-2026-42221 — nginx-ui

🟠 CVSS 8.1 — High ✅ No Known Exploit CWE-306 NVD
8.1
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

Nginx-UI: Unauthenticated First-Run Installer Allows Remote Initial Admin Claim

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='[email protected]' 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":"[email protected]","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 ser

How this vulnerability can be exploited

This issue can be reached over the network, attack complexity is high, an attacker needs no privileges on the target. No user interaction is required. The scope is unchanged, so the impact stays within the vulnerable component. Rated impact: confidentiality high, integrity high, availability high.

CVSS metrics in full

The score comes from this vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

  • Attack vector: Network — reachable from anywhere that can route to the service.
  • Attack complexity: High — the attacker first has to win a race, learn a secret or otherwise prepare the target.
  • Privileges required: None — an unauthenticated stranger can try it.
  • User interaction: None — nobody has to be tricked into anything.
  • Scope: Unchanged — the damage stays inside the vulnerable component.
  • Confidentiality impact: High — total loss, or loss the attacker controls.
  • Integrity impact: High — total loss, or loss the attacker controls.
  • Availability impact: High — total loss, or loss the attacker controls.

Weakness class

CVE-2026-42221 is classified as CWE-306: Missing Authentication for Critical Function. A sensitive function can be reached without authenticating at all.

Affected software

CVE-2026-42221 is recorded against 2 packages.

  • github.com/0xjacky/nginx-ui
  • nginx-ui (from 2.0.0 up to 2.3.8)

Timeline and source

Published on 25 June 2026. No public exploit is currently recorded for this entry. Record sourced from NVD.

References

github.com (Advisory)
nvd.nist.gov (Advisory)
github.com (Web)

Other advisories for this package

github.com/0xjacky/nginx-ui has other advisories on record. If you are patching this one, these are worth checking on the same host:

Same weakness in other software

These advisories are the same class of weakness (CWE-306: Missing Authentication for Critical Function) in other software:

Details

Severity HIGH
CVSS Score 8.1
CVSS Vector CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
CWE CWE-306
Public Exploit ✅ No
Source NVD
Published 2026-06-25
Updated 2026-08-20
Modified 2026-06-25
Fix URL N/A

Affected Packages

Software From version Fixed in
github.com/0xjacky/nginx-ui
nginx-ui 2.0.0 2.3.8

Similar Threats

Site Security Check

Is nginx-ui part of your stack?

CVE-2026-42221 is rated CVSS 8.1 High. BotEraser scans your installation against known CVE records and tells you whether this vulnerability applies to the versions you actually run.

Scan My Site Free →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.

Browse related advisories

All advisoriesCVECVE 2026