Nginx UI: OTP secure-session step-up can be bypassed via MCP configuration tools
Summary
An OTP-enabled authenticated user who cannot use the HTTP configuration mutation endpoints without a valid secure session can still mutate Nginx configuration through /mcp and /mcp_message using only ordinary authentication.
Details
The HTTP configuration mutation surface is explicitly grouped behind middleware.RequireSecureSession(). By contrast, the MCP endpoints are exposed with only middleware.AuthRequired(). The MCP server exposes configuration mutation tools including nginx_config_add and nginx_config_modify, so OTP-enabled users gain an alternate path around the intended step-up requirement.
Relevant code paths:
- api/config/router.go
- internal/middleware/secure_session.go
- mcp/router.go
- mcp/config/config_add.go
- mcp/config/config_modify.go
This is a security-control bypass rather than a missing feature. The product already established that OTP-enabled users should complete a secure session before high-impact configuration mutations are accepted on the HTTP path.
PoC
I verified this locally in an isolated environment with a temporary end-to-end harness that exercised the real /mcp and /mcp_message routes.
What the executed test did:
- Created a temporary config directory and configured Nginx control commands to harmless local values (
true) to avoid touching the host. - Created a real OTP-enabled user in a temporary SQLite database.
- Generated a real JWT for that OTP-enabled user.
- Started a local test server exposing the real
/mcpand/mcp_messageroutes. - Opened an authenticated SSE connection to
/mcpwith the JWT and noX-Secure-Session-ID. - Initialized the MCP session over
/mcp_message. - Called the real
nginx_config_addtool over/mcp_message. - Verified that the tool succeeded and created
mcp-bypass.confin the managed config directory without any secure-session step-up.
Observed result from the actual local verification:
- The MCP session initialized successfully without any
X-Secure-Session-ID. - The config file was written through the MCP tool path using only JWT authentication.
Impact
OTP-enabled accounts lose the intended step-up protection for high-impact Nginx configuration changes when MCP is enabled. A user who should be blocked until re-authenticating can still create or modify configuration files and trigger reload behavior through MCP.