# CVE-2026-42221: Nginx-UI Auth Bypass — Fixed in 2.3.8

🐹

🐹 Go

Not in CISA KEV

HIGH severity

# CVE-2026-42221 — Nginx-UI

HIGH 

CVE-2026-42221 is a high-severity (CVSS 8.1) Missing Authentication vulnerability in github.com/0xJacky/Nginx-UI. A fix is available for github.com/0xJacky/Nginx-UI — see the affected versions and patch details below.

nginx-ui: Unauthenticated First-Run Installer Allows Remote Initial Admin Claim

Also known as[GHSA-h27v-ph7w-m9fp](/vulnerability/GHSA-h27v-ph7w-m9fp)GO-2026-5412

Published

May 4, 2026

Updated

Oct 28, 2026

Affected

1 pkg

Patched

1 / 1

Exploits

None indexed

Exploitation data as of Nov 9, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

## Exploitation Status

### Proof-of-concept exploit code exists

-   CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
-   A successful exploit gives an attacker total control of the affected component, not partial access.

Exploitation and automatability from CISA’s SSVC triage for CVE-2026-42221.

## EPSS Exploitation Probability

[via FIRST.org ↗](https://www.first.org/epss/)

1.3%probability of exploitation in next 30 days

Lower Risk0.00%

Lower risk than most CVEs72th percentile — riskier than 72% of all scored CVEsHighest risk

0.00%0.70%1.40%2.10%0.1%1.3%Jun 26Sep 26Nov 26

Probability of exploitation in the next 30 days, from [FIRST.org EPSS](https://www.first.org/epss/).

## How urgent is this, really

## Where this sits among everything scored

## Real-World Exposure

1 pkg affected

🐹`github.com/0xJacky/Nginx-UI`

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects Go packages — download data is not available via public APIs for these ecosystems.

## Description

#### 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:

```
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:

```
[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:

```
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:

```
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.

## Affected Packages

1 total 1 fixed

Ecosystem

Package

Vulnerable range

Fix

🐹Go

`github.com/0xJacky/Nginx-UI` 

≥ 2.0.0&&< 2.3.8

2.3.8`go get github.com/0xJacky/Nginx-UI@v2.3.8`

## Affected Products

1 product · 1 configurations

Application

`nginx ui`nginxui

≥ 2.0.0 && < 2.3.8

range

## Detection & mitigation playbook

Open-source dependency

1.  ### Detect
    
    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for github.com/0xJacky/Nginx-UI, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
    
2.  ### Fix
    
    Update github.com/0xJacky/Nginx-UI to 2.3.8 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2026-42221 is resolved across your whole dependency graph.
    
3.  ### Workarounds
    
    Put an independent control in front of the weakness: restrict the affected endpoint or interface to trusted networks, require an additional authentication factor or proxy-level check, and invalidate existing sessions and credentials in case the flaw has already been used.
    

## How to detect CVE-2026-42221

A community-maintained Nuclei template exists for this CVE. You can scan for it directly:

`nuclei -id cve-2026-42221 -u https://target`

Template

Nginx UI <= 2.3.7 - Unauthenticated Installer Exposure

Severity

high

Impact

Remote attackers can permanently take over the initial administrator account, leading to full control of the instance.

Remediation

Upgrade to version 2.3.8 or later.

Template by [ProjectDiscovery nuclei-templates](https://github.com/projectdiscovery/nuclei-templates) (str4k3r), MIT licensed. [View the full template](https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2026/CVE-2026-42221.yaml). Scan only systems you are authorised to test.

## Frequently Asked Questions

\### 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 th

O3 Security · Impact-Aware SCA

### Is CVE-2026-42221 in your dependencies?

Find it across Go, including transitive dependencies.

[Scan my dependencies](/book-demo) [How O3 SCA works](/impact-aware-sca)