Skip to content

AAK-MCPWN-001: MCP route twin-asymmetry: auth middleware missing on sibling route (MCPwn, CVE-2026-33032)

Severity
CRITICAL
Category
MCP Configuration (mcp-config)
Scanner
agent_audit_kit/scanners/mcp_middleware.py
Auto-fixable
No.
SARIF name
McpwnTwinAsymmetry

What it detects

Two routes matching the MCP endpoint pattern (/mcp, /mcp_message, /mcp/messages, /mcp[_-]invoke, /mcp[_-]tool, ...) are declared in the same file, but one has no auth middleware while its twin does. This is the exact CVE-2026-33032 shape nginx-ui 2.3.4 patched and which VulnCheck KEV-listed on 2026-04-13 as actively exploited (CVSS 9.8). ~2,689 Shodan instances were exposed at disclosure; any network-adjacent caller can invoke the protected tools with zero credentials.

How to fix

Apply the same auth middleware to every MCP endpoint in a file. For Gin, use a router.Use(AuthRequired()) group and mount all MCP routes inside it. For FastAPI, share a single Depends(auth) dependency across @app.post('/mcp*') decorators. For Express, create an mcpRouter.use(authMw) and mount it once.

To confirm the finding is gone, report only this rule:

agent-audit-kit scan . --rules AAK-MCPWN-001

Limitations

Compares MCP routes inside one file: it fires on an unauthenticated route (/mcp, /mcp_message, /mcp-messages, /mcp/invoke and a few more) only when another MCP route in the same file has an auth marker from a fixed list. Twin routes placed in two modules are not paired, a path such as /mcp/sse is not recognised as an MCP route, an auth dependency that is not on the list (Depends(verify_api_key)) does not count as auth, and a FastAPI route written with single quotes (@router.post('/mcp')) is not read. A Gin or Express route's middleware arguments are read for auth markers in their first 200 characters, and its handler up to its first ) within 200; in TypeScript and JavaScript a regex literal must close within 512 characters of its /, or it is read as division and a backtick in it can hide the routes after it.

References


All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-MCPWN-001.md: the page then shows that text, with the registry reference appended under it.