Kubernetes kube-apiserver allows access to custom resources via wrong scope
Description
The Kubernetes kube-apiserver mistakenly allows access to a cluster-scoped custom resource if the request is made as if the resource were namespaced. Authorizations for the resource accessed in this manner are enforced using roles and role bindings within the namespace, meaning that a user with access only to a resource in one namespace could create, view update or delete the cluster-scoped resource (according to their namespace role privileges). Kubernetes affected versions include versions prior to 1.13.9, versions prior to 1.14.5, versions prior to 1.15.2, and versions 1.7, 1.8, 1.9, 1.10, 1.11, 1.12.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
k8s.io/apiextensions-apiserverGo | >= 0.7.0, < 0.13.9 | 0.13.9 |
k8s.io/apiextensions-apiserverGo | >= 0.14.0, < 0.14.5 | 0.14.5 |
k8s.io/apiextensions-apiserverGo | >= 0.15.0, < 0.15.2 | 0.15.2 |
Affected products
1- Range: prior to 1.13.9
Patches
1b9b7d2b3f32fapiextensions: 404 if request scope does not match crd scope
1 file changed · +18 −0
pkg/apiserver/customresource_handler.go+18 −0 modified@@ -197,6 +197,10 @@ func NewCustomResourceDefinitionHandler( // and on the client side (by restarting the watch) var longRunningFilter = genericfilters.BasicLongRunningRequestCheck(sets.NewString("watch"), sets.NewString()) +// possiblyAcrossAllNamespacesVerbs contains those verbs which can be per-namespace and across all +// namespaces for namespaces resources. I.e. for these an empty namespace in the requestInfo is fine. +var possiblyAcrossAllNamespacesVerbs = sets.NewString("list", "watch") + func (r *crdHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { ctx := req.Context() requestInfo, ok := apirequest.RequestInfoFrom(ctx) @@ -232,10 +236,24 @@ func (r *crdHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { http.Error(w, err.Error(), http.StatusInternalServerError) return } + + // if the scope in the CRD and the scope in request differ (with exception of the verbs in possiblyAcrossAllNamespacesVerbs + // for namespaced resources), pass request to the delegate, which is supposed to lead to a 404. + namespacedCRD, namespacedReq := crd.Spec.Scope == apiextensions.NamespaceScoped, len(requestInfo.Namespace) > 0 + if !namespacedCRD && namespacedReq { + r.delegate.ServeHTTP(w, req) + return + } + if namespacedCRD && !namespacedReq && !possiblyAcrossAllNamespacesVerbs.Has(requestInfo.Verb) { + r.delegate.ServeHTTP(w, req) + return + } + if !apiextensions.HasServedCRDVersion(crd, requestInfo.APIVersion) { r.delegate.ServeHTTP(w, req) return } + // There is a small chance that a CRD is being served because NamesAccepted condition is true, // but it becomes "unserved" because another names update leads to a conflict // and EstablishingController wasn't fast enough to put the CRD into the Established condition.
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
15- access.redhat.com/errata/RHBA-2019:2816ghsavendor-advisoryx_refsource_REDHATWEB
- access.redhat.com/errata/RHBA-2019:2824ghsavendor-advisoryx_refsource_REDHATWEB
- access.redhat.com/errata/RHSA-2019:2690ghsavendor-advisoryx_refsource_REDHATWEB
- access.redhat.com/errata/RHSA-2019:2769ghsavendor-advisoryx_refsource_REDHATWEB
- github.com/advisories/GHSA-fp37-c92q-4pwqghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2019-11247ghsaADVISORY
- github.com/kubernetes/apiextensions-apiserver/commit/b9b7d2b3f32f8edbeb47b8726710eeb868bce196ghsaWEB
- github.com/kubernetes/kubernetes/issues/80983ghsax_refsource_CONFIRMWEB
- github.com/kubernetes/kubernetes/pull/80750ghsaWEB
- github.com/kubernetes/kubernetes/pull/80850ghsaWEB
- github.com/kubernetes/kubernetes/pull/80851ghsaWEB
- github.com/kubernetes/kubernetes/pull/80852ghsaWEB
- groups.google.com/d/msg/kubernetes-security-announce/vUtEcSEY6SM/v2ZZxsmtFQAJghsamailing-listx_refsource_MLISTWEB
- security.netapp.com/advisory/ntap-20190919-0003ghsaWEB
- security.netapp.com/advisory/ntap-20190919-0003/mitrex_refsource_CONFIRM
News mentions
0No linked articles in our index yet.