[Security Advisory] CVE-2023-2728: Bypassing enforce mountable secrets policy imposed by the ServiceAccount admission plugin

91 views
Skip to first unread message

Rita Zhang

unread,
Jun 15, 2023, 12:42:30 AM6/15/23
to kubernetes-announce, dev, kubernetes-sec...@googlegroups.com, kubernetes-security-discuss, distributo...@kubernetes.io, kubernetes+a...@discoursemail.com
Hello Kubernetes Community,

A security issue was discovered in Kubernetes where users may be able to launch containers that bypass the mountable secrets policy enforced by the ServiceAccount admission plugin when using ephemeral containers. The policy ensures pods running with a service account may only reference secrets specified in the service account’s secrets field. Kubernetes clusters are only affected if the ServiceAccount admission plugin and the kubernetes.io/enforce-mountable-secrets annotation are used together with ephemeral containers.

This issue has been rated Medium (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:N), and assigned CVE-2023-2728

Am I vulnerable?
Clusters are impacted by this vulnerability if all of the following are true:
  1. The ServiceAccount admission plugin is used. Most cluster should have this on by default as recommended in https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#serviceaccount
  2. The kubernetes.io/enforce-mountable-secrets annotation is used by a service account. This annotation is not added by default.
  3. Pods are using ephemeral containers.
Affected Versions
  • kube-apiserver v1.27.0 - v1.27.2
  • kube-apiserver v1.26.0 - v1.26.5
  • kube-apiserver v1.25.0 - v1.25.10
  • kube-apiserver <= v1.24.14
How do I mitigate this vulnerability?
This issue can be mitigated by applying the patch provided for the kube-apiserver component. The patch prevents ephemeral containers from bypassing the mountable secrets policy enforced by the ServiceAccount admission plugin.

Fixed Versions
  • kube-apiserver v1.27.3
  • kube-apiserver v1.26.6
  • kube-apiserver v1.25.11
  • kube-apiserver v1.24.15
These releases have been published today, June 14th, 2023.

Detection
Pod update requests using an ephemeral container that exploits this vulnerability with unintended secret will be captured in API audit logs. You can also use kubectl get pods to find active pods with ephemeral containers running with a secret that is not referenced by the service account in your cluster.

Additional Details
See the GitHub issue for more details: https://github.com/kubernetes/kubernetes/issues/118640

Thank You,
Rita Zhang on behalf of the Kubernetes Security Response Committee
Reply all
Reply to author
Forward
0 new messages