MCP parser differential allows read-scoped tokens to invoke write tools
Description
Nginx UI used a separate JSON parse in the MCP authorization middleware to decide whether a request required mcp:write scope and an interactive user's secure session. Parse failures were treated as non-sensitive, while the downstream MCP server could still decode and dispatch the first valid JSON value. An authenticated caller could therefore append trailing garbage or another JSON value to a sensitive tools/call request and bypass the intended authorization classification.
The issue affects both read-scoped MCP service tokens and user sessions that have not completed secure-session step-up. It is not an unauthenticated vulnerability. Independent reproduction on the v2.6.x code line confirmed that a read-scoped token could reach a write-class tool when a valid JSON-RPC request was followed by another JSON value.
Impact
An attacker who already possesses a valid read-scoped MCP service token, or a valid user session without its required secure-session binding, could invoke MCP tools classified as write operations. This could modify Nginx configuration and trigger operational actions exposed by those tools.
Remediation
MCP requests are now parsed with a strict, shared policy before authorization. The endpoint accepts exactly one JSON object. Malformed input, trailing non-whitespace data, concatenated JSON values, and JSON-RPC batch arrays are rejected before dispatch, so parse ambiguity fails closed.
Fixed by 66471391c0b86f1fe31e9a28402aeb71d4d1bc2d.