Summary
A broken access control issue in mcp-server-kubernetes causes documented restriction variables to be enforced only when listing tools, not when invoking them.
Any client that knows a tool name can bypass configured read-only or non-destructive modes and call restricted Kubernetes operations directly, making environments appear locked down while still permitting dangerous actions.
Affected context
The vulnerability exists in deployments of mcp-server-kubernetes that rely on the environment variables:
ALLOW_ONLY_READONLY_TOOLSALLOW_ONLY_NON_DESTRUCTIVE_TOOLSALLOWED_TOOLS
as an enforcement mechanism for limiting which Kubernetes tools are available.
The issue manifests when operators assume these settings fully gate both tool discovery and execution, while in reality they only filter the tools returned by tools/list and not the operations accepted by tools/call.
Exploit preconditions
- Attack surface: MCP server API exposing
tools/listandtools/callendpoints. - Required access: Ability to connect as an MCP client with permission to interact with the server (e.g., network-level access and any required client credentials).
- Trigger point: Direct invocation of a restricted or supposedly disabled tool by name via
tools/call, bypassing discovery filters. - Why exploitation is possible: Authorization checks are implemented at the discovery layer only; the execution path does not revalidate whether the requested tool is permitted under the configured access control mode, enabling clients to call hidden or disallowed tools if they know their identifiers.
Why this happens
The core issue is a missing or inconsistent authorization check on the tool execution pathway, mapping to CWE-863: Incorrect Authorization.
Access control logic was applied only when building the list of exposed tools, effectively treating access restrictions as a presentation concern rather than a gate on the underlying operations.
Because tools/call does not re-enforce the same policy, the system relies on obscurity (not listing tools) instead of actual authorization, allowing any known tool name to be executed regardless of the configured environment variables.
Potential impact
- Clients may execute destructive Kubernetes operations even when the server is configured for "read-only" or "non-destructive" modes.
- Unauthorized modification or deletion of Kubernetes resources (e.g., pods, services, deployments).
- Escalation from observational access to active control over a cluster through misconfigured MCP tooling.
- Violation of compliance, audit, or safety expectations where operators believed strict access controls were in place.
General mitigation guidance
Mitigation generally focuses on enforcing consistent, centralized authorization checks across all code paths that trigger sensitive operations.
Useful secure patterns include:
- Applying the same access control logic at both discovery and execution layers, ensuring that every call path to a tool is subject to explicit policy evaluation.
- Designing tools so that their allowed operations are defined declaratively and evaluated server-side, rather than relying on client-visible listings as a control mechanism.
- Implementing least-privilege principles by separating roles or credentials for read-only versus mutating operations and avoiding shared access tokens.
- Treating environment-variable configuration as policy input, not as the sole security boundary, and combining it with strong authentication and authorization checks close to the resource layer (e.g., Kubernetes RBAC).
How teams detect issues like this
To detect this class of issue, organizations can:
- Review server-side routes or handlers for sensitive operations and verify that authorization checks are performed uniformly, not only on listing or UI endpoints.
- Use static analysis or code search to ensure that access control conditions reference both
tools/listandtools/call(or equivalent) and that tool execution never bypasses policy modules. - Implement security tests or integration tests that attempt to call tools that should be disabled or restricted and confirm they are rejected.
- Configure automated policy enforcement (e.g., API gateways, RBAC layers, or admission controllers) to independently enforce allowed operations, reducing reliance on presentation-layer filters.

