VYPR
High severityNVD Advisory· Published Aug 29, 2019· Updated Sep 16, 2024

Kubernetes kube-apiserver allows access to custom resources via wrong scope

CVE-2019-11247

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.

PackageAffected versionsPatched versions
k8s.io/apiextensions-apiserverGo
>= 0.7.0, < 0.13.90.13.9
k8s.io/apiextensions-apiserverGo
>= 0.14.0, < 0.14.50.14.5
k8s.io/apiextensions-apiserverGo
>= 0.15.0, < 0.15.20.15.2

Affected products

1

Patches

1
b9b7d2b3f32f

apiextensions: 404 if request scope does not match crd scope

https://github.com/kubernetes/apiextensions-apiserverDr. Stefan SchimanskiJul 1, 2019via ghsa
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

News mentions

0

No linked articles in our index yet.