Nginx-UI Unauthenticated Initial Admin Claim Vulnerability
An unauthenticated network attacker can claim the initial administrator account on a fresh Nginx-UI instance during the first-run setup window by exploiting the publicly accessible /api/install endpoint.
The nginx-ui application versions 2.0.0 through 2.3.5 are vulnerable to an unauthenticated initial administrator claim. An attacker can exploit this by sending a POST request to the /api/install endpoint during the first-run setup window. This allows the attacker to set the admin email, username, and password, effectively taking control of the application before the legitimate administrator. The vulnerability exists because the /api/install endpoint lacks proper authentication and the request-encryption flow only protects confidentiality, not authenticity. This can lead to complete compromise of the Nginx-UI instance and the systems it manages.
Attack Chain
- A fresh
nginx-uiinstance is deployed and exposed to the network. - An unauthenticated attacker sends a GET request to
/api/installto verify the instance is unlocked ("lock": false, "timeout": false). - The attacker sends a POST request to
/api/crypto/public_keyto obtain the server’s RSA public key. - The attacker encrypts a JSON payload containing the attacker’s desired admin email, username, and password using the obtained public key. The payload is formatted as
{"email":"attacker@example.com","username":"attacker","password":"Password12345"}. - The attacker base64-encodes the resulting ciphertext.
- The attacker sends a POST request to
/api/installwith the base64-encoded ciphertext in theencrypted_paramsfield (e.g.,{"encrypted_params":"base64_encoded_ciphertext"}). - The server overwrites the initial admin user (ID 1) in the database with the attacker-provided credentials.
- The attacker logs in to the
nginx-uiinterface with the attacker-controlled username and password, gaining complete control of the application.
Impact
Successful exploitation allows an attacker to gain complete control over the nginx-ui application. Since nginx-ui manages Nginx configurations, certificates, and other host-level settings, this can lead to unauthorized configuration changes, certificate management abuse, backup manipulation, service disruption, and broader operational takeover of the managed environment. This vulnerability affects fresh, uninitialized instances that are reachable over the network during the installation window.
Recommendation
- Deploy the Sigma rule “Detect Nginx-UI Unauthenticated Initial Admin Claim Attempt” to your SIEM to identify exploitation attempts based on requests to the
/api/installendpoint. - Apply network access controls to restrict access to the
nginx-uiinstance during the installation window. - Monitor web server logs for POST requests to
/api/installand/api/crypto/public_keyfrom unusual source IP addresses.
Detection coverage 2
Detect Nginx-UI Unauthenticated Initial Admin Claim Attempt
criticalDetects attempts to claim the initial administrator account by sending a POST request to the /api/install endpoint without prior authentication.
Detect Nginx-UI Public Key Request
mediumDetects requests to the /api/crypto/public_key endpoint, often preceding an initial admin claim attempt.
Detection queries are kept inside the platform. Get full rules →