Summary
A flaw in 9Router's proxy middleware left /api/cli-tools/* and /api/mcp/* endpoints unprotected, enabling unauthenticated users to register custom plugins and issue commands via the MCP bridge.
When exposed, this can allow arbitrary command execution on the underlying host or environment whenever these plugin interfaces are reachable over the network.
Affected context
This vulnerability appears in 9Router deployments using versions 0.4.30 through 0.4.37 where:
- The application is reachable over a network interface (local, LAN, or public)
- The proxy middleware in
src/proxy.jsdoes not enforce authentication for/api/cli-tools/*and/api/mcp/* - The MCP bridge is configured and able to execute commands or interact with the host/agents
It becomes particularly risky in environments where 9Router is used as a central automation or AI routing hub with elevated system access.
Exploit preconditions
- Attack surface: HTTP endpoints
/api/cli-tools/*and/api/mcp/*exposed by 9Router - Required access: Network access to the 9Router instance; no authentication required on affected routes
- Trigger point: Sending crafted requests to:
- Register or modify
customPluginsviacowork-settingsroutes - Use the MCP bridge to issue commands through the registered tools
- Why exploitation is possible: Missing authentication and authorization checks on sensitive middleware routes allow arbitrary actors to register executable tooling and invoke command-like operations without any identity validation.
Why this happens
The core issue is a combination of missing access control and unsafe command-capable functionality exposed through APIs.
Specifically, src/proxy.js did not enforce authentication on /api/cli-tools/* and /api/mcp/*, mapping to CWE-306: Missing Authentication for Critical Function, because critical plugin registration and command interfaces were accessible to unauthenticated users.
Once untrusted clients can define or control command-capable plugins, the system effectively treats attacker-controlled input as operational instructions, leading to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') when those plugins or MCP commands can influence the underlying command execution environment.
Abstractly, a privileged orchestration interface was exposed without proper identity and trust boundary enforcement, allowing an arbitrary party to bridge configuration inputs directly into potentially dangerous command execution.
Potential impact
- Attackers can execute arbitrary commands through the MCP bridge and associated tooling
- Full compromise of the host running 9Router, including data theft or destruction
- Abuse of AI router capabilities to perform unauthorized automation tasks in connected systems
- Lateral movement to other services or infrastructure reachable from the compromised host
- Persistent backdoor installation via malicious custom plugins or modified settings
General mitigation guidance
Mitigation generally focuses on restoring strong access control around critical command and plugin interfaces, and reducing the command execution surface.
Pattern-level guidance includes:
- Enforcing authentication and authorization on all routes that register or manage tools, plugins, or command-capable features
- Treating plugin registration and MCP-style bridges as privileged operations and limiting them to trusted, authenticated administrative principals
- Designing command execution layers to minimize direct translation from user input to shell or process-level commands, favoring constrained, parameterized operations
- Applying least-privilege to the runtime environment so that even if command-capable features misbehave, the process has restricted filesystem and network permissions
- Segmenting command orchestration components from public-facing endpoints via network policies, API gateways, or internal-only bindings
How teams detect issues like this
Detection typically combines code-centric and environment-centric approaches:
- Static analysis and manual review focused on:
- Routes and middleware that expose command or tooling interfaces
- Any HTTP handler that can register or modify plugins, tools, or MCP connectors
- Missing authentication/authorization decorators, guards, or middlewares on these critical paths
- Logging and monitoring for:
- Unexpected plugin registrations or changes in cowork settings
- High-volume or unusual MCP command invocations, especially from unknown IP addresses
- Policy enforcement in CI/CD that:
- Requires authentication checks for routes associated with administration, configuration, or command execution
- Flags new endpoints that can influence process spawning, shell execution, or external tool invocation
- Optional use of automated application security testing tools that can exercise API endpoints, check for exposed administrative routes, and simulate unauthorized access attempts.

