Skip to content

Privilege Escalation: KCSA practice questions

Privilege escalation is any path by which a user, workload or node ends up with more access than it was granted. In Kubernetes the paths fall into two families: API permissions that are more powerful than they look, and Pod settings that hand a container control of its node.

By Ibrahim Yesilay · Published · Updated

Independent community practice, not affiliated with or endorsed by CNCF or The Linux Foundation.

What Privilege Escalation covers in KCSA

Privilege escalation is any path by which a user, workload or node ends up with more access than it was granted. In Kubernetes the paths fall into two families: API permissions that are more powerful than they look, and Pod settings that hand a container control of its node. The RBAC good-practices guide catalogs the first family, and the Pod Security Standards constrain the second.

On the API side, RBAC normally stops a user from creating a role with more rights than they hold, or from binding a role whose rights they lack. The escalate verb on roles and the bind verb on bindings are the documented exceptions, and impersonate lets a user take on the rights of another identity. Members of the system:masters group bypass every RBAC check and keep unrestricted superuser access that removing bindings cannot revoke, so the guide says not to add users to it. Several ordinary-looking grants are escalation routes too. get on nodes/proxy reaches the kubelet API, which can execute commands in every Pod on the node and bypasses audit logging and admission control. Creating arbitrary PersistentVolumes includes hostPath volumes, which give a Pod the node's filesystem. Create rights on CertificateSigningRequests plus approval for the kubernetes.io/kube-apiserver-client signer can mint client certificates with any name, including those of system components. create on serviceaccounts/token issues tokens for existing service accounts, control of webhook configurations exposes every admitted object and can alter it, and patching a Namespace can relabel it for a more permissive Pod Security level.

Workload creation deserves separate attention. Permission to create Pods, or any workload resource that manages Pods, implicitly grants access to the namespace's Secrets, ConfigMaps and PersistentVolumes and to the API rights of every ServiceAccount there, and users who can run privileged Pods can use that access to reach the node.

On the Pod side, the dangerous settings are those that remove isolation. A privileged container disables most security mechanisms, and the Baseline standard also disallows sharing host namespaces, forbids hostPath volumes and disallows adding capabilities beyond a default list. allowPrivilegeEscalation controls whether a process can gain more privileges than its parent, for example through a setuid binary, by setting the no_new_privs flag; it defaults to true when unset and cannot be false for a privileged container or one with CAP_SYS_ADMIN. Baseline is defined as preventing known privilege escalations, and Restricted adds hardening on top: allowPrivilegeEscalation must be false, containers must drop ALL capabilities and may add back only NET_BIND_SERVICE, and they must run as non-root users. The guide recommends enforcing Baseline or Restricted wherever users are not fully trusted to create isolated Pods, with Pod Security admission or a third-party mechanism.

Nodes are a third angle. A stolen kubelet credential should not reach beyond its own node, which is what the Node authorizer and the NodeRestriction admission plugin provide: such a kubelet may modify only its own Node object and the Pods bound to that node.

Key points

  • escalate (roles), bind (bindings) and impersonate are the RBAC verbs that defeat built-in escalation checks.
  • get on nodes/proxy is not read-only: it can execute commands through the kubelet API.
  • system:masters membership bypasses RBAC and cannot be revoked by deleting bindings.
  • allowPrivilegeEscalation defaults to true; the Restricted standard requires it to be false.
  • Restricted Pods drop ALL capabilities and may add back only NET_BIND_SERVICE.

Three sample questions

14 KCSA questions on Privilege Escalation, 14 with explanations. How practice works

Question 1

What does the term 'container breakout' refer to in the context of container security?
  1. A.When a container fails to start properly
  2. B.A container exceeding its allocated resource limits
  3. C.An attack where an attacker escapes container isolation to gain access to the host system
  4. D.Migrating a container to a different node in the cluster

Correct answer: C

A container breakout occurs when an attacker exploits vulnerabilities to escape the isolation boundaries of a container and gain unauthorized access to the underlying host system. This compromises the host's security and can lead to privilege escalation. Other options describe container lifecycle or resource management issues, which are unrelated to security breaches involving isolation escape.

Sources: Kubernetes Official Documentation - Security Context, CNCF Security Whitepaper - Container Security

Question 2

Which combination of pod configurations can allow a compromised Kubernetes pod to access and potentially modify the host system? (Select all that apply)

Select all that apply.

  1. A.Running the pod in privileged mode
  2. B.Mounting the host filesystem into the pod
  3. C.Using host networking in the pod
  4. D.Dropping all Linux capabilities from the pod

Correct answers: A, B, C

Running a pod in privileged mode grants it broad permissions, including the ability to access host resources and perform actions that can compromise the host system. Mounting the host filesystem into the pod exposes sensitive files and allows the pod to read or modify host data, which is a significant security risk. Using host networking gives the pod direct access to the host's network stack, increasing the risk of network-based attacks or eavesdropping. In contrast, dropping all Linux capabilities is a security best practice that reduces the attack surface and limits the pod's ability to affect the host, making this option incorrect.

Sources: Kubernetes Official Documentation - Security Context, Kubernetes Official Documentation - Privileged Mode, CNCF Security Whitepaper - Privilege Escalation

Question 3

Which of the following practices help prevent container breakout vulnerabilities? (Select all that apply)

Select all that apply.

  1. A.Running containers with root privileges
  2. B.Using minimal base images to reduce attack surface
  3. C.Applying the principle of least privilege to container permissions
  4. D.Regularly updating container runtimes and dependencies

Correct answers: B, C, D

Preventing container breakouts involves minimizing the attack surface and restricting privileges. Using minimal base images reduces unnecessary software that could be exploited. Applying the principle of least privilege limits container capabilities to only what is necessary, reducing risk. Regularly updating container runtimes ensures known vulnerabilities are patched. Conversely, running containers as root increases risk.

Sources: Kubernetes Official Documentation - Security Best Practices, Docker Security - Best Practices

Practice this topic

Focus mode keeps every question on Privilege Escalation until you leave it. 10 free guest answers, then a free account; no credit card.

Or open KCSA practice across all topics.

Sources

The explanation above was checked against these official documents.