Nginx-UI Unauthenticated Bootstrap Takeover
Nginx-UI version 2.3.5 is vulnerable to an unauthenticated takeover via the `/api/install` endpoint during the initial setup window, allowing a remote attacker to claim administrative control of a fresh instance.
Nginx-UI version 2.3.5 contains a critical vulnerability that allows unauthenticated remote attackers to take complete administrative control of a fresh instance. The vulnerability lies in the /api/install endpoint, which is accessible without authentication during a short initial setup window. This window is intended for the first-time configuration of the application. By sending a specially crafted POST request to /api/install, an attacker can set the application’s JWT secret, node secret, certificate email, and initial administrator credentials before the legitimate operator. This attack is most relevant during initial deployments, rebuilds, ephemeral test environments, LAN-accessible fresh installs, or temporarily exposed setup workflows. The attacker gains full control without needing to exploit any authenticated feature or guess default credentials. The observed exploitation was reproduced over HTTP against live local instances started from nginx-ui v2.3.5 using Docker image uozi/nginx-ui@sha256:d73343e3009c9b558129a2be0cacd6c2c57ed8006a5871873b874b812e612e5a.
Attack Chain
- A fresh
nginx-uiinstance is deployed, exposing the/api/installendpoint over HTTP before initial configuration. - The attacker sends a GET request to
/api/installto determine if the instance is uninitialized (checks for{"lock":false,"timeout":false}). - The attacker sends a GET request to
/api/crypto/public_keyto retrieve the public key used for encryption. - The attacker uses the retrieved public key to encrypt a JSON payload containing the desired administrator username, password, and email.
- The attacker sends a POST request to
/api/installwith the encrypted payload in theencrypted_paramsfield. - The server processes the request, sets the attacker-chosen credentials, and locks the installation (
{"lock":true,"timeout":false}). - The attacker sends a POST request to
/api/loginwith the attacker-chosen username and password, also encrypted with the previously obtained public key. - The server authenticates the attacker and returns a valid token, granting them administrative access to the
nginx-uiinstance.
Impact
Successful exploitation of this vulnerability allows a remote attacker to completely compromise a fresh nginx-ui instance. The attacker gains full administrative privileges and can configure the application, manage Nginx configurations, and potentially use the compromised server as a pivot point for further attacks. The exposure window is limited to the initial setup phase, but if successfully exploited, the attacker effectively becomes the administrator of the system.
Recommendation
- Monitor web server logs for POST requests to
/api/installwith a non-emptyencrypted_paramsfield, especially from unusual source IP addresses, to detect potential takeover attempts. Deploy the Sigma ruleDetect Nginx-UI Initial Setup Takeover Attemptto your SIEM. - Restrict access to the
/api/installendpoint to localhost or trusted networks during the initial setup phase using firewall rules or web server configuration. - Apply the suggested fixes from the advisory, including requiring a local-only or out-of-band bootstrap secret for
POST /api/install, to prevent unauthorized installation claims. - Monitor for unexpected processes creating files or directories under
/etc/nginxor/etc/nginx-uiimmediately after a new deployment ofnginx-uito identify potential persistence attempts.
Detection coverage 2
Detect Nginx-UI Initial Setup Takeover Attempt
criticalDetects POST requests to /api/install with encrypted parameters, indicating a potential unauthenticated takeover attempt during the initial setup phase.
Detect Nginx-UI Login with Recently Created User
highDetects logins shortly after a POST request to /api/install, potentially indicating the attacker is logging in with the newly created account.
Detection queries are kept inside the platform. Get full rules →
Indicators of compromise
1
url
| Type | Value |
|---|---|
| url | http://127.0.0.1:9000/api/install |