9router Unauthenticated Remote Code Execution via MCP Plugin Routes
9router versions 0.4.30 to 0.4.33 are vulnerable to unauthenticated remote code execution, allowing network-adjacent attackers to execute arbitrary OS commands by registering and triggering malicious plugins through unprotected API endpoints.
9router versions 0.4.30 through 0.4.33 are susceptible to an unauthenticated remote code execution vulnerability due to insufficient access control on the /api/cli-tools/* and /api/mcp/* API endpoints. Introduced in commit 8f4d29c on 2026-05-11 with the addition of the MCP stdio→SSE bridge feature, this flaw allows a network-adjacent attacker to register a malicious plugin containing arbitrary OS commands. These commands can then be executed by triggering a Server-Sent Events (SSE) endpoint, resulting in the execution of commands as the user running the 9router process. This vulnerability poses a significant risk, as it requires no authentication and can be exploited in under 2 seconds from the first request.
Attack Chain
- The attacker sends a POST request to the
/api/cli-tools/cowork-settingsendpoint to register a malicious plugin. This endpoint is not protected by the Next.js middleware. - The POST request contains a JSON payload with a
customPluginsarray. Thename,command, andargsfields within the plugin definition are attacker-controlled. - The server-side code in
src/app/api/cli-tools/cowork-settings/route.jsextracts thecommandandargsfrom the JSON payload without proper validation. - The extracted
commandandargsare then stored in theglobalThis.__9routerCustomPluginsmap using theregisterCustomPluginfunction insrc/lib/mcp/stdioSseBridge.js. - The attacker sends a GET request to the
/api/mcp/[plugin]/sseendpoint, where[plugin]is the name of the malicious plugin registered in the previous steps. - The server-side code in
src/app/api/mcp/[plugin]/sse/route.jsretrieves the plugin definition from theglobalThis.__9routerCustomPluginsmap using the provided plugin name. - The
spawnfunction insrc/lib/mcp/stdioSseBridge.jsis called with the attacker-controlledcommandandargsfrom the plugin definition. - The arbitrary OS command is executed on the server, allowing the attacker to perform actions such as writing files, establishing reverse shells, or exfiltrating sensitive data.
Impact
Successful exploitation of CVE-2026-46339 allows an unauthenticated attacker to achieve remote code execution on the 9router server. This can lead to full read access to the server’s filesystem, including sensitive files such as API keys, TLS private keys, Anthropic tokens (~/.claude/settings.json), and AWS credentials (~/.aws/credentials, ~/.aws/sso/cache/*.json). Attackers can also achieve arbitrary file write, persistence via cron/systemd, process termination, and resource exhaustion. The docker group membership may allow container escape leading to host root access.
Recommendation
- Apply the provided remediation steps by patching the
src/proxy.jsfile to extend the middleware matcher to include/api/cli-tools/:path*and/api/mcp/:path*to prevent unauthenticated access. - Implement input validation and sanitization for the
commandandargsfields in theregisterCustomPluginfunction insrc/lib/mcp/stdioSseBridge.jsto prevent execution of arbitrary commands. - Sanitize the
customPluginsat the API boundary insrc/app/api/cli-tools/cowork-settings/route.jsto ensure that only authorized commands are executed. - Deploy the Sigma rule “Detect 9router Unauthenticated RCE via MCP Plugin Registration” to identify attempts to register malicious plugins via the
/api/cli-tools/cowork-settingsendpoint.
Detection coverage 2
Detect 9router Unauthenticated RCE via MCP Plugin Registration
highDetects CVE-2026-46339 exploitation — Unauthenticated registration of custom plugins with potentially malicious commands in 9router via the /api/cli-tools/cowork-settings endpoint.
Detect 9router Unauthenticated RCE via MCP Plugin Execution
highDetects CVE-2026-46339 exploitation — Unauthenticated execution of custom plugins in 9router via the /api/mcp/[plugin]/sse endpoint.
Detection queries are available on the platform. Get full rules →