Summary
Capsule's multi-tenancy Controller, when running with cluster-admin privileges, can be abused by tenant administrators to create unauthorized cluster-scoped resources via TenantResource RawItems processing.
Because namespace enforcement does not apply to cluster-scoped objects, a tenant owner can indirectly provision powerful resources like ClusterRoles or ValidatingWebhookConfigurations, enabling cross-tenant privilege escalation and potential cluster-wide compromise.
Affected context
This vulnerability affects Kubernetes clusters using Capsule as a multi-tenancy and policy framework where:
- The Capsule Controller is deployed with cluster-admin privileges (the default configuration in many setups).
- Tenant owners are permitted to define TenantResource RawItems.
- Policy controls implicitly assume that namespace scoping is sufficient to contain tenant actions.
Under these conditions, cluster-scoped objects routed through the controller's elevated permissions bypass expected tenant boundaries and authorization checks.
Exploit preconditions
- Attack surface: Capsule TenantResource RawItems handling path.
- Required access: Tenant Owner or equivalent high-privilege role within a tenant; direct cluster-admin access is not required.
- Trigger point: Submission of a TenantResource containing cluster-scoped resources (e.g., ClusterRole, ValidatingWebhookConfiguration) that the tenant cannot normally create.
- Why exploitation is possible:
- The controller runs with cluster-admin privileges and applies RawItems on behalf of tenants.
- The logic that forcibly sets a namespace only affects namespaced resources and is ineffective for cluster-scoped objects.
- Authorization is effectively delegated to a highly privileged controller without sufficient scoping and validation of requested object kinds and scopes.
Why this happens
The core issue is an authorization design flaw where a highly privileged controller performs actions on user-supplied specifications without enforcing strict policy constraints on what may be created.
In Capsule's TenantResource RawItems processing, the controller:
- Trusts tenant-provided resource definitions and applies them using its own cluster-admin credentials.
- Attempts to constrain impact by forcing a namespace, but this safeguard inherently does not apply to cluster-scoped Kubernetes resources.
This maps to:
- CWE-863: Incorrect Authorization – the system allows tenants to indirectly invoke operations that exceed their intended permissions via a privileged intermediary (the controller).
- CWE-20: Improper Input Validation – the RawItems payload is not validated to restrict disallowed kinds or scopes, enabling unintended cluster-level operations through loosely validated input.
Potential impact
- Tenant administrators could create or modify ClusterRoles and ClusterRoleBindings, potentially escalating privileges across the entire cluster.
- Malicious ValidatingWebhookConfiguration or MutatingWebhookConfiguration objects could be installed, intercepting and manipulating other tenants' traffic and workloads.
- Cross-tenant data access and interference, including reading or modifying resources belonging to other tenants.
- Establishment of stealthy persistence mechanisms at the cluster scope, complicating incident response and recovery.
- Disruption of control plane behavior or denial-of-service conditions through abusive cluster-scoped configuration.
General mitigation guidance
Effective mitigation generally focuses on tightening authorization boundaries and reducing the privileges and trust placed in multi-tenant controllers:
- Constrain controller privileges: Run the Capsule Controller with the minimal set of RBAC permissions it truly requires, avoiding blanket cluster-admin roles wherever feasible.
- Scope and validate requested resources: Introduce explicit allowlists for resource kinds and scopes that tenants may request via TenantResource or similar constructs, rejecting cluster-scoped and high-impact objects by default.
- Separate duties: Where possible, separate the responsibilities of tenant-level resource management from cluster-wide configuration, using distinct service accounts and RBAC with clear boundaries.
- Policy-driven restrictions: Use admission policies (e.g., validating admission policies, OPA/Gatekeeper, Kyverno) to block or tightly constrain cluster-scoped objects originating from tenant-facing abstractions.
- Reduce trust in RawItems-style APIs: Favor higher-level, opinionated APIs with well-defined schemas over arbitrary "raw" resource injection, which is harder to reason about and secure.
- Apply least privilege to tenants: Ensure Tenant Owner roles are scoped to tenant resources only and avoid implicit capabilities that indirectly reach cluster scope.
How teams detect issues like this
Detection approaches can combine configuration review, runtime monitoring, and automated analysis:
- RBAC and deployment review: Regularly audit the Capsule Controller's service account permissions, looking for cluster-admin or overly broad cluster-scoped roles that are not strictly necessary.
- Configuration pattern analysis: Search for tenant-exposed APIs or CRDs that accept raw Kubernetes resource definitions (e.g., RawItems) and verify that appropriate kind and scope restrictions are enforced.
- Cluster-scoped object monitoring: Implement logging and alerting on the creation or modification of high-risk cluster-scoped resources (ClusterRole, ClusterRoleBinding, {Validating,Mutating}WebhookConfiguration, APIService, etc.), especially when initiated indirectly via controllers.
- Static and policy-based checks: Use policy-as-code tools (OPA/Gatekeeper, Kyverno, or similar) and static configuration analysis to detect controllers that can apply arbitrary user-influenced resources with elevated privileges.
- Change provenance auditing: Correlate events to the initiating users and service accounts; unusual patterns where tenant actions result in cluster-level changes through a controller indicate potential abuse.

