kubernetes: CVE-2022-3162: Unauthorized read of Custom Resources

CVSS Rating: CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N

A security issue was discovered in Kubernetes where users authorized to list or watch one type of namespaced custom resource cluster-wide can read custom resources of a different type in the same API group without authorization.

Am I vulnerable?

Clusters are impacted by this vulnerability if all of the following are true:

  • There are 2+ CustomResourceDefinitions sharing the same API group
  • Users have cluster-wide list or watch authorization on one of those custom resources.
  • The same users are not authorized to read another custom resource in the same API group.

Affected Versions

  • Kubernetes kube-apiserver <= v1.25.3
  • Kubernetes kube-apiserver <= v1.24.7
  • Kubernetes kube-apiserver <= v1.23.13
  • Kubernetes kube-apiserver <= v1.22.15

How do I mitigate this vulnerability?

Upgrading the kube-apiserver to a fixed version mitigates this vulnerability.

Prior to upgrading, this vulnerability can be mitigated by avoiding granting cluster-wide list and watch permissions.

Fixed Versions

  • Kubernetes kube-apiserver v1.25.4
  • Kubernetes kube-apiserver v1.24.8
  • Kubernetes kube-apiserver v1.23.14
  • Kubernetes kube-apiserver v1.22.16

Detection

Requests containing .. in the request path are a likely indicator of exploitation. Request paths may be captured in API audit logs, or in kube-apiserver HTTP logs.

If you find evidence that this vulnerability has been exploited, please contact security@kubernetes.io

Acknowledgements

This vulnerability was reported by Richard Turnbull of NCC Group as part of the Kubernetes Audit.

/area security /kind bug /committee security-response /label official-cve-feed /sig api-machinery /area apiserver

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (4 by maintainers)

Most upvoted comments

Hi,

What steps are to reproduce this CVE?

I have two namespaced CRDs a and b in the same API group cluster.x-k8s.io. There is a ClusterRole to access only resource a.

My user sends a request to list objects b and I get access error as expected:

> kubectl --insecure-skip-tls-verify get --raw /apis/cluster.x-k8s.io/v1beta1/a/../b?limit=500

Error from server (Forbidden): a.cluster.x-k8s.io ".." is forbidden: User "cve-2022-3162" cannot get resource "a/b" in API group "cluster.x-k8s.io" at the cluster scope

Do I understand it correctly that it’s only get/list that can be done? No create, update, delete operation is possible with the CVE?

@NissesSenap correct, as far as we can tell, the exploit is read-only. However, I think it only works for list & watch requests, not get.